Esempio n. 1
0
 private void btAddUser_Click(object sender, EventArgs e)
 {
     enableGui();
     foreach (Control item in this.gbInformation.Controls)
     {
         if (item is TextBox)
         {
             item.ResetText();
         }
     }
     nv = new Staff();
 }
Esempio n. 2
0
 private void btEditUser_Click(object sender, EventArgs e)
 {
     enableGui();
     if (dtUserList.SelectedRows.Count == 1)
     {
         var row = dtUserList.SelectedRows[0];
         var cell = row.Cells["id"];
         int id = (int)cell.Value;
         //get staff information
         var temp = from b in db.Staffs
                    where b.id == id
                    select b;
         nv = temp.ToList()[0];
     }
 }
Esempio n. 3
0
        private void dtUserList_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (dtUserList.SelectedRows.Count == 1)
            {
                var row = dtUserList.SelectedRows[0];
                var cell = row.Cells["id"];
                int id = (int)cell.Value;
                //get staff information
                var temp = from b in db.Staffs
                           where b.id == id
                           select b;

                nv = temp.ToList()[0];

                txtfullname.Text = nv.Fullname;
                txtadress.Text = nv.Address;
                txtmobile.Text = nv.MobileNumber;
                txtusename.Text = nv.Username;
                ckbactive.Checked = (bool)nv.Active;

                //department
                if (nv.id_Department != null)
                {
                    var dep = from b in db.Departments
                              where b.id == nv.id_Department
                              select b;
                    cbdepartment.Text = dep.ToList()[0].Department1.ToString();
                }
                else
                {
                    cbdepartment.Text = "";
                }
                // Staff role
                if (nv.id_Staff_Role != null)
                {
                    var role = from b in db.Staff_Role
                               where b.id == nv.id_Staff_Role
                               select b;
                    cbdepartment.Text = role.ToList()[0].Role_name.ToString();
                }
                else
                {
                    cbdepartment.Text = "";
                }
            }
            else
            {

            }
        }