Beispiel #1
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            WorkerF      workerF = new WorkerF();
            DialogResult result  = workerF.ShowDialog(this);

            if (result == DialogResult.Cancel)
            {
                return;
            }

            string  name         = workerF.textBox1.Text;
            string  recruit_date = workerF.textBox2.Text;
            string  remove_date  = "9999.12.31 00:00:00";
            int     v            = Convert.ToInt32(workerF.textBox3.Text);
            int     group_id     = v;
            decimal base_salary  = Convert.ToDecimal(workerF.textBox4.Text);

            hr.AddWorkerToDB(name, recruit_date, remove_date, group_id, base_salary);
        }
Beispiel #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (dgvWorkers.CurrentRow != null)
            {
                WorkerF workerF = new WorkerF();
                workerF.label1.Text   = "Дата увольнения:";
                workerF.textBox1.Text = Convert.ToString(dgvWorkers.CurrentRow.Cells[3].Value);
                Utils.InactiveElem(workerF);

                DialogResult result = workerF.ShowDialog(this);
                if (result == DialogResult.Cancel)
                {
                    return;
                }
                hr.ChangeWorker(Convert.ToInt32(dgvWorkers.CurrentRow.Cells[0].Value), workerF.textBox1.Text);

                dgvWorkers.Rows.RemoveAt(dgvWorkers.SelectedRows[0].Index);
            }
            else
            {
                MessageBox.Show("Не выбран сотрудник",
                                "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
        }
Beispiel #3
0
 public static void InactiveElem(WorkerF workerF)   // костылёк
 {
     workerF.label2.Visible       = workerF.label3.Visible = workerF.label4.Visible =
         workerF.textBox2.Visible = workerF.textBox3.Visible = workerF.textBox4.Visible = false;
 }