protected void btnSuaClick(object sender, DirectEventArgs e) { try { if (grpDanhSachNhanVienChamCongDacBiet.GetSelectedRecordIDs().Count > 1) { X.Msg.Alert("Thông báo", "Bạn chỉ được chọn 1 dòng").Show(); return; } wdAddWindow.Icon = Icon.Pencil; wdAddWindow.Title = "Sửa đối tượng chấm công đặc biệt"; DAL.DanhSachNhanVienChamCongDacBiet dieukien = new DanhSachChamCongDacBietController().GetByID(int.Parse(grpDanhSachNhanVienChamCongDacBiet.GetSelectedRecordIDs().FirstOrDefault().ToString())); tgfMaCanBo.Text = dieukien.MaCB; txtHoTen.Text = new HoSoController().TraVeTenByMaCB(dieukien.MaCB); cbbSoLanChitTay.Value = dieukien.SoLanChitTay.ToString(); tgfMaCanBo.Disabled = true; btnCapNhatSua.Show(); btnCapNhatThem.Hide(); btnCapNhatThemVaDongLai.Hide(); wdAddWindow.Show(); } catch (Exception ex) { X.Msg.Alert("Có lỗi xảy ra", ex.Message).Show(); } }
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(); } }