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 effect : Form
    {
        public adminForm adminForm;
        public dataBase dataBase;

        public effect()
        {
            InitializeComponent();
        }

        private void effect_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[5].Value.ToString();

                if (Convert.ToDouble(textBox2.Text) <= 0)
                {
                    label3.ForeColor = Color.Red;
                    label3.Text = "Ефективність зменшена!";
                }

                else { 
                     label3.ForeColor = Color.Green;
                     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[5].Value.ToString();

                if (Convert.ToDouble(textBox4.Text) <= 0)
                {
                    label4.ForeColor = Color.Red;
                    label4.Text = "Ефективність зменшена!";
                }

                else
                {
                    label4.ForeColor = Color.Green;
                    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[5].Value.ToString();

                    if (Convert.ToDouble(textBox6.Text) <= 0)
                    {
                        label7.ForeColor = Color.Red;
                        label7.Text = "Ефективність зменшена!";
                    }

                    else
                    {
                        label7.ForeColor = Color.Green;
                        label7.Text = "Ефективність підвищена!";
                    }

                }
            }
        }

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

        private void textBox2_TextChanged(object sender, EventArgs e)
        {

        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void оновитиToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
        }

        private void label3_Click(object sender, EventArgs e)
        {

        }
    }
}
