Exemplo n.º 1
0
    /// <summary>
    /// Mở cửa sổ cấu hình tỷ lệ điểm, xếp loại cho đợt đánh giá
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    //protected void btnConfig_Click(object sender, DirectEventArgs e)
    //{
    //    try
    //    {
    //        if (new FileInfo(Server.MapPath("../ConfigDotDanhGia.xml")).Exists)
    //        {
    //            XDocument xDoc = XDocument.Load(Server.MapPath("../ConfigDotDanhGia.xml"));
    //            var result = (from t in xDoc.Descendants("Estimate")
    //                          where t.Attribute("id").Value == hdfRecordID.Text
    //                          select t)
    //                          .Descendants("Result")
    //                          .Select(t => new { TuDanhGia = t.Descendants("TuDanhGia").FirstOrDefault().Value, QuanLyDanhGia = t.Descendants("QuanLyDanhGia").FirstOrDefault().Value, NguoiKhacDanhGia = t.Descendants("NguoiKhacDanhGia").FirstOrDefault().Value });
    //            if (result.Count() > 0)
    //            {
    //                foreach (var item in result)
    //                {
    //                    txtTuDanhGia.Text = item.TuDanhGia;
    //                    txtQuanLyDanhGia.Text = item.QuanLyDanhGia;
    //                    txtNguoiKhacDanhGia.Text = item.NguoiKhacDanhGia;
    //                }
    //            }
    //            else
    //            {
    //                // Tạo mới
    //                XElement estimate = new XElement("Estimate",
    //                    new XElement("Result",
    //                        new XElement("TuDanhGia", 20),
    //                        new XElement("QuanLyDanhGia", 50),
    //                        new XElement("NguoiKhacDanhGia", 30)),
    //                    new XElement("Rank"));
    //                estimate.SetAttributeValue("id", hdfRecordID.Text);
    //                xDoc.Root.Add(estimate);
    //                xDoc.Save(Server.MapPath("../ConfigDotDanhGia.xml"));

    //                txtTuDanhGia.Text = "20";
    //                txtQuanLyDanhGia.Text = "50";
    //                txtNguoiKhacDanhGia.Text = "30";
    //            }
    //            wdConfig.Show();
    //        }
    //    }
    //    catch (Exception ex)
    //    {
    //        X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString());
    //    }
    //}

    /// <summary>
    /// Lưu cấu hình cho đợt đánh giá khi sửa thông tin
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    //protected void btnLuuLai_Click(object sender, DirectEventArgs e)
    //{
    //    try
    //    {
    //        if (new FileInfo(Server.MapPath("../ConfigDotDanhGia.xml")).Exists)
    //        {
    //            XDocument xDoc = XDocument.Load(Server.MapPath("../ConfigDotDanhGia.xml"));
    //            var result = from t in xDoc.Descendants("Estimate")
    //                         where t.Attribute("id").Value == hdfRecordID.Text
    //                         select t;

    //            if (result.Count() > 0)
    //            {
    //                foreach (XElement item in result)
    //                {
    //                    item.Element("Result").Element("TuDanhGia").Value = txtTuDanhGia.Text;
    //                    item.Element("Result").Element("QuanLyDanhGia").Value = txtQuanLyDanhGia.Text;
    //                    item.Element("Result").Element("NguoiKhacDanhGia").Value = txtNguoiKhacDanhGia.Text;
    //                }
    //            }
    //            xDoc.Save(Server.MapPath("../ConfigDotDanhGia.xml"));
    //            wdConfig.Hide();
    //        }
    //    }
    //    catch (Exception ex)
    //    {
    //        X.Msg.Alert("Thông báo", "Có lỗi xảy ra: " + ex.Message.ToString());
    //    }
    //}

    private void InsertCanBo(DotDanhGia obj)
    {
        if (obj.HinhThucDanhGia == 0 || obj.HinhThucDanhGia == 1)   // Đánh giá cả đơn vị, trong phòng
        {
            // lấy danh sách các cán bộ của cả đơn vị
            List <string> macbs = new HoSoController().GetAllMaCB();
            // Thêm vào bảng CanBoDuocDanhGia, CanBoThamGiaDanhGia
            foreach (var item in macbs)
            {
                CanBoDuocDanhGiaInfo info = new CanBoDuocDanhGiaInfo()
                {
                    CreatedBy    = CurrentUser.ID,
                    CreatedDate  = DateTime.Now,
                    MaCB         = item,
                    MaDotDanhGia = obj.ID
                };
                new CanBoDuocDanhGiaController().Insert(info);

                CanBoThamGiaDanhGiaInfo info1 = new CanBoThamGiaDanhGiaInfo()
                {
                    CreatedBy     = CurrentUser.ID,
                    CreatedDate   = DateTime.Now,
                    MaCBBiDanhGia = "",
                    MaCBDanhGia   = item,
                    MaDotDanhGia  = obj.ID
                };
                new CanBoThamGiaDanhGiaController().Insert(info1);
            }
            //// Thêm vào kết quả đánh giá
            //foreach (var item in macbs)
            //{
            //    CreateKetQuaDanhGiaByMaCB(item);
            //}
        }
    }
Exemplo n.º 2
0
 public void Update(CanBoDuocDanhGiaInfo record)
 {
     DataController.DataHandler.GetInstance().ExecuteNonQuery("UpdateCanBoDuocDanhGia", "@ID", "@MaCB", "@MaDotDanhGia", "@CreatedDate", "@CreatedBy", record.ID, record.MaCB, record.MaDotDanhGia, record.CreatedDate, record.CreatedBy);
 }
Exemplo n.º 3
0
 public int Insert(CanBoDuocDanhGiaInfo record)
 {
     return(int.Parse(DataController.DataHandler.GetInstance().ExecuteScalar("InsertCanBoDuocDanhGia", "@MaCB", "@MaDotDanhGia", "@CreatedDate", "@CreatedBy", record.MaCB, record.MaDotDanhGia, record.CreatedDate, record.CreatedBy).ToString()));
 }
Exemplo n.º 4
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());
        }
    }
Exemplo n.º 5
0
    /// <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();
        }
    }