コード例 #1
0
        private void btnadd_Click(object sender, EventArgs e)
        {
            ID();
            StaffEntry staffEntry = new StaffEntry(this, CommonConstant.DB_INSERT);

            staffEntry.txtStaffID.Text = staffID;
            staffEntry.Show();
        }
コード例 #2
0
        private void Dgstaff_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            int i;

            i = Dgstaff.CurrentRow.Index;

            StaffEntry staffEntry = new StaffEntry(this, CommonConstant.DB_UPDATE);

            staffEntry.txtStaffID.Text         = Dgstaff.Rows[i].Cells[0].Value.ToString();
            staffEntry.txtLginID.Text          = Dgstaff.Rows[i].Cells[1].Value.ToString(); // Add
            staffEntry.loginID                 = Dgstaff.Rows[i].Cells[1].Value.ToString();
            staffEntry.addID                   = Dgstaff.Rows[i].Cells[2].Value.ToString();
            staffEntry.txtStaffName.Text       = Dgstaff.Rows[i].Cells[3].Value.ToString();
            staffEntry.txtPassword.Text        = Dgstaff.Rows[i].Cells[4].Value.ToString();
            staffEntry.txtConfirmPassword.Text = Dgstaff.Rows[i].Cells[5].Value.ToString();
            staffEntry.cbRole.Text             = Dgstaff.Rows[i].Cells[6].Value.ToString();

            if (Dgstaff.Rows[i].Cells[7].Value.ToString() == CommonConstant.MALE)
            {
                staffEntry.radioMale.Checked = true;
            }
            else if (Dgstaff.Rows[i].Cells[7].Value.ToString() == CommonConstant.FEMALE)
            {
                staffEntry.radioFemale.Checked = true;
            }
            staffEntry.dtpDob.Value     = DateTime.Parse(Dgstaff.Rows[i].Cells[8].Value.ToString());
            staffEntry.txtEmail.Text    = Dgstaff.Rows[i].Cells[9].Value.ToString();
            staffEntry.txtPhoneNum.Text = Dgstaff.Rows[i].Cells[10].Value.ToString();
            staffEntry.txtNRC.Text      = Dgstaff.Rows[i].Cells[11].Value.ToString();
            staffEntry.txtAddress.Text  = Dgstaff.Rows[i].Cells[12].Value.ToString();
            staffEntry.txtCity.Text     = Dgstaff.Rows[i].Cells[13].Value.ToString();
            staffEntry.cbState.Text     = Dgstaff.Rows[i].Cells[14].Value.ToString();


            staffEntry.Show();
        }