コード例 #1
0
        private void bnNew_Click(object sender, EventArgs e)
        {
            employeeInputForm inputForm = new employeeInputForm();

            inputForm.Owner = this;

            inputForm.ShowDialog();
            dgEmployees.Rows.Clear();
            loadData();
        }
コード例 #2
0
 private void btnChoice_Click(object sender, EventArgs e)
 {
     if (txtEmpID.Text == "")
     {
         MessageBox.Show("Please choose row before click 'Choice'", "Warning");
     }
     else
     {
         employeeInputForm owner = (employeeInputForm)this.Owner;
         owner.setMngerID(this.txtEmpID.Text);
         this.Close();
     }
 }
コード例 #3
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (dgEmployees.SelectedRows.Count == 0)
            {
                MessageBox.Show("Please choose 1 row!");
                return;
            }
            employeeInputForm inputForm = new employeeInputForm();

            inputForm.Owner = this;
            DataGridViewRow r = dgEmployees.SelectedRows[0];

            inputForm.setInfo(r.Cells["lastname"].Value.ToString(), r.Cells["firstname"].Value.ToString(),
                              r.Cells["courtesy"].Value.ToString(), DateTime.Parse(r.Cells["birthday"].Value.ToString()),
                              DateTime.Parse(r.Cells["hireDate"].Value.ToString()),
                              r.Cells["Title"].Value.ToString(), r.Cells["mgrid"].Value.ToString(), r.Cells["phone"].Value.ToString(),
                              r.Cells["postalCode"].Value.ToString(), r.Cells["address"].Value.ToString(), r.Cells["City"].Value.ToString(),
                              r.Cells["country"].Value.ToString(), r.Cells["region"].Value.ToString(), int.Parse(r.Cells["emID"].Value.ToString()));
            inputForm.ShowDialog();
            dgEmployees.Rows.Clear();
            loadData();
        }