protected void OutputRows(SelectedRowCollection rows, Label label) { StringBuilder sb = new StringBuilder(); sb.Append("<table width='100%' cellspacing='5'>"); bool addHeader = true; foreach (SelectedRow rowd in rows) { if (addHeader) { sb.Append("<tr>"); this.AddHeaderCell(sb, "RecordID"); this.AddHeaderCell(sb, "RowIndex"); sb.Append("</tr>"); addHeader = false; } sb.Append("<tr>"); this.AddCell(sb, rowd.RecordID); this.AddCell(sb, rowd.RowIndex.ToString()); sb.Append("</tr>"); } sb.Append("</table>"); label.Html = sb.ToString(); }
bool IPostBackDataHandler.LoadPostData(string postDataKey, NameValueCollection postCollection) { this.HasLoadPostData = true; string val = postCollection[this.ConfigID]; if (val != null) { this.selectedRows = JSON.Deserialize<SelectedRowCollection>(val); } return false; }
/// <summary> /// /// </summary> /// <param name="postDataKey"></param> /// <param name="postCollection"></param> /// <returns></returns> protected virtual bool LoadPostData(string postDataKey, NameValueCollection postCollection) { string val = postCollection[this.ConfigID]; if (val != null) { JsonSerializer serializer = new JsonSerializer(); serializer.MissingMemberHandling = MissingMemberHandling.Ignore; StringReader sr = new StringReader(val); this.selectedRows = (SelectedRowCollection)serializer.Deserialize(sr, typeof(SelectedRowCollection)); } return false; }
protected void btn_SentEmail_HappyBirthDay_Click(object sender, DirectEventArgs e) { try { SelectedRowCollection selecteds = RowSelectionModel3.SelectedRows; string mailto = string.Empty; string error = ""; DataTable dt = DataController.DataHandler.GetInstance().ExecuteDataTable("sp_GetAllEmailHappyBirthDayMonth"); if (e.ExtraParams["All"] == "True") { for (int i = 0; i < dt.Rows.Count; i++) { if (!string.IsNullOrEmpty(dt.Rows[i]["Email"].ToString())) { mailto += dt.Rows[i]["Email"].ToString() + ", "; } else if (!string.IsNullOrEmpty(dt.Rows[i]["EMAIL_RIENG"].ToString())) { mailto += dt.Rows[i]["EMAIL_RIENG"].ToString() + ", "; } else { error += dt.Rows[i]["HO_TEN2"].ToString() + " "; } } } else { foreach (var item in selecteds) { string ma_CB = item.RecordID; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["Ma_CB"].ToString() == ma_CB) { if (!string.IsNullOrEmpty(dt.Rows[i]["Email"].ToString())) { mailto += dt.Rows[i]["Email"].ToString() + ", "; } else if (!string.IsNullOrEmpty(dt.Rows[i]["EMAIL_RIENG"].ToString())) { mailto += dt.Rows[i]["EMAIL_RIENG"].ToString() + ", "; } else { Dialog.ShowError(GlobalResourceManager.GetInstance().GetDesktopValue("email_not_found")); return; } } } } } string mail = ""; for (int i = 0; i < mailto.Length - 2; i++) { mail += mailto[i]; } HeThongController htController = new HeThongController(); SendMail1.SetEmailTo(htController.GetValueByName(SystemConfigParameter.EMAIL, Session["MaDonVi"].ToString()), htController.GetValueByName(SystemConfigParameter.PASSWORD_EMAIL, Session["MaDonVi"].ToString()), mail); SendMail1.Show(); if (!string.IsNullOrEmpty(error.Trim())) { Dialog.ShowError("Một số nhân viên không có email :" + error); } } catch (Exception ex) { Dialog.ShowError("Lỗi xảy ra " + ex.Message); } }
//sự kiện sau khi ấn nút click trên thêm void ucChooseEmployee1_AfterClickAcceptButton(object sender, EventArgs e) { QuanLyThongTinBaoHiemController qlc = new QuanLyThongTinBaoHiemController(); SelectedRowCollection sm = ucChooseEmployee1.SelectedRow; foreach (HOSO hs in sm.Select(item => new HoSoController().GetByMaCB(item.RecordID))) { txtMaCanBo.Text = hs.MA_CB; txtSoCMND.Text = hs.SO_CMND; dfNgaySinh.Value = hs.NGAY_SINH; txtGioiTinh.Text = hs.MA_GIOITINH == "F" ? "Nữ" : "Nam"; txtHoTen.Text = hs.HO_TEN; if (!string.IsNullOrEmpty(hs.MA_CHUCVU)) { txtChucVu.Text = hs.DM_CHUCVU.TEN_CHUCVU; } if (!string.IsNullOrEmpty(hs.MA_NOICAP_CMND)) { txtNoiCapCMND.Text = hs.DM_NOICAP_CMND.TEN_NOICAP_CMND; } txtDiaChi.Text = hs.DIA_CHI_LH; string soquyetdinh, tenquyetdinh; DateTime?ngayky, Ngayhieuluc, Hethieuluc; decimal? luongbaohiem, phucapcv, phucaptnn, phucaptnvk, phucapkhac; new BaoHiemController().TTQuyetDinhLuongMoiNhat(int.Parse(hs.PR_KEY.ToString()), out soquyetdinh, out tenquyetdinh, out ngayky, out Ngayhieuluc, out Hethieuluc, out luongbaohiem, out phucapcv, out phucaptnn, out phucaptnvk, out phucapkhac); nfLuongBaoHiem.Value = qlc.GetLuongDongBaoHiem(hs.PR_KEY); hdfPhuCap.Text = phucapcv.ToString() + ";" + phucaptnn.ToString() + ";" + phucaptnvk.ToString() + ";" + phucapkhac.ToString(); nfTongPhuCap.Value = phucapcv + phucaptnn + phucaptnvk + phucapkhac; txtSoTheBHYT.Text = hs.SOTHE_BHYT; if (!string.IsNullOrEmpty(hs.SOTHE_BHXH)) { cbbTrangThaiCapThe.SetValue("ChuaCapThe"); hdfTrangThaiCapThe.SetValue("ChuaCapThe"); } else { cbbTrangThaiCapThe.SetValue("DaCapThe"); hdfTrangThaiCapThe.SetValue("DaCapThe"); } ddfNoiDangKyKhamChuaBenh.Text = !string.IsNullOrEmpty(hs.MA_NOI_KCB) ? hs.DM_NOI_KCB.TEN_NOI_KCB : ""; if (!util.IsDateNull(hs.NGAY_DONGBH)) { cbbTuThangBHYT.Value = hs.NGAY_DONGBH.Value.Month; spinTuNamBHYT.Value = hs.NGAY_DONGBH.Value.Year; } if (!util.IsDateNull(hs.NGAY_HETHAN_BHYT)) { cbbDenThangBHYT.Value = hs.NGAY_HETHAN_BHYT.Value.Month; spinDenNamBHYT.Value = hs.NGAY_HETHAN_BHYT.Value.Year; } if (!string.IsNullOrEmpty(hs.MA_NOICAP_BHXH)) { txtNoiCapSoBHXH.Text = hs.DM_NOICAP_BHXH.TEN_NOICAP_BHXH; } if (!util.IsDateNull(hs.NGAY_DONGBH)) { txtSoSoBHXH.Text = hs.SOTHE_BHXH; } cbbTrangthaiCapSo.SetValue(string.IsNullOrEmpty(hs.SOTHE_BHXH) ? "ChuaCapSo" : "DaCapSo"); hdfTrangThaiCapSo.SetValue(string.IsNullOrEmpty(hs.SOTHE_BHXH) ? "ChuaCapSo" : "DaCapSo"); if (!util.IsDateNull(hs.NGAYCAP_BHXH)) { dfNgayCapSo.SelectedDate = (DateTime)hs.NGAYCAP_BHXH; } bool bhxh, bhyt, bhtn; string tenloaihdong; qlc.GetHoSoHopDong(hs.PR_KEY, out bhxh, out bhyt, out bhtn, out tenloaihdong); txtLoaiHopDong.Text = tenloaihdong; nfSoThangDongTruocThem.Text = "0"; nfSoNamDongTruocThem.Text = "0"; chkBHXH.Checked = bhxh; chkBHYT.Checked = bhyt; chkBHTN.Checked = bhtn; if (bhxh == false) { RM.RegisterClientScriptBlock("rel1", "setDisableBHXH();"); } else { RM.RegisterClientScriptBlock("rel2", "setEnableBHXH();"); } if (bhyt == false) { RM.RegisterClientScriptBlock("rel3", "setDisableBHYT();"); } else { RM.RegisterClientScriptBlock("rel4", "setEnableBHYT();"); } } }
void ucChooseEmployee1_AfterClickAcceptButton(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(hdfIDBangLuong.Text)) { Dialog.ShowError("Bạn chưa chọn bảng lương"); return; } int idBangLuong = int.Parse(hdfIDBangLuong.Text); DAL.DanhSachBangLuong bangLuong = new DanhSachBangLuongController().GetByID(idBangLuong); if (bangLuong.DaKhoa == true) { Dialog.ShowError("Bảng lương đã khóa. Bạn không được phép thao tác"); return; } if (string.IsNullOrEmpty(hdfIDBangLuong.Text) || hdfIDBangLuong.Text == "0") { Dialog.ShowError("Bạn chưa chọn bảng lương nào"); return; } int count = 0; string ma = "", errStr = string.Empty; // lấy danh sách các mã cán bộ được chọn SelectedRowCollection selectedRows = ucChooseEmployee1.SelectedRow; foreach (var item in selectedRows) { try { bool isSuccess = bool.Parse(DataController.DataHandler.GetInstance().ExecuteScalar("InsertEmployeeToSalaryBoard", "@IDBangLuong", "@MaCanBo", idBangLuong, item.RecordID).ToString()); if (isSuccess == false) { ma += item.RecordID + ", "; count++; } } catch (Exception) { count++; } } if (count == 0) { Dialog.ShowNotification("Thêm mới cán bộ thành công"); } else { errStr += "Không thêm được " + count + " cán bộ."; if (ma != "") { ma = ma.Remove(ma.LastIndexOf(',')); errStr += " Các cán bộ có mã " + ma + " đã tồn tại"; } X.Msg.Alert("Thông báo từ hệ thống", errStr).Show(); } grpSalaryBoard.Reload(); } catch (Exception ex) { X.Msg.Alert("Thông báo từ hệ thống", "Có lỗi xảy ra: " + ex.Message).Show(); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ucChooseEmployee1_AfterClickAcceptButton(object sender, EventArgs e) { SelectedRowCollection s = (SelectedRowCollection)sender; }
protected void btnDongYKhongDuyetClick(object sender, DirectEventArgs e) { int dem = 0; int khongduyet = 0; int dahoantat = 0; int demnguoikhongduquyen = 0; SelectedRowCollection selectedrow = RowSelectDuyetDonXinNghi.SelectedRows; foreach (var item in selectedrow) { int recordid = int.Parse(item.RecordID); var donxinnghi = new DonXinNghiController().GetDonXinNghiByID(recordid); if (donxinnghi.MaCBDangDuyet != hdfMaCB.Text && !bool.Parse(hdfHCSNDuyet.Text)) { demnguoikhongduquyen++; } else if (donxinnghi.TrangThaiDuyet == DonXinNghiController.KHONG_DUYET) { khongduyet++; } else if (donxinnghi.TrangThaiDuyet == DonXinNghiController.HOANTATTHUTUC) { dahoantat++; } else { donxinnghi.TrangThaiDuyet = DonXinNghiController.KHONG_DUYET; new DonXinNghiController().UpdateDonXinNghi(donxinnghi); dem++; DAL.DonXinNghiLichSu lichsu = new DAL.DonXinNghiLichSu() { CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now, GhiChu = txtLyDoKhongDuyet.Text, IDDonXinNghi = recordid, MaCBDuyet = hdfMaCB.Text, NgayDuyet = DateTime.Now, TrangThai = DonXinNghiController.KHONG_DUYET, HCNSDuyet = bool.Parse(hdfHCSNDuyet.Text) }; new DonXinNghiController().InsertDonXinNghiLichSu(lichsu); } } string thongbao = ""; if (demnguoikhongduquyen > 0) { thongbao += "Hiện tại bạn không phải là người được quyền duyệt " + demnguoikhongduquyen.ToString() + " đơn xin nghỉ<br/>"; } if (khongduyet > 0) { thongbao += "Đã có " + khongduyet.ToString() + " đơn xin nghỉ không được duyệt <br/>"; } if (dahoantat > 0) { thongbao += "Đã có " + dahoantat.ToString() + " đơn xin nghỉ đã hoàn tất thủ tục <br/>"; } if (thongbao != "") { X.Msg.Alert("Thông báo", thongbao).Show(); } if (dem > 0) { Dialog.ShowNotification("Thông báo", "Bạn đã xác nhận không duyệt " + dem.ToString() + " đơn xin nghỉ<br/>"); } wdKhongDuyet.Hide(); RM.RegisterClientScriptBlock("resetf1", "grpDuyetDonXinNghiStore.reload(); grpLichSuDonXinNghiStore.reload();"); }
void ucChooseEmployee1_AfterClickAcceptButton(object sender, EventArgs e) { try { SelectedRowCollection SelectedRow = ucChooseEmployee1.SelectedRow; List <DAL.DM_GiaoVienDaoTao> lists = new List <DAL.DM_GiaoVienDaoTao>(); DaoTaoController daoTaoController = new DaoTaoController(); HoSoController dmcbController = new HoSoController(); string str = string.Empty; foreach (var item in SelectedRow) { DAL.HOSO employee = dmcbController.GetByMaCB(item.RecordID); if (daoTaoController.IsDuplicateMaGiaoVien(employee.MA_CB) == false) { DAL.DM_GiaoVienDaoTao gv = new DAL.DM_GiaoVienDaoTao() { // new DanhMucChucVuController().GetNameByPrimaryKey(employee.MA_CHUCVU), CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now, DiaChiLienHe = employee.DIA_CHI_LH, DiDong = employee.DI_DONG, DonViCongTac = new DM_DONVIController().GetNameById(employee.MA_DONVI), DTCoQuan = employee.DT_CQUAN, GioiTinh = employee.MA_GIOITINH == "M" ? true : false, HocVan = new DM_TRINHDOController().GetNameByPrimaryKey(employee.MA_TRINHDO), HoTenGV = employee.HO_TEN, KinhNghiemGiangDay = string.Empty, LaNhanvienCty = true, MA_DONVI = employee.MA_DONVI, MaGV = employee.MA_CB, NgaySinh = employee.NGAY_SINH, NhanXet = string.Empty, }; if (employee.DM_CHUCVU != null) { gv.ChucVu = employee.DM_CHUCVU.TEN_CHUCVU; } if (!string.IsNullOrEmpty(employee.EMAIL) && !string.IsNullOrEmpty(employee.EMAIL_RIENG)) { gv.Email = employee.EMAIL + " ; " + employee.EMAIL_RIENG; } else if (!string.IsNullOrEmpty(employee.EMAIL)) { gv.Email = employee.EMAIL; } else if (!string.IsNullOrEmpty(employee.EMAIL_RIENG)) { gv.Email = employee.EMAIL_RIENG; } lists.Add(gv); } else { str += employee.HO_TEN + "(" + item.RecordID + "), "; } } daoTaoController.CopyCanBoToGiaoVienDaoTao(lists); // grp_DanhSachGiangVien.ReloadStore(); if (!string.IsNullOrEmpty(str)) { Dialog.ShowNotification(string.Format("Đã thêm thành công! Một số nhân viên đã tồn tại bao gồm: {0}", str.Substring(0, str.Length - 2))); } else { Dialog.ShowNotification("Thông báo", "Đã thêm thành công"); } } catch (Exception ex) { Dialog.ShowError(ex.Message.ToString()); } }
/// <summary> /// Thêm nhân viên vào bảng cán bộ được đánh giá /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ucChooseEmployee1_AfterClickAcceptButton(object sender, EventArgs e) { try { string chonCB = hdfChonCanBo.Text; switch (chonCB) { case "1": SelectedRowCollection SelectedRow = ucChooseEmployee1.SelectedRow; HoSoController dmcbController = new HoSoController(); string str = ""; foreach (var item in SelectedRow) { HOSO emp = dmcbController.GetByMaCB(item.RecordID); if (emp != null) { if (new CanBoDuocDanhGiaController().CheckExistMaCBDuocDanhGia(emp.MA_CB, hdfRecordID.Text) == false) { CanBoDuocDanhGiaInfo cbo = new CanBoDuocDanhGiaInfo() { MaCB = emp.MA_CB, MaDotDanhGia = hdfRecordID.Text, CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now }; int id = new CanBoDuocDanhGiaController().Insert(cbo); cbo.ID = id; // tạo bản đánh giá trống //CreateKetQuaDanhGiaByMaCB(cbo.MaCB); } else { str += emp.HO_TEN + "(" + item.RecordID + "), "; } } } RM.RegisterClientScriptBlock("reloadst", "#{grp_CanBoDuocDanhGia_Store}.reload();"); if (!string.IsNullOrEmpty(str)) { X.MessageBox.Alert("Thông báo", "Các nhân viên sau đã tồn tại: " + str).Show(); } else { X.MessageBox.Alert("Thông báo", "Đã thêm cán bộ thành công"); } break; case "0": SelectedRowCollection SelectedRow1 = ucChooseEmployee1.SelectedRow; HoSoController dmcbController1 = new HoSoController(); string str1 = ""; foreach (var item in SelectedRow1) { HOSO emp = dmcbController1.GetByMaCB(item.RecordID); if (emp != null) { if (new CanBoThamGiaDanhGiaController().CheckExistMaCBThamGiaDanhGia(hdfCanBoDuocDanhGiaID.Text, emp.MA_CB, hdfRecordID.Text) == false) { CanBoThamGiaDanhGiaInfo cbo = new CanBoThamGiaDanhGiaInfo() { MaCBDanhGia = emp.MA_CB, MaDotDanhGia = hdfRecordID.Text, MaCBBiDanhGia = "", CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now }; new CanBoThamGiaDanhGiaController().Insert(cbo); } else { str1 += emp.HO_TEN + "(" + item.RecordID + "), "; } } } RM.RegisterClientScriptBlock("reloadst1", "#{grp_CanBoThamGiaDanhGia_Store}.reload();"); if (!string.IsNullOrEmpty(str1)) { X.MessageBox.Alert("Thông báo", "Các nhân viên sau đã tồn tại: " + str1).Show(); } else { X.MessageBox.Alert("Thông báo", "Đã thêm cán bộ thành công"); } break; } } catch (Exception ex) { X.MessageBox.Alert("Có lỗi xảy ra", ex.Message).Show(); } }