/// <summary>
        /// Tạo ComboBox danh sách các ca làm việc
        /// </summary>
        private void PopulateShiftCombo()
        {
            ShiftDO shiftDO = new ShiftDO();
            DataSet dsShift = shiftDO.GetShiftOver();

            cboShift.DataSource = dsShift.Tables[0];
            cboShift.DisplayMember = "ShiftName";
            cboShift.ValueMember = "ShiftOverID";
        }
Beispiel #2
0
 /// <summary>
 /// Xóa ca làm thêm
 /// </summary>
 public void DeleteShiftOver()
 {
     if (selectedRow < 0)
     {
         string str = WorkingContext.LangManager.GetString("frmListShift_Del_Messa4");
         string str1 = WorkingContext.LangManager.GetString("frmListShift_Del_Title");
         //MessageBox.Show("Bạn chưa chọn ca nào!", "Xóa ca", MessageBoxButtons.OK,  MessageBoxIcon.Error);
         MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
     int ret = 0;
     try
     {
         ShiftDO shiftDO = new ShiftDO();
         DataSet dsShiftOver = shiftDO.GetShiftOver();
         DataTable dtShift = dsShiftOver.Tables[0];
         dtShift.Rows[selectedRow].Delete();
         ret = shiftDO.DeleteShiftOver(dsShiftOver);
     }
     catch
     {
         dtShift.RejectChanges();
     }
     if (ret == 2)
     {
         string str = WorkingContext.LangManager.GetString("frmListShift_Del_Messa3");
         string str1 = WorkingContext.LangManager.GetString("frmListShift_Del_Title");
         //MessageBox.Show("Ca đã được xóa khỏi cơ sở dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
         MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Information);
         dtShift.AcceptChanges();
         //				PopulateEmployeeListView();
     }
     else
     {
         string str = WorkingContext.LangManager.GetString("frmListShift_Del_Messa4");
         string str1 = WorkingContext.LangManager.GetString("frmListShift_Del_Title");
         //MessageBox.Show("Không thể xóa ca khỏi cơ sở dữ liệu", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         MessageBox.Show(str, str1, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         dtShift.RejectChanges();
     }
 }