コード例 #1
0
 private void btn_Save_Click(object sender, EventArgs e)
 {
     if (check_input())
     {
         Tb_HrEmp emp = (Tb_HrEmp)(from x in linq.Tb_HrEmps
                                   where x.EmpNo == Emp_No.Text
                                   select x).SingleOrDefault();
         emp.FullNameArab = FullNameArabTextEdit.Text;
         emp.FullNameEng  = FullNameEngTextEdit.Text;
         emp.IqamaNo      = IqamaNoTextEdit.Text;
         linq.SubmitChanges();
         MessageBox.Show(" Employee Updated Successfully");
         Loadagain();
     }
 }
コード例 #2
0
        private void btnDelete_ItemClick(object sender, ItemClickEventArgs e)
        {
            var          gv       = gridControl.MainView as GridView;
            var          index    = gv.FocusedRowHandle;
            string       emp_no   = gv.GetRowCellValue(index, "EmpNo").ToString();
            string       emp_Name = gv.GetRowCellValue(index, "FullNameEng").ToString();
            DialogResult Dr       = MessageBox.Show("Do you Want to delete this employee (" + emp_Name + ")", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

            if (Dr == DialogResult.Yes)
            {
                Tb_HrEmp Tb_HrEmps = (from emp in linq.Tb_HrEmps
                                      where emp.EmpNo == emp_no
                                      select emp).SingleOrDefault();
                Tb_HrEmps.Is_deleted = true;
                linq.SubmitChanges();
                MessageBox.Show(emp_Name + " deleted Successfly");
                load_data();
            }
        }