Esempio n. 1
0
 public abstract void UpdateBoPhan(BoPhanInfo _BoPhanInfo);
Esempio n. 2
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            DataTable dtUsers;

            if (CurrentUser.IsAdmin || CurrentUser.IsSuperAdmin)
            {
                dtUsers = CommonController.BaoCaoXepLoaiDanhGiaCaNhanThang(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(dropTrungTam.SelectedValue), ConvertUtility.ToInt32(dropPhongBan.SelectedValue), ConvertUtility.ToInt32(dropChucVu.SelectedValue), ConvertUtility.ToInt32(dropTrangThai.SelectedValue));
            }
            else
            {
                dtUsers = CommonController.BaoCaoXepLoaiDanhGiaCaNhanThang(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(dropTrungTam.SelectedValue), ConvertUtility.ToInt32(dropPhongBan.SelectedValue), ConvertUtility.ToInt32(dropChucVu.SelectedValue), ConvertUtility.ToInt32(dropTrangThai.SelectedValue), CurrentUser.UserID);
            }

            DataTable dtUsersTemp = new DataTable();

            dtUsersTemp.Columns.Add("UserID", typeof(string));
            dtUsersTemp.Columns.Add("Bộ phận", typeof(string));
            dtUsersTemp.Columns.Add("Họ tên", typeof(string));
            dtUsersTemp.Columns.Add("Điểm đánh giá công việc", typeof(string));
            dtUsersTemp.Columns.Add("Điểm kỷ luật và văn hóa doanh nghiệp", typeof(string));
            dtUsersTemp.Columns.Add("Điểm đồng nghiệp đánh giá", typeof(string));
            dtUsersTemp.Columns.Add("Tổng điểm", typeof(string));
            dtUsersTemp.Columns.Add("Xếp loại", typeof(string));

            BoPhanInfo _BoPhanInfo  = BoPhanController.GetInfo(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
            int        loaiTrungTam = _BoPhanInfo.Loai;
            string     tenTrungTam  = ConvertUtility.ToString(dropTrungTam.SelectedItem.Text);

            foreach (DataRow item in dtUsers.Rows)
            {
                DataSet ds = DotDanhGiaController.DanhGiaCheckPoint_DGCBCNVDanhGia_TongDiemCongThucMoi(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(item["UserID"]));
                if (ds != null)
                {
                    DataRow row = dtUsersTemp.NewRow();

                    double TongDiemDGCV           = 0;
                    double TongDiemDGCV1          = 0;
                    double diemKyLuat             = 0;
                    double diemKyLuat1            = 0;
                    double DiemDongNghiepDanhGia  = 0;
                    double DiemDongNghiepDanhGia1 = 0;

                    double DiemCLCV = 100;
                    double DiemTDCV = 100;
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DiemCLCV = ConvertUtility.ToDouble(ds.Tables[0].Rows[0]["DiemCLCV"].ToString());
                        DiemTDCV = ConvertUtility.ToDouble(ds.Tables[0].Rows[0]["DiemTDCV"].ToString());
                    }
                    double DiemDGCV = 0;

                    DataTable dtDotDanhGiaByCheckpoint = DotDanhGiaController.CheckPoint_GetAllDotDanhGiaByCheckpoint(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                    int count = 0;

                    foreach (DataRow itemDotDanhGia in dtDotDanhGiaByCheckpoint.Rows)
                    {
                        DataTable dtDiemTB = DotDanhGiaController.CheckPoint_DanhGiaCongViec_GetDiemTB(ConvertUtility.ToInt32(itemDotDanhGia["IDDotDanhGia"]), ConvertUtility.ToInt32(item["UserID"]));

                        if (dtDiemTB != null && dtDiemTB.Rows.Count > 0)
                        {
                            DiemDGCV += ConvertUtility.ToDouble(dtDiemTB.Rows[0]["DiemTB"]);
                            count++;
                        }
                    }

                    DiemDGCV = DiemDGCV / count;
                    if (count == 0)
                    {
                        count = 1;
                    }

                    TongDiemDGCV  = (DiemDGCV * 50 / 100) + (DiemCLCV * 10 / 100) + (DiemTDCV * 10 / 100);
                    TongDiemDGCV  = Math.Round(TongDiemDGCV, 2, MidpointRounding.AwayFromZero);
                    TongDiemDGCV1 = (((DiemDGCV * 5) + (DiemCLCV) + (DiemTDCV))) / 7;

                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        diemKyLuat  = ConvertUtility.ToDouble(ds.Tables[1].Rows[0]["DiemKyLuat"].ToString());
                        diemKyLuat1 = diemKyLuat;
                        diemKyLuat  = diemKyLuat * 20 / 100;

                        diemKyLuat = Math.Round(diemKyLuat, 2, MidpointRounding.AwayFromZero);
                    }
                    if (ds.Tables[2].Rows.Count > 0)
                    {
                        DiemDongNghiepDanhGia = ConvertUtility.ToDouble(ds.Tables[2].Rows[0]["DiemDongNghiepDanhGia"]);

                        if (DiemDongNghiepDanhGia == 0)
                        {
                            DiemDongNghiepDanhGia  = 10;
                            DiemDongNghiepDanhGia1 = 100;
                        }
                        else
                        {
                            DiemDongNghiepDanhGia1 = DiemDongNghiepDanhGia;
                            DiemDongNghiepDanhGia  = DiemDongNghiepDanhGia * 10 / 100;
                        }
                        DiemDongNghiepDanhGia = Math.Round(DiemDongNghiepDanhGia, 2);
                    }

                    string ten = "";
                    if (ds.Tables[3].Rows.Count > 0)
                    {
                        ten = ds.Tables[3].Rows[0]["HoTen"].ToString();
                    }

                    double TongDiem = Math.Round(TongDiemDGCV, 2, MidpointRounding.AwayFromZero);
                    TongDiem += Math.Round(diemKyLuat, 2, MidpointRounding.AwayFromZero);
                    TongDiem += Math.Round(DiemDongNghiepDanhGia, 2, MidpointRounding.AwayFromZero);
                    TongDiem  = Math.Round(TongDiem, 2);

                    string xepLoai = GetXepLoai(TongDiem);

                    row["UserID"]  = item["UserID"];
                    row["Bộ phận"] = tenTrungTam;
                    row["Họ tên"]  = ten;
                    row["Điểm đánh giá công việc"] = Math.Round(TongDiemDGCV1, 2, MidpointRounding.AwayFromZero);
                    row["Điểm kỷ luật và văn hóa doanh nghiệp"] = Math.Round(diemKyLuat1, 2, MidpointRounding.AwayFromZero);
                    row["Điểm đồng nghiệp đánh giá"]            = Math.Round(DiemDongNghiepDanhGia1, 2, MidpointRounding.AwayFromZero);
                    row["Tổng điểm"] = Math.Round(TongDiem, 2, MidpointRounding.AwayFromZero);
                    row["Xếp loại"]  = xepLoai;

                    dtUsersTemp.Rows.Add(row);
                }
            }

            //-------sort----------
            DataView dv = new DataView(dtUsersTemp);

            if (ViewState["sortExpression"] != null && ViewState["sortExpression"].ToString() != string.Empty)
            {
                dv.Sort = ViewState["sortExpression"].ToString();
            }


            if (ViewState["sortDirection"] != null && ViewState["sortDirection"].ToString() == "Desc")
            {
                dv.Sort = ViewState["sortExpression"].ToString() + " " + ViewState["sortDirection"].ToString();
            }
            //--------sort-------------

            dtgUsers.DataSource    = dv;
            dtgUsers.RowDataBound += new GridViewRowEventHandler(dtgUsers_RowDataBound);
            dtgUsers.DataBind();

            if (dtUsers != null)
            {
                lblTotalTop.Text = lblTotalBottom.Text = dtUsers.Rows.Count.ToString();
            }
        }
Esempio n. 3
0
 public abstract int InsertBoPhan(BoPhanInfo _BoPhanInfo);
Esempio n. 4
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            DataTable dtUsersTemp = new DataTable();

            dtUsersTemp.Columns.Add("Bộ phận", typeof(string));
            dtUsersTemp.Columns.Add("Họ tên", typeof(string));
            dtUsersTemp.Columns.Add("Điểm đánh giá công việc", typeof(string));
            dtUsersTemp.Columns.Add("Điểm kỷ luật và văn hóa doanh nghiệp", typeof(string));
            dtUsersTemp.Columns.Add("Điểm đồng nghiệp đánh giá", typeof(string));
            dtUsersTemp.Columns.Add("Tổng điểm", typeof(string));
            //dtUsersTemp.Columns.Add("Xếp loại", typeof(string));

            BoPhanInfo _BoPhanInfo  = BoPhanController.GetInfo(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
            int        loaiTrungTam = _BoPhanInfo.Loai;
            string     tenTrungTam  = ConvertUtility.ToString(dropTrungTam.SelectedItem.Text);

            DataTable dtUsers = DotDanhGiaController.GetAllNhanVienInDotDanhGiaExport(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(dropTrungTam.SelectedValue));

            #region ket qua danh gia checkpoint

            foreach (DataRow item in dtUsers.Rows)
            {
                DataSet ds = DotDanhGiaController.DanhGiaCheckPoint_DGCBCNVDanhGia_TongDiemCongThucMoi(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(item["UserID"]));
                if (ds != null)
                {
                    DataRow row = dtUsersTemp.NewRow();

                    double TongDiemDGCV           = 0;
                    double TongDiemDGCV1          = 0;
                    double diemKyLuat             = 0;
                    double diemKyLuat1            = 0;
                    double DiemDongNghiepDanhGia  = 0;
                    double DiemDongNghiepDanhGia1 = 0;

                    double DiemCLCV = 100;
                    double DiemTDCV = 100;
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        DiemCLCV = ConvertUtility.ToDouble(ds.Tables[0].Rows[0]["DiemCLCV"].ToString());
                        DiemTDCV = ConvertUtility.ToDouble(ds.Tables[0].Rows[0]["DiemTDCV"].ToString());
                    }
                    double DiemDGCV = 0;

                    DataTable dtDotDanhGiaByCheckpoint = DotDanhGiaController.CheckPoint_GetAllDotDanhGiaByCheckpoint(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                    int count = 0;

                    foreach (DataRow itemDotDanhGia in dtDotDanhGiaByCheckpoint.Rows)
                    {
                        DataTable dtDiemTB = DotDanhGiaController.CheckPoint_DanhGiaCongViec_GetDiemTB(ConvertUtility.ToInt32(itemDotDanhGia["IDDotDanhGia"]), ConvertUtility.ToInt32(item["UserID"]));

                        if (dtDiemTB != null && dtDiemTB.Rows.Count > 0)
                        {
                            DiemDGCV += ConvertUtility.ToDouble(dtDiemTB.Rows[0]["DiemTB"]);
                            count++;
                        }
                    }

                    DiemDGCV = DiemDGCV / count;
                    if (count == 0)
                    {
                        count = 1;
                    }

                    TongDiemDGCV  = (DiemDGCV * 50 / 100) + (DiemCLCV * 10 / 100) + (DiemTDCV * 10 / 100);
                    TongDiemDGCV1 = (((DiemDGCV * 5) + (DiemCLCV) + (DiemTDCV))) / 7;
                    TongDiemDGCV  = Math.Round(TongDiemDGCV, 2, MidpointRounding.AwayFromZero);

                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        diemKyLuat  = ConvertUtility.ToDouble(ds.Tables[1].Rows[0]["DiemKyLuat"].ToString());
                        diemKyLuat1 = diemKyLuat;
                        diemKyLuat  = diemKyLuat * 20 / 100;

                        diemKyLuat = Math.Round(diemKyLuat, 2, MidpointRounding.AwayFromZero);
                    }
                    if (ds.Tables[2].Rows.Count > 0)
                    {
                        DiemDongNghiepDanhGia = ConvertUtility.ToDouble(ds.Tables[2].Rows[0]["DiemDongNghiepDanhGia"]);

                        if (DiemDongNghiepDanhGia == 0)
                        {
                            DiemDongNghiepDanhGia  = 10;
                            DiemDongNghiepDanhGia1 = 100;
                        }
                        else
                        {
                            DiemDongNghiepDanhGia1 = DiemDongNghiepDanhGia;
                            DiemDongNghiepDanhGia  = DiemDongNghiepDanhGia * 10 / 100;
                        }
                        DiemDongNghiepDanhGia = Math.Round(DiemDongNghiepDanhGia, 2);
                    }

                    string ten = "";
                    if (ds.Tables[3].Rows.Count > 0)
                    {
                        ten = ds.Tables[3].Rows[0]["HoTen"].ToString();
                    }

                    double TongDiem = Math.Round(TongDiemDGCV, 2, MidpointRounding.AwayFromZero);
                    TongDiem += Math.Round(diemKyLuat, 2, MidpointRounding.AwayFromZero);
                    TongDiem += Math.Round(DiemDongNghiepDanhGia, 2, MidpointRounding.AwayFromZero);
                    TongDiem  = Math.Round(TongDiem, 2);

                    string xepLoai = GetXepLoai(TongDiem);

                    row["Bộ phận"] = tenTrungTam;
                    row["Họ tên"]  = ten;
                    row["Điểm đánh giá công việc"] = (Math.Round(TongDiemDGCV1, 2, MidpointRounding.AwayFromZero) / 100).ToString();
                    row["Điểm kỷ luật và văn hóa doanh nghiệp"] = (Math.Round(diemKyLuat1, 2, MidpointRounding.AwayFromZero) / 100).ToString();
                    row["Điểm đồng nghiệp đánh giá"]            = (Math.Round(DiemDongNghiepDanhGia1, 2, MidpointRounding.AwayFromZero) / 100).ToString();
                    row["Tổng điểm"] = Math.Round(TongDiem, 2, MidpointRounding.AwayFromZero) / 100;
                    //row["Xếp loại"] = xepLoai;

                    dtUsersTemp.Rows.Add(row);
                }
            }

            #endregion

            ImportExcelToDataTable.ExportToExcel(dtUsersTemp, "KQDanhGiaCaNhanCheckPoint_" + dropTrungTam.SelectedItem.Text + ".csv");
        }