protected void LoadZones()
        {
            try
            {
                dropPhongBan.SelectedValue = IDPhongBan.ToString();
                //dropPhong.SelectedValue = IDPhongBan.ToString();
            }
            catch (Exception)
            {
                dropPhongBan.SelectedIndex = -1;
                IDPhongBan = 0;
            }

            DateTime dtTime = new DateTime(ConvertUtility.ToInt32(dropYear.SelectedValue), ConvertUtility.ToInt32(dropMonth.SelectedValue), ConvertUtility.ToInt32(dropDay.SelectedValue));

            DataTable dt = QuanLyCongViecBaoCaoNgayController.GetAllByParentID(0, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), IDPhongBan, dtTime, IDDotDanhGia, CurrentUser.UserID);

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

            if (dropCongViecKPI.SelectedValue != "0")
            {
                QuanLyCongViecKPIInfo info = QuanLyCongViecKPIController.GetInfo(ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue));
                if (info != null)
                {
                    txtCongViecLon.Text = info.KeHoach;
                    lblFrom.Text        = info.NgayBatDau.ToString("dd/MM/yyyy");
                    lblTo.Text          = info.NgayKetThuc.ToString("dd/MM/yyyy");
                }
                else
                {
                    cmdEmpty_Click(null, null);
                }
            }
        }
        protected void btnCapNhatCVHomTruoc_Click(object sender, EventArgs e)
        {
            DateTime  dtTime    = new DateTime(ConvertUtility.ToInt32(dropYearCopy.SelectedValue), ConvertUtility.ToInt32(dropMonthCopy.SelectedValue), ConvertUtility.ToInt32(dropDayCopy.SelectedValue));
            DateTime  dtTimeNow = new DateTime(ConvertUtility.ToInt32(dropYear.SelectedValue), ConvertUtility.ToInt32(dropMonth.SelectedValue), ConvertUtility.ToInt32(dropDay.SelectedValue));
            DataTable dt        = QuanLyCongViecBaoCaoNgayController.GetAllByUserID(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 0, dtTime, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), CurrentUser.UserID);

            foreach (DataRow item in dt.Rows)
            {
                QuanLyCongViecBaoCaoNgayInfo info = new QuanLyCongViecBaoCaoNgayInfo();
                info.IDCongViecKPI = ConvertUtility.ToInt32(item["IDCongViecKPI"]);
                info.Ten           = item["Ten"].ToString();
                info.KeHoach       = item["KeHoach"].ToString();
                info.ParentID      = item["ParentID"].ToString();
                info.TyTrong       = ConvertUtility.ToDouble(item["TyTrong"].ToString());
                info.KetQua        = item["KetQua"].ToString();
                info.TyLeHoanThanh = item["TyLeHoanThanh"].ToString();
                info.IDTrungTam    = ConvertUtility.ToInt32(item["IDTrungTam"].ToString());
                info.IDPhongBan    = ConvertUtility.ToInt32(item["IDPhongBan"].ToString());
                info.IDDotDanhGia  = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);
                info.SoGio         = ConvertUtility.ToDouble(item["SoGio"].ToString());
                info.CreateBy      = CurrentUser.UserID;
                info.LyDo          = item["LyDo"].ToString();
                info.DeXuat        = item["DeXuat"].ToString();
                info.CreatedOn     = dtTimeNow;
                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
                }
                catch (Exception ex)
                {
                    lblStatusUpdate.Text = ex.Message;
                }
            }
        }
        protected void dgrCongViec_RowCommand(object source, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Edit")
            {
                int ID = ConvertUtility.ToInt32(e.CommandArgument);

                zoneSelected = ID;
                LoadInfo(zoneSelected);
            }
            if (e.CommandName == "Delete")
            {
                int ID = ConvertUtility.ToInt32(e.CommandArgument);

                QuanLyCongViecBaoCaoNgayController.Delete(ID);
            }
        }
예제 #4
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            int      idTrungTam   = ConvertUtility.ToInt32(dropTrungTam.SelectedValue);
            int      idPhongBan   = ConvertUtility.ToInt32(dropPhongBan.SelectedValue);
            DateTime dtTime       = new DateTime(ConvertUtility.ToInt32(dropYear.SelectedValue), ConvertUtility.ToInt32(dropMonth.SelectedValue), ConvertUtility.ToInt32(dropDay.SelectedValue));
            int      idDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);

            DataTable dt = null;

            if (!CurrentUser.IsAdmin && !CurrentUser.IsSuperAdmin)
            {
                dt = QuanLyCongViecBaoCaoNgayController.GetAllBaoCaoNgay(idTrungTam, dtTime, ConvertUtility.ToInt32(dropUser.SelectedValue), CurrentUser.UserID, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));
            }
            else
            {
                dt = QuanLyCongViecBaoCaoNgayController.GetAllBaoCaoNgay(idTrungTam, dtTime, ConvertUtility.ToInt32(dropUser.SelectedValue), 0, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue));
            }

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

            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 (dt != null)
            {
                lblTotalTop.Text = lblTotalBottom.Text = dt.Rows.Count.ToString();
            }
        }
예제 #5
0
        protected void btnUpdateVaoBoPhan_Click(object sender, EventArgs e)
        {
            foreach (GridViewRow item in dtgUsers.Rows)
            {
                CheckBox chk   = (CheckBox)item.FindControl("chkCheck");
                Label    lblID = (Label)item.FindControl("lblID");

                int id = ConvertUtility.ToInt32(lblID.Text);

                if (chk.Checked)
                {
                    QuanLyCongViecBaoCaoNgayController.UpdateStatus(id, 1);
                    QuanLyCongViecBaoCaoNgayInfo info = QuanLyCongViecBaoCaoNgayController.GetInfo(id);
                    QuanLyCongViecBaoCaoNgayController.InsertBaoCaoNgayBoPhan(info);
                }
                else
                {
                    QuanLyCongViecBaoCaoNgayController.UpdateStatus(id, 0);
                }
            }
        }
        protected void cmdDel_Click(object sender, EventArgs e)
        {
            try
            {
                QuanLyCongViecBaoCaoNgayController.Delete(ConvertUtility.ToInt32(txtID.Text));

                int ParentID = ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue);
                if (ParentID > 0)
                {
                    QuanLyCongViecBaoCaoNgayInfo info = QuanLyCongViecBaoCaoNgayController.GetInfo(ConvertUtility.ToInt32(txtID.Text));
                    if (info == null)
                    {
                        cmdEmpty_Click(null, null);
                        return;
                    }

                    string oldData = GetObjectInfo(info);

                    #region Log Action

                    LogFileInfo logFileInfo = new LogFileInfo();
                    logFileInfo.Log_Action         = "Delete";
                    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: " + oldData;
                    logFileInfo.Description_After  = "Delete KPI with info: <br />" + GetObjectInfo(info);
                    logFileInfo.UserName           = CurrentUser.Username;
                    logFileInfo.UserID             = CurrentUser.UserID;
                    CreateLogFile.LogAction(logFileInfo);

                    #endregion
                }
            }
            catch (Exception ex)
            {
                lblStatusUpdate.Text = ex.Message;
            }
        }
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            QuanLyCongViecBaoCaoNgayInfo info = QuanLyCongViecBaoCaoNgayController.GetInfo(ConvertUtility.ToInt32(txtID.Text));

            if (info == null)
            {
                cmdEmpty_Click(null, null);
                return;
            }
            if (info.ID == ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue))
            {
                lblStatusUpdate.Text = "Trung mục cha";
                return;
            }
            string oldData = GetObjectInfo(info);

            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.Update(info);

                lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS;

                #region Log Action

                LogFileInfo logFileInfo = new LogFileInfo();
                logFileInfo.Log_Action         = "Update";
                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: " + oldData;
                logFileInfo.Description_After  = "Update KPI with info: <br />" + GetObjectInfo(info);
                logFileInfo.UserName           = CurrentUser.Username;
                logFileInfo.UserID             = CurrentUser.UserID;
                CreateLogFile.LogAction(logFileInfo);

                #endregion

                cmdEmpty_Click(null, null);
                //Response.Redirect(AppEnv.AdminUrlParams("baocaongay"));
            }
            catch (Exception ex)
            {
                lblStatusUpdate.Text = ex.Message;
            }
        }
        private void LoadInfo(int id)
        {
            QuanLyCongViecBaoCaoNgayInfo info = QuanLyCongViecBaoCaoNgayController.GetInfo(id);

            if (info == null)
            {
                cmdEmpty_Click(null, null);
                return;
            }

            if (info.CreatedOn.Year != DateTime.Now.Year || info.CreatedOn.Month != DateTime.Now.Month || info.CreatedOn.Day < DateTime.Now.Day)
            {
                txtName.ReadOnly    = true;
                txtKeHoach.ReadOnly = true;
                //txtTyTrong.ReadOnly = true;
                txtKetqua.ReadOnly        = true;
                txtCongViecLon.ReadOnly   = true;
                dropTyLeHoanThanh.Enabled = false;
                txtLyDo.ReadOnly          = true;
                txtDeXuat.ReadOnly        = true;
                //dropPhong.Enabled = false;
                txtSoGio.ReadOnly = true;
            }
            else
            {
                txtName.ReadOnly    = false;
                txtKeHoach.ReadOnly = false;
                //txtTyTrong.ReadOnly = false;
                txtKetqua.ReadOnly        = false;
                txtCongViecLon.ReadOnly   = true;
                dropTyLeHoanThanh.Enabled = true;
                txtLyDo.ReadOnly          = false;
                txtDeXuat.ReadOnly        = false;
                //dropPhong.Enabled = true;
                txtSoGio.ReadOnly = false;
            }

            try
            {
                dropCongViecKPI.SelectedValue = info.IDCongViecKPI.ToString();
            }
            catch (Exception)
            {
                dropCongViecKPI.SelectedIndex = 0;
            }

            txtID.Text      = info.ID.ToString();
            txtName.Text    = info.Ten;
            txtKeHoach.Text = info.KeHoach;
            //txtTyTrong.Text = Math.Round(info.TyTrong, 3).ToString().Replace(".", ",");
            txtKetqua.Text      = info.KetQua;
            txtCongViecLon.Text = info.ParentID;

            dropTyLeHoanThanh.SelectedValue = info.TyLeHoanThanh;
            txtLyDo.Text   = info.LyDo;
            txtDeXuat.Text = info.DeXuat;
            //try
            //{
            //    dropPhong.SelectedValue = info.IDPhongBan.ToString();
            //}
            //catch (Exception)
            //{
            //    dropPhong.SelectedIndex = -1;
            //}

            try
            {
                txtSoGio.Text = info.SoGio.ToString();
            }
            catch (Exception)
            {
                txtSoGio.Text = "";
            }

            dropYear.SelectedValue  = info.CreatedOn.Year.ToString();
            dropMonth.SelectedValue = info.CreatedOn.Month.ToString();
            dropDay.SelectedValue   = info.CreatedOn.Day.ToString();
        }
        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;
            }
        }