Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = BoPhanController.BoPhan_GetAllActive();

                dropTrungTam.DataSource = dt;
                dropTrungTam.DataBind();

                dropTrungTamSearch.DataSource = dt;
                dropTrungTamSearch.DataBind();

                int id = ConvertUtility.ToInt32(Request.QueryString["idTrungTam"]);
                if (id > 0)
                {
                    dropTruongPhongBan.Items.Clear();
                    dropTruongPhongBan.DataSource = DotDanhGiaController.GetAllNhanVienCapTBP_TP_PP(id);
                    dropTruongPhongBan.DataBind();

                    dropTrungTam.SelectedValue = dropTrungTamSearch.SelectedValue = id.ToString();
                }
                else
                {
                    dropTruongPhongBan.Items.Clear();
                    dropTruongPhongBan.DataSource = DotDanhGiaController.GetAllNhanVienCapTBP_TP_PP(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                    dropTruongPhongBan.DataBind();
                }
            }
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                dropTrungTam.DataSource = BoPhanController.GetAll();
                dropTrungTam.DataBind();
                dropTrungTam.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));

                dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
                dropDotDanhGia.DataBind();

                if (ConvertUtility.ToInt32(dropTrungTam.SelectedValue) > 0)
                {
                    dropPhong.DataSource = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                    dropPhong.DataBind();
                    dropPhong.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));
                }
                else
                {
                    dropPhong.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));
                }

                //int userId = ConvertUtility.ToInt32(Request.QueryString["uid"]);

                //if (userId > 0)
                //{
                //    DataTable dt = DotDanhGiaController.GetTrangThaiNhanVien(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), userId, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), ConvertUtility.ToInt32(dropPhong.SelectedValue));
                //    if (dt != null && dt.Rows.Count > 0)
                //    {
                //        dropTrangThai.SelectedValue = ConvertUtility.ToInt32(dt.Rows[0]["TrangThaiNhanVien"]).ToString();
                //    }
                //}
            }
        }
Ejemplo n.º 3
0
        public void init()
        {
            List <TblBoPhan> bophan = new BoPhanController().getAllBoPhan();

            comboBox1.DataSource = bophan;
            if (data != null)
            {
                TblPhongBan temp = new PhongBanController().getOnePhongBan(data.MaPhong);
                mode         = EDIT;
                maBPTB.Text  = temp.MaPhong;
                tenBPTB.Text = temp.TenPhong;
                ghiChu.Text  = temp.GhiChu;
                if (data.NgayTLap != null)
                {
                    dateTimePicker1.Value = (DateTime)temp.NgayTLap;
                }
                comboBox1.SelectedValue = temp.MaBoPhan;
            }
            else
            {
                mode = ADD;
                DateTime date = DateTime.Now;
                dateTimePicker1.Value = date;
                btnSave.Enabled       = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["id"]);
            if (!Page.IsPostBack)
            {
                dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(3);
                dropDotDanhGia.DataBind();
                int idDotDanhActive = ConvertUtility.ToInt32(DotDanhGiaController.GetDaultDotDanhGia().Rows[0]["ID"]);
                dropDotDanhGia.SelectedValue = idDotDanhActive.ToString();

                dropTrungTam.DataSource = BoPhanController.BoPhan_GetAllActive();
                dropTrungTam.DataBind();
                dropTrungTam.Items.Insert(0, new ListItem("Tất cả", "0"));


                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    dropTrungTam.Enabled = false;
                }
                dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();

                dropNhanVien.Items.Clear();
                dropNhanVien.DataSource = DotDanhGiaController.GetAllNhanVienCapTBP_TP_PP(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                dropNhanVien.DataBind();
            }
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["DropDownPageItems"] = 10;

                dropTrungTam.DataSource = BoPhanController.BoPhan_GetAllActive();
                dropTrungTam.DataBind();

                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    dropTrungTam.Enabled = false;
                }
                dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();
                dropYear.SelectedValue     = DateTime.Now.Year.ToString();
                dropMonth.SelectedValue    = DateTime.Now.Month.ToString();
                BindDay();
                dropDay.SelectedValue = DateTime.Now.Day.ToString();

                dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
                dropDotDanhGia.DataBind();

                BindUser();
            }
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["DropDownPageItems"] = 10;

                //dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
                //dropDotDanhGia.DataBind();

                dropTrungTam.DataSource = BoPhanController.GetAll();
                dropTrungTam.DataBind();
                dropTrungTam.Items.Insert(0, new ListItem("----All----", "0"));

                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    btnDeleteSelected.Visible = false;
                    //btnUpdatePhongBan.Visible = false;
                    dtgUsers.Columns[3].Visible = false;
                    dtgUsers.Columns[8].Visible = false;
                    dtgUsers.Columns[9].Visible = false;
                    dropTrungTam.Enabled        = false;
                }
                dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["id"]);
            if (!Page.IsPostBack)
            {
                DotDanhGiaInfo info = DotDanhGiaController.GetInfo(idDotDanhGia);
                if (info == null)
                {
                    this.btnAdd.Visible    = false;
                    this.btnRemove.Visible = false;
                    return;
                }
                lblDotDanhGiaName.Text = info.Ten;

                dropTrungTam.DataSource = BoPhanController.BoPhan_GetAllActive();
                dropTrungTam.DataBind();
                dropTrungTam.Items.Insert(0, new ListItem("Tất cả", "0"));

                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    dropTrungTam.Enabled       = false;
                    dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();
                }

                dropPortal.Items.Clear();
                PortalController.LoadPortals(dropPortal.Items);
            }
        }
Ejemplo n.º 8
0
        protected void btnThemMoi1_Click(object sender, EventArgs e)
        {
            //lay dot danh gia truoc ra lam chuan
            int idDotDanhCopy = ConvertUtility.ToInt32(DotDanhGiaController.GetDaultDotDanhGia().Rows[0]["ID"]);

            #region Tao dot danh gia moi

            DotDanhGiaInfo infoDotDanhGia = new DotDanhGiaInfo();

            infoDotDanhGia.Ten             = txtTen.Text.Trim();
            infoDotDanhGia.ThoiGianBatDau  = ConvertUtility.ToDateTime(txtThoiGianBatDau.Text);
            infoDotDanhGia.ThoiGianKetThuc = ConvertUtility.ToDateTime(txtThoiGianKetThuc.Text);
            infoDotDanhGia.TrangThai       = ConvertUtility.ToInt32(dropTypeOf.SelectedValue);
            infoDotDanhGia.DangChay        = ConvertUtility.ToInt32(dropStatus.SelectedValue);
            infoDotDanhGia.IsDefault       = ConvertUtility.ToInt32(dropChuan.SelectedValue);

            infoDotDanhGia.Nam   = infoDotDanhGia.ThoiGianKetThuc.Year;
            infoDotDanhGia.Thang = infoDotDanhGia.ThoiGianKetThuc.Month;

            int idDotDanhGia = DotDanhGiaController.Insert(infoDotDanhGia);

            #endregion

            DataTable dtTrungTam = BoPhanController.BoPhan_GetAllActive();

            foreach (DataRow itemTrungTam in dtTrungTam.Rows)
            {
                DataTable source = QuanLyCongViecKTXVaPSController.GetAllNhanVienTheoQLVaDotDanhGia(ConvertUtility.ToInt32(itemTrungTam["ID"]), idDotDanhCopy);

                UpdateNhanVienTheoNDG(source, idDotDanhGia, ConvertUtility.ToInt32(itemTrungTam["ID"]));

                UpdateNhanVienVaoDotDanhGia(source, idDotDanhGia, ConvertUtility.ToInt32(itemTrungTam["ID"]));
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["idDotDanhGia"]);
            idNhanVien   = ConvertUtility.ToInt32(Request.QueryString["idNhanVien"]);

            if (!IsPostBack)
            {
                dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
                dropDotDanhGia.DataBind();

                if (idDotDanhGia > 0)
                {
                    dropDotDanhGia.SelectedValue = idDotDanhGia.ToString();
                }
                dtBoPhanHoTro = BoPhanController.BoPhan_GetAllActive();
                dropBoPhanHoTro.Items.Clear();
                dropBoPhanHoTro.DataSource = dtBoPhanHoTro;
                dropBoPhanHoTro.DataBind();
            }

            if (idDotDanhGia == 0)
            {
                Response.Redirect(AppEnv.AdminUrlParams("kehoachnhanvien") + "&idDotDanhGia=" + dropDotDanhGia.SelectedValue + "&idNhanVien=" + CurrentUser.UserID);
            }

            if (CurrentUser.RoleID == (int)Constants.Role.NhanVien || CurrentUser.RoleID == (int)Constants.Role.NhanVienKD)
            {
                btnYeuCauLamLaiKeHoach.Visible = false;
            }
            else
            {
                btnYeuCauLamLaiKeHoach.Visible = true;
            }

            #region Check authenticate

            userInfo = UserController.GetUser(idNhanVien);
            if (userInfo == null)
            {
                Response.Redirect(AppEnv.AdminUrlParams("accessdeny"));
            }

            if (CurrentUser.RoleID == (int)Constants.Role.NhanVien || CurrentUser.RoleID == (int)Constants.Role.NhanVienKD)
            {
                if (CurrentUser.UserID != idNhanVien)
                {
                    Response.Redirect(AppEnv.AdminUrlParams("accessdeny"));
                }
            }

            #endregion

            btnSumit.OnClientClick = "return confirm('Bạn có chắc chắn gửi kế hoạch hay không ?')";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                dropBoPhan.DataSource = BoPhanController.BoPhan_GetAllActive();
                dropBoPhan.DataBind();

                dropNam.SelectedValue   = DateTime.Now.Year.ToString();
                dropThang.SelectedValue = DateTime.Now.Month.ToString();
            }
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt = BoPhanController.BoPhan_GetAllActive();

                dropTrungTam.DataSource = dt;
                dropTrungTam.DataBind();

                dropTrungTamSearch.DataSource = dt;
                dropTrungTamSearch.DataBind();
            }
        }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["idDotDanhGia"]);

            if (idDotDanhGia == 0)
            {
                idDotDanhGia = CurrentUser.IDDotDanhGiaVaNhanVien;
            }

            if (!IsPostBack)
            {
                dtBoPhanHoTro = BoPhanController.BoPhan_GetAllActive();
            }
        }
Ejemplo n.º 13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            Result <TblBoPhan> result = new BoPhanController().deleteBoPhan(bophan.MaBophan);

            if (result.Success)
            {
                this.Hide();
                dsbp.getData();
                MessageBox.Show(result.Message.ToString());
            }
            else
            {
                MessageBox.Show(result.Message.ToString());
            }
        }
Ejemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["DropDownPageItems"] = 10;

                dropTrungTam.DataSource = BoPhanController.BoPhan_GetAllActive();
                dropTrungTam.DataBind();

                int idDotDanhActive = ConvertUtility.ToInt32(DotDanhGiaController.GetDaultDotDanhGia().Rows[0]["ID"]);
                dropDotDanhGia.SelectedValue = idDotDanhActive.ToString();

                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    dropTrungTam.Enabled = false;
                }

                dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();

                DataTable dtPhong;
                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    btnMailTBP.Visible   = false;
                    dropTrungTam.Enabled = false;

                    if (CurrentUser.RoleID != (int)Constants.Role.TruongBoPhanKhoiHoTro && CurrentUser.RoleID != (int)Constants.Role.TruongBoPhanKhoiKinhDoanh)
                    {
                        dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), CurrentUser.UserID);
                    }
                    else
                    {
                        dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                    }
                }
                else
                {
                    btnMailTBP.Visible = true;
                    dtPhong            = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                }

                dropPhongBan.DataSource = dtPhong;
                dropPhongBan.DataBind();
                dropPhongBan.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));

                dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
                dropDotDanhGia.DataBind();
            }
        }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                dropTrungTam.DataSource = BoPhanController.GetAll();
                dropTrungTam.DataBind();

                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    dropTrungTam.Enabled       = false;
                    dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();
                }

                dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
                dropDotDanhGia.DataBind();

                DataTable dtPhong;
                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    dropTrungTam.Enabled = false;

                    if (CurrentUser.RoleID != (int)Constants.Role.TruongBoPhanKhoiHoTro && CurrentUser.RoleID != (int)Constants.Role.TruongBoPhanKhoiKinhDoanh)
                    {
                        dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), CurrentUser.UserID);
                    }
                    else
                    {
                        dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                    }
                }
                else
                {
                    dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                }

                dropPhongBan.DataSource = dtPhong;
                dropPhongBan.DataBind();
                dropPhongBan.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));
                try
                {
                    dropPhongBan.SelectedValue = CurrentUser.IDPhong.ToString();
                }
                catch (Exception)
                {
                    dropPhongBan.SelectedIndex = -1;
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["DropDownPageItems"] = 10;

                dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
                dropDotDanhGia.DataBind();

                dropTrungTam.DataSource = BoPhanController.GetAll();
                dropTrungTam.DataBind();
                dropTrungTam.Items.Insert(0, new ListItem("----All----", "0"));

                dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            btnUpdateDiem2.OnClientClick = MiscUtility.MSG_UPDATE_CONFIRM;
            idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["idDotDanhGia"]);
            idNhanVien = ConvertUtility.ToInt32(Request.QueryString["idNhanVien"]);

            if (idDotDanhGia == 0)
            {
                idDotDanhGia = CurrentUser.IDDotDanhGiaVaNhanVien;
                idNhanVien = CurrentUser.UserID;
            }

            if (!IsPostBack)
            {
                dtBoPhanHoTro = BoPhanController.BoPhan_GetAllActive();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            btnUpdateDiem3.OnClientClick = MiscUtility.MSG_UPDATE_CONFIRM;
            idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["idDotDanhGia"]);
            idNhanVien   = ConvertUtility.ToInt32(Request.QueryString["idNhanVien"]);

            if (idDotDanhGia == 0)
            {
                idDotDanhGia = CurrentUser.IDDotDanhGiaVaNhanVien;
                idNhanVien   = CurrentUser.UserID;
            }


            dtBoPhanHoTro = BoPhanController.BoPhan_GetAllActive();
            dropBoPhanHoTro.Items.Clear();
            dropBoPhanHoTro.DataSource = dtBoPhanHoTro;
            dropBoPhanHoTro.DataBind();
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                dropTrungTam.DataSource = BoPhanController.GetAll();
                dropTrungTam.DataBind();
                dropTrungTam.Items.Insert(0, new ListItem("Tất cả", "0"));

                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    dropTrungTam.Enabled       = false;
                    dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();
                }

                dropNhom.DataSource = NhomController.GetAll();
                dropNhom.DataBind();
                dropNhom.SelectedValue = "2";
                dropPortal.Items.Clear();
                PortalController.LoadPortals(dropPortal.Items);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["idDotDanhGia"]);
            idNhanVien   = ConvertUtility.ToInt32(Request.QueryString["idNhanVien"]);

            if (idDotDanhGia == 0)
            {
                idDotDanhGia = CurrentUser.IDDotDanhGiaVaNhanVien;
                idNhanVien   = CurrentUser.UserID;
            }

            if (!IsPostBack)
            {
                dtBoPhanHoTro = BoPhanController.BoPhan_GetAllActive();
            }

            if (CurrentUser.RoleID == (int)Constants.Role.CEO)
            {
                btnUpdateDiem2.Visible = false;
            }
        }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            roleId = ConvertUtility.ToInt32(Request.QueryString["roleid"]);
            if (!Page.IsPostBack)
            {
                RoleInfo role = RoleController.GetRole(roleId);
                if (role == null)
                {
                    this.btnAdd.Visible    = false;
                    this.btnRemove.Visible = false;
                    return;
                }
                lblRoleName.Text = role.RoleName;

                dropTrungTam.DataSource = BoPhanController.GetAll();
                dropTrungTam.DataBind();
                dropTrungTam.Items.Insert(0, new ListItem("Tất cả", "0"));

                dropPortal.Items.Clear();
                PortalController.LoadPortals(dropPortal.Items);
            }
        }
Ejemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["idDotDanhGia"]);
            idNhanVien   = ConvertUtility.ToInt32(Request.QueryString["idNhanVien"]);

            if (idDotDanhGia == 0)
            {
                idDotDanhGia = CurrentUser.IDDotDanhGiaVaNhanVien;
                idNhanVien   = CurrentUser.UserID;
            }

            dtBoPhanHoTro = BoPhanController.BoPhan_GetAllActive();
            dropBoPhanHoTro.Items.Clear();
            dropBoPhanHoTro.DataSource = dtBoPhanHoTro;
            dropBoPhanHoTro.DataBind();

            if (CurrentUser.RoleID == (int)Constants.Role.CEO)
            {
                btnThemMoi3.Visible    = false;
                btnUpdateDiem3.Visible = false;
            }
        }
Ejemplo n.º 23
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            TblBoPhan data = new TblBoPhan();

            data.MaBophan  = maBPTB.Text.ToString().Trim();
            data.TenBoPhan = tenBPTB.Text.ToString().Trim();
            data.GhiChu    = ghiChu.Text.ToString().Trim();
            if (mode == ADD)
            {
                Result <TblBoPhan> result = new BoPhanController().addBoPhan(data);
                if (result.Success)
                {
                    this.Hide();
                    dsbp.getData();
                    MessageBox.Show(result.Message.ToString());
                }
                else
                {
                    MessageBox.Show(result.Message.ToString());
                }
            }
            else if (mode == EDIT)
            {
                Result <TblBoPhan> result = new BoPhanController().updateBoPhan(data);
                if (result.Success)
                {
                    this.Hide();
                    dsbp.getData();
                    MessageBox.Show(result.Message.ToString());
                }
                else
                {
                    MessageBox.Show(result.Message.ToString());
                }
            }
        }
Ejemplo n.º 24
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");
        }
Ejemplo n.º 25
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();
            }
        }
Ejemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (!CurrentUser.IsSuperAdmin)
                {
                    pnlSuperadmin.Visible = false;
                    pnlAdmin.Visible      = false;
                }
                else
                {
                    pnlSuperadmin.Visible = true;
                    pnlAdmin.Visible      = true;
                }

                dropTrungTam.DataSource = BoPhanController.GetAll();
                dropTrungTam.DataBind();
                dropTrungTam.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));

                dropChucVu.DataSource = CommonController.GetAllChucVu();
                dropChucVu.DataBind();
                dropChucVu.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));

                int userId = ConvertUtility.ToInt32(Request.QueryString["uid"]);

                if (userId > 0)
                {
                    if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                    {
                        btnUpdate.Visible = false;
                    }

                    divMK.Visible = divXNMK.Visible = false;
                    UserInfo info = UserController.GetUser(userId);

                    txtUsername.Text    = info.Username;
                    txtDisplayName.Text = info.DisplayName;

                    txtMaSo.Text               = info.MaSo;
                    txtFullName.Text           = info.HoTen;
                    txtNgaySinh.Text           = info.NgaySinh.ToString("dd/MM/yyyy");
                    dropGioiTinh.Text          = info.GioiTinh.ToString();
                    dropChucVu.Text            = info.IDChucVu.ToString();
                    dropTrungTam.SelectedValue = info.IDTrungTam.ToString();

                    if (ConvertUtility.ToInt32(dropTrungTam.SelectedValue) > 0)
                    {
                        dropPhong.DataSource = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                        dropPhong.DataBind();
                        dropPhong.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));
                        dropPhong.SelectedValue = info.IDPhong.ToString();
                    }
                    else
                    {
                        dropPhong.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));
                    }

                    txtNoiSinh.Text             = info.NoiSinh;
                    txtNguyenQuan.Text          = info.NguyenQuan;
                    txtQuocTich.Text            = info.QuocTich;
                    txtDanToc.Text              = info.DanToc;
                    txtTonGiao.Text             = info.TonGiao;
                    txtDiaChiThuongChu.Text     = info.DiaChiThuongChu;
                    txtDiaChiTamChu.Text        = info.DiaChiTamChu;
                    chkIsAdmin.Checked          = info.IsAdmin;
                    chkIsSuperAdmin.Checked     = info.IsSuperAdmin;
                    dropTrangThai.SelectedValue = info.TrangThai.ToString();
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                dropYearCopy.SelectedValue  = dropYear.SelectedValue = DateTime.Now.Year.ToString();
                dropMonthCopy.SelectedValue = dropMonth.SelectedValue = DateTime.Now.Month.ToString();
                BindDay();
                dropDay.SelectedValue = DateTime.Now.Day.ToString();
                BindDayCopy();
                dropDayCopy.SelectedValue = DateTime.Now.Day.ToString();

                dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
                dropDotDanhGia.DataBind();

                cmdDel.OnClientClick = MiscUtility.MSG_DELETE_CONFIRM;

                lblStatusUpdate.Text = string.Empty;

                dropTrungTam.DataSource = BoPhanController.GetAll();
                dropTrungTam.DataBind();
                dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();

                #region Get Phong Ban

                DataTable dtPhong;
                if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
                {
                    dropTrungTam.Enabled = false;
                    if (CurrentUser.RoleID == (int)Constants.Role.NhanVien)
                    {
                        #region Role Nhan Vien

                        dropPhongBan.Enabled = false;
                        dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                        dropPhongBan.Items.Clear();
                        dropPhongBan.DataSource = dtPhong;
                        dropPhongBan.DataBind();
                        dropPhongBan.Items.Insert(0, new ListItem("Tất cả", "0"));

                        try
                        {
                            dropPhongBan.SelectedValue = CurrentUser.IDPhong.ToString();
                        }
                        catch (Exception)
                        {
                            dropPhongBan.SelectedIndex = -1;
                        }

                        #endregion
                    }
                    else
                    {
                        if (CurrentUser.RoleID == (int)Constants.Role.COO || CurrentUser.RoleID == (int)Constants.Role.TruongBoPhanKhoiHoTro || CurrentUser.RoleID == (int)Constants.Role.TruongBoPhanKhoiKinhDoanh || CurrentUser.RoleID == (int)Constants.Role.PhoGiamDoc)
                        {
                            #region Role TBP, Pho Giam Doc, COO

                            dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                            dropPhongBan.Items.Clear();
                            dropPhongBan.DataSource = dtPhong;
                            dropPhongBan.DataBind();
                            dropPhongBan.Items.Insert(0, new ListItem("Tất cả", "0"));

                            #endregion
                        }
                        else
                        {
                            #region Role Pho Phong, Truong Phong, Truong Nhom

                            dropPhongBan.Enabled = false;
                            dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), CurrentUser.UserID);
                            dropPhongBan.Items.Clear();
                            dropPhongBan.DataSource = dtPhong;
                            dropPhongBan.DataBind();
                            dropPhongBan.Items.Insert(0, new ListItem("Tất cả", "0"));

                            #endregion
                        }
                    }
                }
                else
                {
                    #region Role Admin

                    dropTrungTam.Enabled = true;
                    dropPhongBan.Enabled = true;

                    dtPhong = DotDanhGiaController.GetAllPhongBan(ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
                    dropPhongBan.Items.Clear();
                    dropPhongBan.DataSource = dtPhong;
                    dropPhongBan.DataBind();
                    dropPhongBan.Items.Insert(0, new ListItem("Tất cả", "0"));

                    try
                    {
                        dropPhongBan.SelectedValue = CurrentUser.IDPhong.ToString();
                    }
                    catch (Exception)
                    {
                        dropPhongBan.SelectedIndex = -1;
                    }

                    #endregion
                }

                #endregion

                //dropPhong.Items.Clear();
                //dropPhong.DataSource = dtPhong;
                //dropPhong.DataBind();
                //dropPhong.Items.Insert(0, new ListItem("----------Lựa chọn----------", "0"));

                BuildCongViec();
            }
        }
Ejemplo n.º 28
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            dropDotDanhGia.DataSource = DotDanhGiaController.GetAll(1);
            dropDotDanhGia.DataBind();

            if (Session["IDDotDanhGia"] != null)
            {
                dropDotDanhGia.SelectedValue = Session["IDDotDanhGia"].ToString();
            }
            else
            {
                int idDotDanhActive = ConvertUtility.ToInt32(DotDanhGiaController.GetDaultDotDanhGia().Rows[0]["ID"]);
                dropDotDanhGia.SelectedValue = idDotDanhActive.ToString();
            }

            dropTrungTam.DataSource = BoPhanController.GetAll();
            dropTrungTam.DataBind();


            if (Session["IDTrungTam"] != null)
            {
                dropTrungTam.SelectedValue = Session["IDTrungTam"].ToString();
            }
            else
            {
                dropTrungTam.SelectedValue = CurrentUser.IDTrungTam.ToString();
            }

            lstNhanVien.Items.Clear();
            DataTable dtNhanVien = null;

            if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
            {
                dtNhanVien = DotDanhGiaController.QuanLyNhanVienTheoNDG_ByNhanVienQuanLy(CurrentUser.UserID, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(dropTrungTam.SelectedValue));
            }
            else
            {
                dtNhanVien = DotDanhGiaController.GetAllNhanVien(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 0, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));
            }

            if (dtNhanVien != null && dtNhanVien.Rows.Count > 0)
            {
                DataTable dtNew = dtNhanVien.Clone();

                foreach (DataRow item in dtNhanVien.Rows)
                {
                    DataRow rowNew = dtNew.NewRow();
                    rowNew["UserID"] = item["UserID"];

                    DataTable dtCongViec = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienKTXVaPS_6_11_2014(ConvertUtility.ToInt32(item["UserID"]), 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                    double tyTrongCVDuocGiao = 0;
                    foreach (DataRow row in dtCongViec.Rows)
                    {
                        tyTrongCVDuocGiao += Math.Round(ConvertUtility.ToDouble(row["TyTrong"]), 3);
                    }

                    rowNew["UserName"] = "******" + tyTrongCVDuocGiao + "%) " + item["UserName"].ToString();

                    dtNew.Rows.Add(rowNew);
                }

                lstNhanVien.DataSource = dtNew;
                lstNhanVien.DataBind();

                int idNhanVien = 0;

                if (Session["IDNhanVien"] != null)
                {
                    idNhanVien = ConvertUtility.ToInt32(Session["IDNhanVien"]);
                    try
                    {
                        lstNhanVien.SelectedValue = idNhanVien.ToString();
                    }
                    catch
                    {
                    }
                }

                lstCongViecDuocGiao.Items.Clear();
                QuanLyCongViecKTXVaPSController.LoadCongViec(lstCongViecDuocGiao.Items, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 0, 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                lstCongViec.Items.Clear();
                QuanLyCongViecKTXVaPSController.LoadCongViecChuaDuocGiao(lstCongViec.Items, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 0, 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                if (idNhanVien > 0)
                {
                    DataTable dtCongViecTX = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienKTXVaPS_6_11_2014(idNhanVien, 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                    DataTable dtCongViecTXNew = dtCongViecTX.Clone();

                    try
                    {
                        lstNhanVien.SelectedValue = idNhanVien.ToString();
                    }
                    catch (Exception)
                    {
                        lstNhanVien.SelectedIndex = -1;
                    }

                    #region Cong Viec Thuong Xuyen

                    foreach (ListItem item in lstCongViecDuocGiao.Items)
                    {
                        if (dtCongViecTX.Select("IDCongViecKPI = " + item.Value).Length > 0)
                        {
                            item.Attributes.Add("style", "color:blue");
                        }
                    }

                    foreach (DataRow item in dtCongViecTX.Rows)
                    {
                        DataRow row = dtCongViecTXNew.NewRow();

                        row["ID"]          = ConvertUtility.ToString(item["ID"]);
                        row["TenCVCha"]    = ConvertUtility.ToString(item["TenCVCha"]);
                        row["Ten"]         = item["Ten"];
                        row["NgayBatDau"]  = ConvertUtility.ToDateTime(item["NgayBatDau"]);  //.ToString("dd/MM/yyyy");
                        row["NgayKetThuc"] = ConvertUtility.ToDateTime(item["NgayKetThuc"]); //.ToString("dd/MM/yyyy");
                        row["KeHoach"]     = item["KeHoach"].ToString().Replace("\n", "<br /><br />").Replace("\r", "<br /><br />");
                        row["TyTrong"]     = Math.Round(ConvertUtility.ToDouble(item["TyTrong"]), 2).ToString();
                        row["SoGio"]       = Math.Round(ConvertUtility.ToDouble(item["SoGio"]), 2).ToString();
                        dtCongViecTXNew.Rows.Add(row);
                    }
                    dgrNhanVienCVTX.DataSource = dtCongViecTXNew;

                    #endregion

                    #region ty trong cong viec da giao

                    DataTable dtCongViecThuongXuyen = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienKTXVaPS(idNhanVien, 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                    double tyTrongCVThuongXuyen = 0;
                    double SoGioCVThuongXuyen   = 0;
                    foreach (DataRow item in dtCongViecThuongXuyen.Rows)
                    {
                        tyTrongCVThuongXuyen += ConvertUtility.ToDouble(item["TyTrong"]);
                        SoGioCVThuongXuyen   += ConvertUtility.ToDouble(item["SoGio"]);
                    }

                    DataTable dtCongViecKTH = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienKTXVaPS(idNhanVien, 2, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                    double tyTrongCVKeHoachThang = 0;
                    double SoGioCVKeHoachThang   = 0;
                    foreach (DataRow item in dtCongViecKTH.Rows)
                    {
                        tyTrongCVKeHoachThang += ConvertUtility.ToDouble(item["TyTrong"]);
                        SoGioCVKeHoachThang   += ConvertUtility.ToDouble(item["SoGio"]);
                    }

                    DataTable dtCongViecPhatSinh = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienKTXVaPS(idNhanVien, 3, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                    double tyTrongCVPhatSinh = 0;
                    double SoGioCVPhatSinh   = 0;
                    foreach (DataRow item in dtCongViecPhatSinh.Rows)
                    {
                        tyTrongCVPhatSinh += ConvertUtility.ToDouble(item["TyTrong"]);
                        SoGioCVPhatSinh   += ConvertUtility.ToDouble(item["SoGio"]);
                    }

                    lblTyTrongCVThuongXuyen.Text  = Math.Round(tyTrongCVThuongXuyen, 2).ToString() + "% <br/>" + Math.Round(SoGioCVThuongXuyen, 2).ToString() + "h";
                    lblTyTrongCVKeHoachThang.Text = Math.Round(tyTrongCVKeHoachThang, 2).ToString() + "% <br/>" + Math.Round(SoGioCVKeHoachThang, 2).ToString() + "h";
                    lblTyTrongCVPhatSinh.Text     = Math.Round(tyTrongCVPhatSinh, 2).ToString() + "% <br/>" + Math.Round(SoGioCVPhatSinh, 2).ToString() + "h";
                    lblTongTyTrong.Text           = Math.Round((tyTrongCVThuongXuyen + tyTrongCVKeHoachThang + tyTrongCVPhatSinh), 2) + "% <br />" + Math.Round((SoGioCVThuongXuyen + SoGioCVKeHoachThang + SoGioCVPhatSinh), 2) + "h";

                    #endregion
                }
            }
            dgrNhanVienCVTX.DataBind();
        }
Ejemplo n.º 29
0
        public void getData()
        {
            List <TblBoPhan> data = new BoPhanController().getAllBoPhan();

            dataGridView1.DataSource = data;
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            XmlDocument xmlDoc = new XmlDocument();

            // Write down the XML declaration
            XmlDeclaration xmlDeclaration = xmlDoc.CreateXmlDeclaration("1.0", "utf-8", null);

            // Create the root element
            XmlElement rootNode = xmlDoc.CreateElement("ReportDataSet");

            xmlDoc.InsertBefore(xmlDeclaration, xmlDoc.DocumentElement);
            xmlDoc.AppendChild(rootNode);

            DataTable dt = BoPhanController.BoPhan_GetAllActive();

            foreach (DataRow item in dt.Rows)
            {
                string desc = item["MoTa"].ToString();
                string ten  = item["Ten"].ToString();

                XmlElement Node = xmlDoc.CreateElement("Table" + desc);
                rootNode.AppendChild(Node);

                DataTable dtNhanVien = TongHopDanhGiaCaNhanThangController.GetAllNhanVien(ten, ConvertUtility.ToInt32(dropNam.SelectedValue));

                int stt = 1;
                foreach (DataRow itemNhanVien in dtNhanVien.Rows)
                {
                    DataTable dtDataOfNhanVien = TongHopDanhGiaCaNhanThangController.GetAll(ten, ConvertUtility.ToInt32(dropNam.SelectedValue), itemNhanVien["HoTen"].ToString());

                    xmlDoc = BuildXmlDocument(dtDataOfNhanVien, xmlDoc, Node, stt, itemNhanVien["HoTen"].ToString());
                    stt++;
                }
            }

            if (!Directory.Exists(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/")))
            {
                Directory.CreateDirectory(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/"));
            }
            //ds.Dispose();
            string     datetime     = DateTime.Now.ToString("yyyyMMddHHmmss");
            FileStream downloadFile =
                File.Create(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/") + "TongHopBaoCaoXepLoaiNhanVien_" + datetime +
                            ".xls");

            // transform
            XslTransform xsl = new XslTransform();

            xsl.Load(Server.MapPath("/Template/" + "ReportTongHopXepLoaiNhanVien.xsl"));
            xsl.Transform(xmlDoc, null, downloadFile, null);
            downloadFile.Flush();
            downloadFile.Close();

            if (AppEnv.GetLanguage() == "vi-VN")
            {
                hplDownload.Text = "Hãy click vào liên kết này để Tải file về";
            }
            else
            {
                hplDownload.Text = "Please, click here to download file";
            }
            hplDownload.NavigateUrl = "/UpLoad/Temp/" + CurrentUser.UserID + "/TongHopBaoCaoXepLoaiNhanVien_" + datetime + ".xls";
        }