protected void btnThemMoi2_Click(object sender, EventArgs e)
        {
            DanhGiaThang_DGCBCNVDanhGiaTTCVInfo info = new DanhGiaThang_DGCBCNVDanhGiaTTCVInfo();

            info.IDDotDanhGia = idDotDanhGia;
            info.IDNhanVien = idNhanVien;
            info.TenCongViec = txtTenCongViec2.Text.Trim();
            info.TyTrongCV = ConvertUtility.ToDouble(txtTyTrongCongViec2.Text);
            info.SoLieuCamKet = ConvertUtility.ToString(txtSoLieuCamKet2.Text);
            info.YeuCauHoTro = ConvertUtility.ToString(txtYeuCauCanHoTro2.Text);
            info.Loai = 2;
            info.IDBoPhan = userInfo.IDTrungTam;
            info.IDBoPhanHoTro = ConvertUtility.ToInt32(dropBoPhanHoTro.SelectedValue);
            info.IDPhongBan = userInfo.IDPhong;
            info.SoGio = ConvertUtility.ToDouble(txtSoGio.Text);

            info.TyTrongCV = info.SoGio * 100 / 176;
            info.NgayBatDau = ConvertUtility.ToDateTime(dtFrom.Text);
            info.NgayKetThuc = ConvertUtility.ToDateTime(dtTo.Text);

            int idCongViec = DanhGiaThang_DGCBCNVDanhGiaTTCVController.InsertKeHoachThang(info);

            //foreach (ListItem item in dropBoPhanHoTro.Items)
            //{
            //    if (item.Selected)
            //    {
            //        DanhGiaThang_DGCBCNVDanhGiaTTCVController.UpdateKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec, ConvertUtility.ToInt32(item.Value));
            //    }
            //    else
            //    {
            //        DanhGiaThang_DGCBCNVDanhGiaTTCVController.DeleteKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec, ConvertUtility.ToInt32(item.Value));
            //    }
            //}
        }
        protected void btnUpdateCongViecVaoKeHoach1_Click(object sender, EventArgs e)
        {
            #region Cap nhat cong viec vao ke hoach thang cua nhan vien va bo phan

            int idDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);

            try
            {
                int idNhanVien = ConvertUtility.ToInt32(lstNhanVien.SelectedValue);
                DataTable dtCongViec = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienKTXVaPS(idNhanVien, 1, idDotDanhGia);

                if (dtCongViec != null && dtCongViec.Rows.Count > 0)
                {
                    foreach (DataRow row in dtCongViec.Rows)
                    {
                        DanhGiaThang_DGCBCNVDanhGiaTTCVInfo info = new DanhGiaThang_DGCBCNVDanhGiaTTCVInfo();

                        info.IDDotDanhGia = idDotDanhGia;
                        info.IDNhanVien = idNhanVien;
                        info.TenCongViec = ConvertUtility.ToString(row["Ten"]);
                        int idCongViecKPI = ConvertUtility.ToInt32(row["IDCongViecKPI"]);
                        info.TyTrongCV = ConvertUtility.ToDouble(row["TyTrong"]);
                        info.SoGio = ConvertUtility.ToDouble(row["SoGio"]);
                        info.SoLieuCamKet = ConvertUtility.ToString(row["KeHoach"]);
                        info.YeuCauHoTro = "";
                        info.Loai = 1;
                        info.IDCongViec = idCongViecKPI;
                        info.IDBoPhanHoTro = 0;
                        info.IDBoPhan = ConvertUtility.ToInt32(row["IDBoPhan"]);
                        info.IDPhongBan = ConvertUtility.ToInt32(row["IDPhongBan"]);
                        info.NgayBatDau = ConvertUtility.ToDateTime(row["NgayBatDau"]);
                        info.NgayKetThuc = ConvertUtility.ToDateTime(row["NgayKetThuc"]);
                        DanhGiaThang_DGCBCNVDanhGiaTTCVController.InsertKeHoachThang(info);
                    }
                }
            }
            catch (Exception)
            {
            }

            #endregion
            Session["Nav"] = "1";
        }
        protected void btnUpdateDiem3_Click(object sender, EventArgs e)
        {
            Session["Nav"] = "3";
            foreach (GridViewRow row in dgrKhoiLuongCV3.Rows)
            {
                Label txtTenCongViec = (Label)row.FindControl("txtTenCongViec");
                TextBox txtTyTrongCV = (TextBox)row.FindControl("txtTyTrongCV");
                TextBox txtThoiGian = (TextBox)row.FindControl("txtThoiGian");
                Label txtSoLieuCamKet = (Label)row.FindControl("txtSoLieuCamKet");
                TextBox txtSoLieuThucHienThucTeTrongThang = (TextBox)row.FindControl("txtSoLieuThucHienThucTeTrongThang");
                TextBox txtNhanVienDanhGiaTyLeHoanThanh = (TextBox)row.FindControl("txtNhanVienDanhGiaTyLeHoanThanh");
                TextBox txtTBPDanhGia = (TextBox)row.FindControl("txtTBPDanhGia");
                Label txtYeuCauHoTro = (Label)row.FindControl("txtYeuCauHoTro");
                TextBox txtYKienCuaNhanVien = (TextBox)row.FindControl("txtYKienCuaNhanVien");
                TextBox txtYKienCuaTBP = (TextBox)row.FindControl("txtYKienCuaTBP");
                ListBox dropBoPhanHoTro = (ListBox)row.FindControl("dropBoPhanHoTro");

                Label txtID = (Label)row.FindControl("txtID");
                Label lblIDBoPhan = (Label)row.FindControl("lblIDBoPhan");
                Label lblIDBoPhanHoTro = (Label)row.FindControl("lblIDBoPhanHoTro");
                Label lblIDPhongBan = (Label)row.FindControl("lblIDPhongBan");
                Label txtIdCongViec = (Label)row.FindControl("txtIdCongViec");

                DanhGiaThang_DGCBCNVDanhGiaTTCVInfo info = new DanhGiaThang_DGCBCNVDanhGiaTTCVInfo();

                info.ID = ConvertUtility.ToInt32(txtID.Text);
                info.IDDotDanhGia = idDotDanhGia;
                info.IDNhanVien = idNhanVien;
                info.TenCongViec = txtTenCongViec.Text.Trim();
                info.SoGio = ConvertUtility.ToDouble(txtThoiGian.Text);
                info.TyTrongCV = ConvertUtility.ToDouble(txtTyTrongCV.Text);
                info.SoLieuCamKet = ConvertUtility.ToString(txtSoLieuCamKet.Text);
                info.SoLieuThucHienThucTeTrongThang = txtSoLieuThucHienThucTeTrongThang.Text;
                info.NhanVienDanhGiaTyLeHoanThanh = ConvertUtility.ToDouble(txtNhanVienDanhGiaTyLeHoanThanh.Text);

                if (info.NhanVienDanhGiaTyLeHoanThanh < 0)
                {
                    info.NhanVienDanhGiaTyLeHoanThanh = 0;
                }

                if (CurrentUser.RoleID != (int)Constants.Role.TruongBoPhanKhoiHoTro && CurrentUser.RoleID != (int)Constants.Role.TruongBoPhanKhoiKinhDoanh)
                {
                    if (CurrentUser.UserID == idNhanVien)
                    {
                        info.TBPDanhGia = info.NhanVienDanhGiaTyLeHoanThanh;
                    }
                    else
                    {
                        info.TBPDanhGia = ConvertUtility.ToDouble(txtTBPDanhGia.Text);
                    }
                }
                else
                {
                    info.TBPDanhGia = ConvertUtility.ToDouble(txtTBPDanhGia.Text);
                }

                if (info.TBPDanhGia < 0)
                {
                    info.TBPDanhGia = 0;
                }

                info.YKienCuaNhanVien = ConvertUtility.ToString(txtYKienCuaNhanVien.Text);
                info.YKienCuaTBP = ConvertUtility.ToString(txtYKienCuaTBP.Text);
                info.Loai = 3;

                info.IDCongViec = ConvertUtility.ToInt32(txtIdCongViec.Text);
                info.IDBoPhan = ConvertUtility.ToInt32(lblIDBoPhan.Text);
                info.IDBoPhanHoTro = ConvertUtility.ToInt32(dropBoPhanHoTro.SelectedValue);
                info.IDPhongBan = ConvertUtility.ToInt32(lblIDPhongBan.Text);

                DanhGiaThang_DGCBCNVDanhGiaTTCVController.Update(info);

                foreach (ListItem item in dropBoPhanHoTro.Items)
                {
                    if (item.Selected)
                    {
                        DanhGiaThang_DGCBCNVDanhGiaTTCVController.UpdateKeHoachThangBoPhanHoTro(idDotDanhGia, ConvertUtility.ToInt32(txtIdCongViec.Text), ConvertUtility.ToInt32(item.Value));
                    }
                    else
                    {
                        DanhGiaThang_DGCBCNVDanhGiaTTCVController.DeleteKeHoachThangBoPhanHoTro(idDotDanhGia, ConvertUtility.ToInt32(txtIdCongViec.Text), ConvertUtility.ToInt32(item.Value));
                    }
                }
            }

            if (CurrentUser.RoleID != (int)Constants.Role.NhanVien && CurrentUser.RoleID != (int)Constants.Role.NhanVienKD)
            {
                DataTable dt = DotDanhGiaController.checkDanhGiaThang(idDotDanhGia, idNhanVien);

                if (dt != null && dt.Rows.Count > 0)
                {
                    if (ConvertUtility.ToInt32(dt.Rows[0]["TrangThai"]) == (int)Constants.TrangThaiDanhGiaNhanVien.ThongNhat)
                    {
                        UserInfo userInfo = UserController.GetUser(idNhanVien);

                        EmailUtility.DoSendMail(userInfo.EmailVNG, "", "Trưởng bộ phận/Trưởng Phòng đã thống nhất bảng đánh giá tháng", "TBP/TP (" + CurrentUser.EmailVNG + ") đã cập nhật điểm công việc phát sinh của bạn. Đề nghị bạn đăng nhập phần mềm để xem kết quả đánh giá.");
                    }
                    //else
                    //{
                    //    UserInfo infoUser = UserController.GetUser(idNhanVien);
                    //    if (infoUser != null)
                    //    {
                    //        bool value = EmailUtility.DoSendMail(infoUser.EmailVNG, "", "Mail nhắc nhở nhân viên hoàn thành công việc phát sinh", "Yêu cầu bạn hoàn thành công việc phát sinh theo deadline.");
                    //    }
                    //}
                }
            }

            //if (dgrKhoiLuongCV3.Rows.Count > 0)
            //{
            //    Response.Write("<script>javascript:alert('Bạn đã cập nhật thông tin thành công')</script>");
            //}
        }
        protected void btnUpdateDiem2_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow row in dgrKhoiLuongCV2.Rows)
            {
                TextBox txtTenCongViec = (TextBox)row.FindControl("txtTenCongViec");
                TextBox txtTyTrongCV = (TextBox)row.FindControl("txtTyTrongCV");
                TextBox txtGLVCaNhan = (TextBox)row.FindControl("txtGLVCaNhan");
                TextBox txtSoLieuCamKet = (TextBox)row.FindControl("txtSoLieuCamKet");
                TextBox txtYeuCauHoTro = (TextBox)row.FindControl("txtYeuCauHoTro");
                ListBox dropBoPhanHoTro = (ListBox)row.FindControl("dropBoPhanHoTro");

                Label txtID = (Label)row.FindControl("txtID");
                Label txtIdCongViec = (Label)row.FindControl("txtIdCongViec");

                DanhGiaThang_DGCBCNVDanhGiaTTCVInfo info = new DanhGiaThang_DGCBCNVDanhGiaTTCVInfo();

                info.ID = ConvertUtility.ToInt32(txtID.Text);
                info.IDDotDanhGia = idDotDanhGia;
                info.IDNhanVien = idNhanVien;
                info.TenCongViec = txtTenCongViec.Text.Trim();
                info.TyTrongCV = ConvertUtility.ToDouble(txtTyTrongCV.Text);
                info.SoLieuCamKet = ConvertUtility.ToString(txtSoLieuCamKet.Text);
                info.YeuCauHoTro = ConvertUtility.ToString(txtYeuCauHoTro.Text);
                info.Loai = 2;
                info.IDCongViec = ConvertUtility.ToInt32(txtIdCongViec.Text);
                info.IDBoPhan = userInfo.IDTrungTam;
                info.IDBoPhanHoTro = ConvertUtility.ToInt32(dropBoPhanHoTro.SelectedValue);
                info.IDPhongBan = userInfo.IDPhong;
                info.SoGio = ConvertUtility.ToDouble(txtGLVCaNhan.Text);

                if (info.TyTrongCV > 0 && info.SoGio == 0)
                {
                    info.SoGio = info.TyTrongCV * 176 / 100;
                }
                else
                {
                    info.TyTrongCV = info.SoGio * 100 / 176;
                }

                DanhGiaThang_DGCBCNVDanhGiaTTCVController.UpdateKeHoachThang(info);

                //foreach (ListItem item in dropBoPhanHoTro.Items)
                //{
                //    if (item.Selected)
                //    {
                //        DanhGiaThang_DGCBCNVDanhGiaTTCVController.UpdateKeHoachThangBoPhanHoTro(idDotDanhGia, ConvertUtility.ToInt32(txtIdCongViec.Text), ConvertUtility.ToInt32(item.Value));
                //    }
                //    else
                //    {
                //        DanhGiaThang_DGCBCNVDanhGiaTTCVController.DeleteKeHoachThangBoPhanHoTro(idDotDanhGia, ConvertUtility.ToInt32(txtIdCongViec.Text), ConvertUtility.ToInt32(item.Value));
                //    }
                //}
            }
        }
 public static void UpdateKeHoachThang(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo)
 {
     DataAccessProvider.Instance().UpdateKeHoachThang_DGCBCNVDanhGiaTTCV(_DotDanhGiaInfo);
 }
 public static int InsertKeHoachThang(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo)
 {
     return DataAccessProvider.Instance().InsertKeHoachThang_DGCBCNVDanhGiaTTCV(_DotDanhGiaInfo);
 }
 public static void UpdateKeHoachThang(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo)
 {
     DataAccessProvider.Instance().UpdateKeHoachThang_DGCBCNVDanhGiaTTCV(_DotDanhGiaInfo);
 }
 public override int InsertKeHoachThang_DGCBCNVDanhGiaTTCV(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DGCBCNVDanhGiaTTCVInfo)
 {
     return (int)SqlHelper.ExecuteScalar(this.ConnectionString, "KeHoachThang_DGCBCNVDanhGiaTTCV_Insert_5_6_2014",
         _DGCBCNVDanhGiaTTCVInfo.IDDotDanhGia,
         _DGCBCNVDanhGiaTTCVInfo.IDNhanVien,
         _DGCBCNVDanhGiaTTCVInfo.TenCongViec,
         _DGCBCNVDanhGiaTTCVInfo.TyTrongCV,
         _DGCBCNVDanhGiaTTCVInfo.SoLieuCamKet,
         _DGCBCNVDanhGiaTTCVInfo.YeuCauHoTro,
         _DGCBCNVDanhGiaTTCVInfo.Loai,
         _DGCBCNVDanhGiaTTCVInfo.IDCongViec,
         _DGCBCNVDanhGiaTTCVInfo.IDBoPhanHoTro,
         _DGCBCNVDanhGiaTTCVInfo.IDBoPhan,
         _DGCBCNVDanhGiaTTCVInfo.IDPhongBan,
          _DGCBCNVDanhGiaTTCVInfo.SoGio,
          _DGCBCNVDanhGiaTTCVInfo.NgayBatDau,
          _DGCBCNVDanhGiaTTCVInfo.NgayKetThuc
     );
 }
 public override void UpdateDanhGiaThang_DGCBCNVDanhGiaTTCV(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DGCBCNVDanhGiaTTCVInfo)
 {
     SqlHelper.ExecuteNonQuery(this.ConnectionString, "DanhGiaThang_DGCBCNVDanhGiaTTCV_Update",
         _DGCBCNVDanhGiaTTCVInfo.ID,
         _DGCBCNVDanhGiaTTCVInfo.IDDotDanhGia,
         _DGCBCNVDanhGiaTTCVInfo.IDNhanVien,
         _DGCBCNVDanhGiaTTCVInfo.TenCongViec,
         _DGCBCNVDanhGiaTTCVInfo.TyTrongCV,
         _DGCBCNVDanhGiaTTCVInfo.SoLieuCamKet,
         _DGCBCNVDanhGiaTTCVInfo.SoLieuThucHienThucTeTrongThang,
         _DGCBCNVDanhGiaTTCVInfo.NhanVienDanhGiaTyLeHoanThanh,
         _DGCBCNVDanhGiaTTCVInfo.TBPDanhGia,
         _DGCBCNVDanhGiaTTCVInfo.YeuCauHoTro,
         _DGCBCNVDanhGiaTTCVInfo.YKienCuaNhanVien,
         _DGCBCNVDanhGiaTTCVInfo.YKienCuaTBP,
         _DGCBCNVDanhGiaTTCVInfo.Loai,
         _DGCBCNVDanhGiaTTCVInfo.IDCongViec,
         _DGCBCNVDanhGiaTTCVInfo.IDBoPhan,
         _DGCBCNVDanhGiaTTCVInfo.IDBoPhanHoTro,
         _DGCBCNVDanhGiaTTCVInfo.IDPhongBan,
          _DGCBCNVDanhGiaTTCVInfo.SoGio);
 }
 public abstract void UpdateKeHoachThang_DGCBCNVDanhGiaTTCV(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo);
Beispiel #11
0
 public override int InsertDanhGiaThang_DGCBCNVDanhGiaTTCV(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DGCBCNVDanhGiaTTCVInfo)
 {
     return (int)SqlHelper.ExecuteScalar(this.ConnectionString, "DanhGiaThang_DGCBCNVDanhGiaTTCV_Insert",
         _DGCBCNVDanhGiaTTCVInfo.IDDotDanhGia,
         _DGCBCNVDanhGiaTTCVInfo.IDNhanVien,
         _DGCBCNVDanhGiaTTCVInfo.TenCongViec,
         _DGCBCNVDanhGiaTTCVInfo.TyTrongCV,
         _DGCBCNVDanhGiaTTCVInfo.SoLieuCamKet,
         _DGCBCNVDanhGiaTTCVInfo.SoLieuThucHienThucTeTrongThang,
         _DGCBCNVDanhGiaTTCVInfo.NhanVienDanhGiaTyLeHoanThanh,
         _DGCBCNVDanhGiaTTCVInfo.TBPDanhGia,
         _DGCBCNVDanhGiaTTCVInfo.YeuCauHoTro,
         _DGCBCNVDanhGiaTTCVInfo.YKienCuaNhanVien,
         _DGCBCNVDanhGiaTTCVInfo.YKienCuaTBP,
         _DGCBCNVDanhGiaTTCVInfo.Loai,
          _DGCBCNVDanhGiaTTCVInfo.SoGio
     );
 }
 public abstract int InsertKeHoachThang_DGCBCNVDanhGiaTTCV(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo);
 public abstract int InsertDanhGiaThangCVNV_DGCBCNVDanhGiaTTCV(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo);
        protected void cmdAdd_Click(object sender, EventArgs e)
        {
            QuanLyCongViecBaoCaoNgayInfo info = new QuanLyCongViecBaoCaoNgayInfo();
            info.IDCongViecKPI = ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue);
            info.Ten = txtName.Text;
            info.KeHoach = txtKeHoach.Text;
            info.ParentID = txtCongViecLon.Text;
            info.TyTrong = 0;// ConvertUtility.ToDouble(txtTyTrong.Text);
            info.KetQua = txtKetqua.Text;
            info.TyLeHoanThanh = dropTyLeHoanThanh.SelectedValue;
            info.IDTrungTam = CurrentUser.IDTrungTam;
            info.IDPhongBan = CurrentUser.IDPhong;
            info.IDDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);
            info.SoGio = ConvertUtility.ToDouble(txtSoGio.Text);
            info.CreateBy = CurrentUser.UserID;
            info.LyDo = txtLyDo.Text;
            info.DeXuat = txtDeXuat.Text;
            info.CreatedOn = new DateTime(ConvertUtility.ToInt32(dropYear.SelectedValue), ConvertUtility.ToInt32(dropMonth.SelectedValue), ConvertUtility.ToInt32(dropDay.SelectedValue));
            try
            {
                QuanLyCongViecBaoCaoNgayController.Insert(info);

                #region Log Action

                LogFileInfo logFileInfo = new LogFileInfo();
                logFileInfo.Log_Action = "Add";
                logFileInfo.Log_Type_Object = "QuanLyCongViecKPITheoNgay";
                logFileInfo.Item_CatID = "Cong Viec Thuong Xuyen";
                logFileInfo.Item_ID = info.ID.ToString();
                logFileInfo.Item_Name = info.Ten;
                logFileInfo.Description_Before = "Old Data: ";
                logFileInfo.Description_After = "Add KPI with info: <br />" + GetObjectInfo(info);
                logFileInfo.UserName = CurrentUser.Username;
                logFileInfo.UserID = CurrentUser.UserID;
                CreateLogFile.LogAction(logFileInfo);

                #endregion

                lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS;

                if (ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue) == 0)
                {
                    //them vao cong viec phat sinh
                    DanhGiaThang_DGCBCNVDanhGiaTTCVInfo infoCVPhatSinh = new DanhGiaThang_DGCBCNVDanhGiaTTCVInfo();

                    infoCVPhatSinh.IDDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);
                    infoCVPhatSinh.IDNhanVien = CurrentUser.UserID;
                    infoCVPhatSinh.TenCongViec = txtName.Text;
                    infoCVPhatSinh.TyTrongCV = 0;// ConvertUtility.ToDouble(txtTyTrong.Text);
                    infoCVPhatSinh.SoLieuCamKet = txtKeHoach.Text;
                    infoCVPhatSinh.SoLieuThucHienThucTeTrongThang = txtKetqua.Text;
                    infoCVPhatSinh.NhanVienDanhGiaTyLeHoanThanh = ConvertUtility.ToDouble(dropTyLeHoanThanh.SelectedValue);
                    if (infoCVPhatSinh.NhanVienDanhGiaTyLeHoanThanh > 100)
                    {
                        infoCVPhatSinh.NhanVienDanhGiaTyLeHoanThanh = 100;
                    }

                    if (infoCVPhatSinh.NhanVienDanhGiaTyLeHoanThanh < 0)
                    {
                        infoCVPhatSinh.NhanVienDanhGiaTyLeHoanThanh = 0;
                    }
                    infoCVPhatSinh.YeuCauHoTro = "";
                    infoCVPhatSinh.YKienCuaNhanVien = "";
                    infoCVPhatSinh.YKienCuaTBP = "";
                    infoCVPhatSinh.Loai = 3;
                    infoCVPhatSinh.SoGio = ConvertUtility.ToDouble(txtSoGio.Text);

                    DanhGiaThang_DGCBCNVDanhGiaTTCVController.Insert(infoCVPhatSinh);

                }

            }
            catch (Exception ex)
            {
                lblStatusUpdate.Text = ex.Message;
            }
        }
        protected void btnThemMoi3_Click(object sender, EventArgs e)
        {
            Session["Nav"] = "3";
            DanhGiaThang_DGCBCNVDanhGiaTTCVInfo info = new DanhGiaThang_DGCBCNVDanhGiaTTCVInfo();

            info.IDDotDanhGia = idDotDanhGia;
            info.IDNhanVien = idNhanVien;
            info.TenCongViec = txtTenCongViec3.Text.Trim();
            info.TyTrongCV = ConvertUtility.ToDouble(txtTyTrongCongViec3.Text);
            info.SoLieuCamKet = ConvertUtility.ToString(txtSoLieuCamKet3.Text);
            info.SoLieuThucHienThucTeTrongThang = txtSoLieuThucHienThucTeTrongThang3.Text;
            info.NhanVienDanhGiaTyLeHoanThanh = ConvertUtility.ToDouble(dropTyLeHoanThanh.SelectedValue);
            if (info.NhanVienDanhGiaTyLeHoanThanh > 100)
            {
                info.NhanVienDanhGiaTyLeHoanThanh = 100;
            }

            if (info.NhanVienDanhGiaTyLeHoanThanh < 0)
            {
                info.NhanVienDanhGiaTyLeHoanThanh = 0;
            }

            info.TBPDanhGia = info.NhanVienDanhGiaTyLeHoanThanh;

            if (info.TBPDanhGia > 100)
            {
                info.TBPDanhGia = 100;
            }

            if (info.TBPDanhGia < 0)
            {
                info.TBPDanhGia = 0;
            }

            info.YeuCauHoTro = ConvertUtility.ToString(txtYeuCauCanHoTro3.Text);
            info.YKienCuaNhanVien = ConvertUtility.ToString(txtYKienCuaNhanVien3.Text);
            info.YKienCuaTBP = "";
            info.Loai = 3;
            info.SoGio = ConvertUtility.ToDouble(txtSoGio.Text);
            info.TyTrongCV = ConvertUtility.ToDouble(info.SoGio * 100 / 176);

            int idCongViec = DanhGiaThang_DGCBCNVDanhGiaTTCVController.Insert(info);

            foreach (ListItem item in dropBoPhanHoTro.Items)
            {
                if (item.Selected)
                {
                    DanhGiaThang_DGCBCNVDanhGiaTTCVController.UpdateKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec, ConvertUtility.ToInt32(item.Value));
                }
                else
                {
                    DanhGiaThang_DGCBCNVDanhGiaTTCVController.DeleteKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec, ConvertUtility.ToInt32(item.Value));
                }
            }

            if (dt == null)
            {
                dt = DotDanhGiaController.checkDanhGiaThang(idDotDanhGia, idNhanVien);
            }
            if (ConvertUtility.ToInt32(dt.Rows[0]["TrangThai"]) < (int)Constants.TrangThaiDanhGiaNhanVien.DangDanhGia)
            {
                if (CurrentUser.RoleID != (int)Constants.Role.NhanVien && CurrentUser.RoleID != (int)Constants.Role.NhanVienKD)
                {
                    UserInfo infoUser = UserController.GetUser(idNhanVien);
                    if (infoUser != null)
                    {
                        bool value = EmailUtility.DoSendMail(infoUser.EmailVNG, "", "Mail nhắc nhở nhân viên hoàn thành công việc phát sinh", "Yêu cầu bạn hoàn thành công việc phát sinh theo deadline. Mọi người vào phần đánh giá -  Công việc phát sinh để xem công việc phải làm");
                    }
                }
            }
        }
Beispiel #16
0
 public override void UpdateKeHoachThang_DGCBCNVDanhGiaTTCV(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DGCBCNVDanhGiaTTCVInfo)
 {
     SqlHelper.ExecuteNonQuery(this.ConnectionString, "KeHoachThang_DGCBCNVDanhGiaTTCV_Update",
         _DGCBCNVDanhGiaTTCVInfo.ID,
         _DGCBCNVDanhGiaTTCVInfo.IDDotDanhGia,
         _DGCBCNVDanhGiaTTCVInfo.IDNhanVien,
         _DGCBCNVDanhGiaTTCVInfo.TenCongViec,
         _DGCBCNVDanhGiaTTCVInfo.TyTrongCV,
         _DGCBCNVDanhGiaTTCVInfo.SoGio,
         _DGCBCNVDanhGiaTTCVInfo.SoLieuCamKet,
         _DGCBCNVDanhGiaTTCVInfo.YeuCauHoTro,
         _DGCBCNVDanhGiaTTCVInfo.Loai,
         _DGCBCNVDanhGiaTTCVInfo.IDCongViec,
         _DGCBCNVDanhGiaTTCVInfo.IDBoPhanHoTro,
         _DGCBCNVDanhGiaTTCVInfo.IDBoPhan,
         _DGCBCNVDanhGiaTTCVInfo.IDPhongBan);
 }
        protected void btnLayCongViecThangTruoc_Click(object sender, EventArgs e)
        {
            QuanLyCongViecKTXVaPSController.ClearAllCongViecTheoBoPhanVaDotDanhGia(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 2);

            #region Copy cong viec thuong xuyen cua thang truoc

            DataTable dt = new DataTable();

            dt.Columns.Add("ID", typeof(string));
            dt.Columns.Add("Ten", typeof(string));
            dt.Columns.Add("TyTrong", typeof(string));
            dt.Columns.Add("SoGio", typeof(string));
            dt.Columns.Add("ParentID", typeof(string));
            dt.Columns.Add("Priority", typeof(string));
            dt.Columns.Add("KeHoach", typeof(string));
            dt.Columns.Add("DonViDo", typeof(string));
            dt.Columns.Add("IDTrungTam", typeof(string));
            dt.Columns.Add("IDPhongBan", typeof(string));
            dt.Columns.Add("Loai", typeof(string));
            dt.Columns.Add("IDDotDanhGia", typeof(string));
            dt.Columns.Add("LevelDeep", typeof(string));
            dt.Columns.Add("NgayBatDau", typeof(string));
            dt.Columns.Add("NgayKetThuc", typeof(string));
            dt.Columns.Add("TrangThaiCV", typeof(string));
            dt.Columns.Add("TuanLamViec", typeof(string));
            dt.Columns.Add("IDNhomCongViec", typeof(string));
            DataTable source = QuanLyCongViecKTXVaPSController.LoadCongViecForCopyNew(dt, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 0, 2, ConvertUtility.ToInt32(dropDotDanhGiaCopy.SelectedValue));

            DataRow[] row = source.Select("ParentID=0");
            int parentId = 0;
            foreach (DataRow item in row)
            {
                QuanLyCongViecKTXVaPSInfo info = new QuanLyCongViecKTXVaPSInfo();

                info.Ten = ConvertUtility.ToString(item["Ten"]);
                info.TyTrong = ConvertUtility.ToDouble(item["TyTrong"]);
                info.SoGio = ConvertUtility.ToDouble(item["SoGio"]);
                info.ParentID = 0;
                info.Priority = ConvertUtility.ToInt32(item["Priority"]);
                info.KeHoach = ConvertUtility.ToString(item["KeHoach"]);
                info.DonViDo = ConvertUtility.ToString(item["DonViDo"]);
                info.IDTrungTam = ConvertUtility.ToInt32(item["IDTrungTam"]);
                info.IDPhongBan = ConvertUtility.ToInt32(item["IDPhongBan"]);
                info.Loai = ConvertUtility.ToInt32(item["Loai"]);
                info.IDDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);
                info.LevelDeep = ConvertUtility.ToInt32(item["LevelDeep"]);
                info.NgayBatDau = ConvertUtility.ToDateTime(item["NgayBatDau"]).AddMonths(1);
                info.NgayKetThuc = ConvertUtility.ToDateTime(item["NgayKetThuc"]).AddMonths(1);
                info.TrangThaiCV = ConvertUtility.ToInt32(item["TrangThaiCV"]);
                info.TuanLamViec = ConvertUtility.ToString(item["TuanLamViec"]);
                info.IDNhomCongViec = ConvertUtility.ToInt32(item["IDNhomCongViec"]);
                info.OldID = ConvertUtility.ToInt32(item["ID"]);

                try
                {
                    parentId = QuanLyCongViecKTXVaPSController.Insert_6_11_2014(info);

                    #region Log Action

                    LogFileInfo logFileInfo = new LogFileInfo();
                    logFileInfo.Log_Action = "Add";
                    logFileInfo.Log_Type_Object = "QuanLyCongViecKPI";
                    logFileInfo.Item_CatID = "Cong Viec thuong xuyen";
                    logFileInfo.Item_ID = info.ID.ToString();
                    logFileInfo.Item_Name = info.Ten;
                    logFileInfo.Description_Before = "Old Data: ";
                    logFileInfo.Description_After = "Add KPI with info: <br />" + GetObjectInfo(info);
                    logFileInfo.UserName = CurrentUser.Username;
                    logFileInfo.UserID = CurrentUser.UserID;
                    CreateLogFile.LogAction(logFileInfo);

                    #endregion

                    InsertCongViecCon(source, item, parentId, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

                    lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS;

                }
                catch (Exception ex)
                {
                    lblStatusUpdate.Text = ex.Message;
                }
            }

            UpdateCapDoCongViec(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));

            #endregion

            #region Lay cac nhan vien va cac cong viec duoc giao thang truoc --> thuc hien giao viec

            //lay tat ca nhan vien cua trung tam
            DataTable dtNhanVien = DotDanhGiaController.GetAllNhanVienTemp(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 0);

            foreach (DataRow item in dtNhanVien.Rows)
            {
                try
                {
                    string[] array = item["UserID"].ToString().Split('_');
                    int idNhanVien = ConvertUtility.ToInt32(array[0]);
                    int idBoPhan = ConvertUtility.ToInt32(array[2]);

                    DataSet ds = DotDanhGiaController.GetPTDG(idNhanVien, ConvertUtility.ToInt32(item["IDPhong"]));

                    DataTable dtNDG = ds.Tables[0];

                    int idNguoiDanhGia = 0;
                    if (dtNDG != null && dtNDG.Rows.Count > 0)
                    {
                        idNguoiDanhGia = ConvertUtility.ToInt32(dtNDG.Rows[0]["IDNguoiDG"]);
                    }

                    DotDanhGiaController.UpdateNhanVienVaoDotDanhGia(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), idNhanVien, ConvertUtility.ToInt32(array[2]), ConvertUtility.ToInt32(array[1]), idNguoiDanhGia, 0);

                    #region Update cong viec cho nhan vien theo thang

                    DataTable dtCongViec = DotDanhGiaController.GetAllCongViecGiaoChoNhanVienKTXVaPS_6_11_2014(idNhanVien, 2, ConvertUtility.ToInt32(dropDotDanhGiaCopy.SelectedValue));

                    if (dtCongViec != null && dtCongViec.Rows.Count > 0)
                    {
                        foreach (DataRow rowCV in dtCongViec.Rows)
                        {
                            DanhGiaThang_DGCBCNVDanhGiaTTCVInfo info = new DanhGiaThang_DGCBCNVDanhGiaTTCVInfo();

                            info.IDDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);
                            info.IDNhanVien = idNhanVien;
                            info.TenCongViec = ConvertUtility.ToString(rowCV["Ten"]);
                            int idCongViecKPI = ConvertUtility.ToInt32(rowCV["IDCongViecKPI"]);

                            QuanLyCongViecKTXVaPSInfo infoCongViecKPI = QuanLyCongViecKTXVaPSController.GetInfoByOldID(idCongViecKPI);

                            if (infoCongViecKPI != null)
                            {
                                info.IDBoPhan = ConvertUtility.ToInt32(rowCV["IDBoPhan"]);
                                info.IDPhongBan = ConvertUtility.ToInt32(rowCV["IDPhongBan"]);
                                info.TyTrongCV = Math.Round(ConvertUtility.ToDouble(rowCV["TyTrong"]), 2);
                                info.SoGio = Math.Round(ConvertUtility.ToDouble(rowCV["SoGio"]), 2);

                                DotDanhGiaController.UpdateCongViecChoNhanVien(idNhanVien, infoCongViecKPI.ID, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), info.IDBoPhan, info.IDPhongBan, info.TyTrongCV, info.SoGio);

                                info.SoLieuCamKet = ConvertUtility.ToString(rowCV["KeHoach"]);
                                info.YeuCauHoTro = "";
                                info.Loai = 2;
                                info.IDCongViec = infoCongViecKPI.ID;
                                info.IDBoPhanHoTro = 0;
                                info.IDBoPhan = ConvertUtility.ToInt32(rowCV["IDBoPhan"]);
                                info.IDPhongBan = ConvertUtility.ToInt32(rowCV["IDPhongBan"]);
                                info.NgayBatDau = ConvertUtility.ToDateTime(rowCV["NgayBatDau"]).AddMonths(1);
                                info.NgayKetThuc = ConvertUtility.ToDateTime(rowCV["NgayKetThuc"]).AddMonths(1);

                                DanhGiaThang_DGCBCNVDanhGiaTTCVController.InsertKeHoachThang(info);
                            }
                        }
                    }

                    #endregion

                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }

            #endregion
            Session["Nav"] = "2";
        }
 public static int InsertKeHoachThang(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo)
 {
     return(DataAccessProvider.Instance().InsertKeHoachThang_DGCBCNVDanhGiaTTCV(_DotDanhGiaInfo));
 }