using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace diplom
{
    public partial class money : Form
    {
        public dataBase dataBase;
        public adminForm adminForm;

        public money()
        {
            InitializeComponent();
        }

        private void money_Load(object sender, EventArgs e)
        {
            dataBase.Show();
            dataBase.Visible = false;
            if (dataBase.workerisDataGridView.Rows[0].Cells[0].Value != null)
            {
                groupBox1.Visible = true;
                textBox1.Text = dataBase.workerisDataGridView.Rows[0].Cells[1].Value.ToString();
                textBox2.Text = dataBase.workerisDataGridView.Rows[0].Cells[3].Value.ToString();

                if (Convert.ToDouble(dataBase.workerisDataGridView.Rows[0].Cells[5].Value) >= 10) {

                    label3.ForeColor = Color.Green;
                    label3.Text = "Потребує премії!";
                }

                else
                {
                    label3.ForeColor = Color.Red;
                    label3.Text = "Можливі відрахування!";
                }
            }

            if (dataBase.workerisDataGridView.Rows[1].Cells[0].Value != null)
            {
                groupBox2.Visible = true;
                textBox3.Text = dataBase.workerisDataGridView.Rows[1].Cells[1].Value.ToString();
                textBox4.Text = dataBase.workerisDataGridView.Rows[1].Cells[3].Value.ToString();

                if (Convert.ToDouble(dataBase.workerisDataGridView.Rows[1].Cells[5].Value) >= 10)
                {
                    label4.ForeColor = Color.Green;
                    label4.Text = "Потребує премії!";
                }

                else
                {
                    label4.ForeColor = Color.Red;
                    label4.Text = "Можливі відрахування!";
                }
            }

            if (dataBase.workerisDataGridView.Rows[2].Cells[0].Value != null)
            {
                groupBox3.Visible = true;
                textBox5.Text = dataBase.workerisDataGridView.Rows[2].Cells[1].Value.ToString();
                textBox6.Text = dataBase.workerisDataGridView.Rows[2].Cells[3].Value.ToString();

                if (Convert.ToDouble(dataBase.workerisDataGridView.Rows[2].Cells[5].Value) >= 10)
                {
                    label7.ForeColor = Color.Green;
                    label7.Text = "Потребує премії!";
                }

                else {
                    label7.ForeColor = Color.Red;
                    label7.Text = "Можливі відрахування!";                
                }
            }

        }

        private void money_FormClosed(object sender, FormClosedEventArgs e)
        {
            adminForm.Show();
            this.Hide();
            dataBase.Hide();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }
    }
}
