public void Update(DAL.DanhSachNhanVienChamCongDacBiet chamcongdacbiet)
    {
        var item = dataContext.DanhSachNhanVienChamCongDacBiets.Where(p => p.ID == chamcongdacbiet.ID).SingleOrDefault();

        item.SoLanChitTay = chamcongdacbiet.SoLanChitTay;
        Save();
    }
 protected void btnCapNhatThem_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DAL.DanhSachNhanVienChamCongDacBiet chamcongdacbiet = new DAL.DanhSachNhanVienChamCongDacBiet();
         string strCanbotrung = "";
         foreach (var item in tgfMaCanBo.Text.Split(','))
         {
             chamcongdacbiet = new DanhSachChamCongDacBietController().GetByMaCB(item);
             if (chamcongdacbiet != null)
             {
                 strCanbotrung += "Cán bộ " + new HoSoController().TraVeTenByMaCB(item) + " đã có trong danh sách chấm công đặc biệt<br/>";
             }
             else
             {
                 chamcongdacbiet              = new DAL.DanhSachNhanVienChamCongDacBiet();
                 chamcongdacbiet.MaCB         = item;
                 chamcongdacbiet.SoLanChitTay = int.Parse(cbbSoLanChitTay.SelectedItem.Value);
                 chamcongdacbiet.CreatedDate  = DateTime.Now;
                 chamcongdacbiet.CreatedBy    = CurrentUser.ID;
                 new DanhSachChamCongDacBietController().Insert(chamcongdacbiet);
                 Dialog.ShowNotification("Thông báo", "Đã lưu thành công cán bộ " + item);
             }
         }
         if (strCanbotrung != "")
         {
             X.Msg.Alert("Thông báo", strCanbotrung).Show();
         }
         if (e.ExtraParams["Close"] == "True")
         {
             wdAddWindow.Hide();
         }
         else
         {
             grpDanhSachNhanVienChamCongDacBiet.GetResourceManager().RegisterClientScriptBlock("r1", "resetForm();");
         }
         grpDanhSachNhanVienChamCongDacBiet.GetGridPanel().Reload();
     }
     catch (Exception ex)
     {
         X.Msg.Alert("Có lỗi xảy ra", ex.Message).Show();
     }
 }
 protected void btnCapNhatSua_Click(object sender, DirectEventArgs e)
 {
     try
     {
         DAL.DanhSachNhanVienChamCongDacBiet chamcongdacbiet = new DAL.DanhSachNhanVienChamCongDacBiet();
         chamcongdacbiet.MaCB         = tgfMaCanBo.Text;
         chamcongdacbiet.SoLanChitTay = int.Parse(cbbSoLanChitTay.SelectedItem.Value);
         chamcongdacbiet.CreatedDate  = DateTime.Now;
         chamcongdacbiet.CreatedBy    = CurrentUser.ID;
         new DanhSachChamCongDacBietController().Update(chamcongdacbiet);
         Dialog.ShowNotification("Thông báo", "Đã cập nhật thành công");
         grpDanhSachNhanVienChamCongDacBiet.GetGridPanel().Reload();
         wdAddWindow.Hide();
     }
     catch (Exception ex)
     {
         X.Msg.Alert("Có lỗi xảy ra", ex.Message).Show();
     }
 }
 public void Delete(string macb)
 {
     DAL.DanhSachNhanVienChamCongDacBiet item = dataContext.DanhSachNhanVienChamCongDacBiets.Where(p => p.MaCB == macb).SingleOrDefault();
     dataContext.DanhSachNhanVienChamCongDacBiets.DeleteOnSubmit(item);
 }
 public void Update(DAL.DanhSachNhanVienChamCongDacBiet nhanviendacbiet)
 {
     DAL.DanhSachNhanVienChamCongDacBiet item = dataContext.DanhSachNhanVienChamCongDacBiets.Where(p => p.MaCB == nhanviendacbiet.MaCB).SingleOrDefault();
     item.SoLanChitTay = nhanviendacbiet.SoLanChitTay;
     Save();
 }
 public void Insert(DAL.DanhSachNhanVienChamCongDacBiet nhanviendacbiet)
 {
     dataContext.DanhSachNhanVienChamCongDacBiets.InsertOnSubmit(nhanviendacbiet);
     Save();
 }