public void DeleteRecord(string pr_key) { try { #region Xóa kết quả đánh giá DAL.DotDanhGia table4 = new DotDanhGiaController().GetByPrkey(pr_key); DataTable list = new TieuChi_DotDanhGiaController().GetByMaDotDanhGia(table4.ID); foreach (DataRow item in list.Rows) { new KetQuaDanhGiaController().DeleteByIdTieuChi_DotDanhGia(int.Parse(item["ID"].ToString())); } #endregion #region Xóa danh sách cán bộ bị đánh giá var table1 = new CanBoDuocDanhGiaController().GetByMaDotDanhGia(pr_key); foreach (DataRow it1 in table1.Rows) { int id = int.Parse("0" + it1["ID"].ToString()); if (id != 0) { DeleteRecordCanBoDuocDanhGia(id); } } #endregion #region Xóa danh sách cán bộ tham gia đánh giá table1 = new CanBoThamGiaDanhGiaController().GetByMaDotDanhGia(pr_key); foreach (DataRow it1 in table1.Rows) { int id = int.Parse("0" + it1["ID"].ToString()); DeleteRecordCanBoThamDanhGia(id); } #endregion #region Xóa danh sách tiêu chí đánh giá của đợt table1 = new TieuChi_DotDanhGiaController().GetByMaDotDanhGia(pr_key); foreach (DataRow it1 in table1.Rows) { int id = int.Parse("0" + it1["ID"].ToString()); DeleteRecordTieuChi(id); } #endregion #region xóa nhận xét new NhanXetController().DeleteByMaDotDG(pr_key); #endregion // Xóa thông tin của đợt tuyển dụng new DotDanhGiaController().DeleteByPrkey(pr_key); hdfRecordID.Text = ""; } catch (Exception ex) { X.MessageBox.Alert("Thông báo", "Xóa đợt đánh giá xảy ra lỗi: " + ex.Message.ToString()).Show(); } }
public void DeleteRecordCanBoDuocDanhGia(int id) { // xóa kết quả đánh giá DAL.DotDanhGia table4 = new DotDanhGiaController().GetByPrkey(hdfRecordID.Text); DataTable list = new TieuChi_DotDanhGiaController().GetByMaDotDanhGia(table4.ID); DAL.CanBoDuocDanhGia cb = new CanBoDuocDanhGiaController().GetByPrkey(id); if (cb != null) { foreach (DataRow item in list.Rows) { new KetQuaDanhGiaController().DeleteByMaCBvaIdTieuChiDotDanhGia(cb.MaCB, int.Parse(item["ID"].ToString())); } } new CanBoDuocDanhGiaController().DeleteByPrkey(id); hdfCanBoDuocDanhGiaID.Text = ""; }
private void CreateKetQuaDanhGiaByIdTieuChiDotDanhGia(TieuChi_DotDanhGiaInfo tcd) { DataTable canbos = new CanBoDuocDanhGiaController().GetByMaDotDanhGia(tcd.MaDotDanhGia); foreach (DataRow item in canbos.Rows) { DAL.KetQuaDanhGia tmp = new KetQuaDanhGiaController().GetByMaCBvaIdTieuChiDotDanhGia(item["MaCB"].ToString(), tcd.ID); if (tmp == null) { DAL.KetQuaDanhGia info = new DAL.KetQuaDanhGia() { CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now, Diem = 0, IdTieuChi_DotDanhGia = tcd.ID, IsQuanLyDanhGia = false, MaCB = item["MaCB"].ToString(), NhanXet = "" }; new KetQuaDanhGiaController().Insert(info); } } }
protected void btnOK_Click(object sender, DirectEventArgs e) { try { DAL.DotDanhGia record = new DotDanhGiaController().GetByPrkey(txtmaloaihdcoppy.Text); if (record != null) { Dialog.ShowNotification("Mã đã tồn tại"); } else { record = new DotDanhGiaController().GetByPrkey(hdfRecordID.Text); DAL.DotDanhGia item = new DAL.DotDanhGia() { ID = txtmaloaihdcoppy.Text, TenDotDanhGia = txtTenDotMoi.Text, TuNgay = record.TuNgay, DenNgay = record.DenNgay, TrangThaiDanhGia = record.TrangThaiDanhGia, GhiChu = record.GhiChu, CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now, MaDonVi = record.MaDonVi, HinhThucDanhGia = record.HinhThucDanhGia, TL_TuDanhGia = record.TL_TuDanhGia, TL_QuanLyDanhGia = record.TL_QuanLyDanhGia, TL_NguoiKhacDanhGia = record.TL_NguoiKhacDanhGia, MaLoaiXepHang = record.MaLoaiXepHang, PrkeyCanBoQuanLy = record.PrkeyCanBoQuanLy }; new DotDanhGiaController().Insert(item); #region nhân đôi dữ liệu cán bộ bị đánh giá if (chkBiDanhGia.Checked || record.HinhThucDanhGia == 0 || record.HinhThucDanhGia == 1) { var table = new CanBoDuocDanhGiaController().GetByMaDotDanhGia(hdfRecordID.Text); foreach (DataRow it in table.Rows) { CanBoDuocDanhGiaInfo info = new CanBoDuocDanhGiaInfo() { MaCB = it["MaCB"].ToString(), MaDotDanhGia = txtmaloaihdcoppy.Text, CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now }; new CanBoDuocDanhGiaController().Insert(info); } } #endregion #region nhân đôi dữ liệu cán bộ tham gia đánh giá if (chkThamGiaDanhGia.Checked || record.HinhThucDanhGia == 0 || record.HinhThucDanhGia == 1) { var table = new CanBoThamGiaDanhGiaController().GetByMaDotDanhGia(hdfRecordID.Text); foreach (DataRow it in table.Rows) { CanBoThamGiaDanhGiaInfo info = new CanBoThamGiaDanhGiaInfo() { MaCBBiDanhGia = it["MaCBBiDanhGia"].ToString(), MaCBDanhGia = it["MaCBDanhGia"].ToString(), MaDotDanhGia = txtmaloaihdcoppy.Text, CreatedBy = CurrentUser.ID, CreatedDate = DateTime.Now }; new CanBoThamGiaDanhGiaController().Insert(info); } } #endregion #region nhân đôi dữ liệu tiêu chí đánh giá if (chkTieuChiDanhGia.Checked) { var table = new TieuChi_DotDanhGiaController().GetByMaDotDanhGia(hdfRecordID.Text); foreach (DataRow it in table.Rows) { TieuChi_DotDanhGiaInfo info = new TieuChi_DotDanhGiaInfo() { MaDotDanhGia = txtmaloaihdcoppy.Text, MaTieuChi = it["MaTieuChi"].ToString(), CreatedDate = DateTime.Now, CreatedBy = CurrentUser.ID }; new TieuChi_DotDanhGiaController().Insert(info); } } #endregion GridPanel1.Reload(); } wdInputNewPrimaryKey.Hide(); } 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(); } }