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 uVidpusk : Form
    {
        public userForm userForm;
        public dataBase dataBase;

        public uVidpusk()
        {
            InitializeComponent();
        }

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

                if (Convert.ToDouble(textBox6.Text) == 0)
                {
                    label7.ForeColor = Color.Red;
                    label7.Text = "Лише за власний рахунок!";
                }

                else
                {
                    label7.ForeColor = Color.Green;
                    label7.Text = "За рахунок компанії!";
                }

            }
        }

        private void uVidpusk_FormClosed(object sender, FormClosedEventArgs e)
        {
            userForm.Show();
        }
    }
}
