コード例 #1
0
    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();
        }
    }
コード例 #2
0
    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());
        }
    }