protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); idCongViec = ConvertUtility.ToInt32(Request.QueryString["idCongViec"]); idDotDanhGia = ConvertUtility.ToInt32(Request.QueryString["idDotDanhGia"]); idTrungTam = ConvertUtility.ToInt32(Request.QueryString["idTrungTam"]); idPhongBan = ConvertUtility.ToInt32(Request.QueryString["idPhongBan"]); loai = ConvertUtility.ToInt32(Request.QueryString["loai"]); 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("KeHoach", typeof(string)); dt.Columns.Add("DonViDo", typeof(string)); dt.Columns.Add("Level", typeof(string)); dt.Columns.Add("Bold", typeof(string)); DataTable source = QuanLyCongViecKTXVaPSController.LoadCongViecForView(idCongViec, dt, idTrungTam, idPhongBan, loai, idDotDanhGia); if (source != null && source.Rows.Count > 0) { rptCongViec.DataSource = source; rptCongViec.ItemDataBound += new RepeaterItemEventHandler(rptCongViec_ItemDataBound); rptCongViec.DataBind(); } }
protected void LoadZones() { //try //{ // dropPhongBan.SelectedValue = IDPhongBan.ToString(); // dropPhong.SelectedValue = IDPhongBan.ToString(); //} //catch (Exception) //{ // dropPhongBan.SelectedIndex = -1; // IDPhongBan = 0; //} lstCongViec.Items.Clear(); QuanLyCongViecKTXVaPSController.LoadCongViec(lstCongViec.Items, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), IDPhongBan, 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue)); lstCongViec.Items.Insert(0, new ListItem("Root", "0")); dropCongViecKPI.Items.Clear(); foreach (ListItem item in lstCongViec.Items) { dropCongViecKPI.Items.Add(new ListItem(item.Text, item.Value)); } MiscUtility.SelectItemFromList(lstCongViec, zoneSelected.ToString()); DataTable dt = QuanLyCongViecKTXVaPSController.GetAllByParentIDNew(zoneSelected, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), IDPhongBan, 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue)); dgrCongViec.DataSource = dt; dgrCongViec.DataBind(); LoadInfo(zoneSelected); }
private void InsertCongViecCon(DataTable source, DataRow curItem, int parentId, int idDotDanhGia) { DataRow[] rowChild = source.Select("ParentID='" + ConvertUtility.ToInt32(curItem["ID"]) + "'"); if (rowChild.Length > 0) { foreach (DataRow itemChild in rowChild) { QuanLyCongViecKTXVaPSInfo info = new QuanLyCongViecKTXVaPSInfo(); info.Ten = ConvertUtility.ToString(itemChild["Ten"]); info.TyTrong = ConvertUtility.ToDouble(itemChild["TyTrong"]); info.SoGio = ConvertUtility.ToDouble(itemChild["SoGio"]); info.ParentID = parentId; info.Priority = ConvertUtility.ToInt32(itemChild["Priority"]); info.KeHoach = ConvertUtility.ToString(itemChild["KeHoach"]); info.DonViDo = ConvertUtility.ToString(itemChild["DonViDo"]); info.IDTrungTam = ConvertUtility.ToInt32(itemChild["IDTrungTam"]); info.IDPhongBan = ConvertUtility.ToInt32(itemChild["IDPhongBan"]); info.Loai = ConvertUtility.ToInt32(itemChild["Loai"]); info.IDDotDanhGia = idDotDanhGia; info.LevelDeep = ConvertUtility.ToInt32(itemChild["LevelDeep"]); info.NgayBatDau = ConvertUtility.ToDateTime(itemChild["NgayBatDau"]).AddMonths(1); info.NgayKetThuc = ConvertUtility.ToDateTime(itemChild["NgayKetThuc"]).AddMonths(1); info.TrangThaiCV = ConvertUtility.ToInt32(itemChild["TrangThaiCV"]); info.TuanLamViec = ConvertUtility.ToString(itemChild["TuanLamViec"]); info.OldID = ConvertUtility.ToInt32(itemChild["ID"]); int parentIDTemp = QuanLyCongViecKTXVaPSController.Insert_6_11_2014(info); InsertCongViecCon(source, itemChild, parentIDTemp, idDotDanhGia); } } }
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"])); } }
private int GetParentID(string tencongvieccha, int idDotDanhGia, int idTrungTam) { QuanLyCongViecKTXVaPSInfo info = QuanLyCongViecKTXVaPSController.GetInfoByTen(tencongvieccha, idDotDanhGia, idTrungTam, 1); if (info != null) { return(info.ID); } return(0); }
protected void dgrCongViec_RowCommand(object source, GridViewCommandEventArgs e) { if (e.CommandName == "delete") { try { int id = ConvertUtility.ToInt32(e.CommandArgument); QuanLyCongViecKTXVaPSInfo info = QuanLyCongViecKTXVaPSController.GetInfo(id); if (info == null) { cmdEmpty_Click(null, null); return; } QuanLyCongViecKTXVaPSController.Delete(id, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue)); int ParentID = ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue); if (ParentID > 0) { UpdateTyTrongCongViecCha(ParentID, info.IsKPI); string oldData = GetObjectInfo(info); #region Log Action LogFileInfo logFileInfo = new LogFileInfo(); logFileInfo.Log_Action = "Delete"; 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: " + oldData; logFileInfo.Description_After = "Delete KPI with info: <br />" + GetObjectInfo(info); logFileInfo.UserName = CurrentUser.Username; logFileInfo.UserID = CurrentUser.UserID; CreateLogFile.LogAction(logFileInfo); #endregion UpdateCapDoCongViec(); } lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS; } catch (Exception ex) { lblStatusUpdate.Text = ex.Message; } } Session["Nav"] = "1"; }
protected void btnXoaAll_Click(object sender, EventArgs e) { Session["Nav"] = "3"; foreach (GridViewRow gv in dgrKhoiLuongCV3.Rows) { CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("chkCheck"); if (deleteChkBxItem.Checked) { string strTemp = ((Label)gv.FindControl("lblIDCongViec")).Text.ToString(); QuanLyCongViecKTXVaPSController.DeleteRecursive(ConvertUtility.ToInt32(strTemp)); } } }
protected void cmdDel_Click(object sender, EventArgs e) { try { QuanLyCongViecKTXVaPSInfo info = QuanLyCongViecKTXVaPSController.GetInfo(ConvertUtility.ToInt32(txtID.Text)); if (info == null) { cmdEmpty_Click(null, null); return; } QuanLyCongViecKTXVaPSController.Delete(ConvertUtility.ToInt32(txtID.Text), ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue)); int ParentID = ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue); if (ParentID > 0) { //UpdateTyTrongCongViecCha(ParentID, info.IsKPI); string oldData = GetObjectInfo(info); #region Log Action LogFileInfo logFileInfo = new LogFileInfo(); logFileInfo.Log_Action = "Delete"; logFileInfo.Log_Type_Object = "QuanLyCongViecKPI"; logFileInfo.Item_CatID = "Cong Viec Phat Sinh"; 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 UpdateCapDoCongViec(); } lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS; } catch (Exception ex) { lblStatusUpdate.Text = ex.Message; } Session["Nav"] = "3"; }
//protected void dropPhongBan_SelectedIndexChanged(object sender, EventArgs e) //{ // //IDPhongBan = ConvertUtility.ToInt32(dropPhongBan.SelectedValue); // zoneSelected = 0; // lblStatusUpdate.Text = ""; // zoneSelected = 0; // Session["Nav"] = "1"; //} protected void btnExport_Click(object sender, EventArgs e) { 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("KeHoach", typeof(string)); dt.Columns.Add("DonViDo", typeof(string)); dt.Columns.Add("Level", typeof(string)); dt.Columns.Add("Bold", typeof(string)); dt.Columns.Add("Ma", typeof(string)); DataTable source = QuanLyCongViecKTXVaPSController.LoadCongViecForExport(dt, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 0, 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue)); XmlDocument doc = BuildXmlDocument(source); 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 + "/") + "Report_" + datetime + ".xls"); // transform XslTransform xsl = new XslTransform(); xsl.Load(Server.MapPath("/Template/" + "Report.xsl")); DateConverter objDateConverter = new DateConverter(); XsltArgumentList args = new XsltArgumentList(); args.AddExtensionObject("urn:ms-kb", objDateConverter); xsl.Transform(doc, args, downloadFile, null); downloadFile.Flush(); downloadFile.Close(); hplDownload.Text = "Hãy click vào liên kết này để Tải file về"; hplDownload.NavigateUrl = "/UpLoad/Temp/" + CurrentUser.UserID + "/Report_" + datetime + ".xls"; Session["Nav"] = "1"; }
private static void LoadForCurItem(DataTable lstItems, DataRow curItem, int ParentID, int LevelDeep) { int level = ConvertUtility.ToInt32(curItem["LevelDeep"]); level++; QuanLyCongViecKTXVaPSInfo info = QuanLyCongViecKTXVaPSController.GetInfo(ParentID); if (info == null) { return; } DataRow item = lstItems.NewRow(); item["Ten"] = info.Ten; item["ParentID"] = info.ParentID; item["LevelDeep"] = level; item["IDCongViecKPI"] = info.ID; lstItems.Rows.Add(item); LoadForCurItem(lstItems, item, info.ParentID, info.LevelDeep); }
void UpdateCapDoCongViec() { 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("KeHoach", typeof(string)); dt.Columns.Add("DonViDo", typeof(string)); dt.Columns.Add("Level", typeof(string)); dt.Columns.Add("Bold", typeof(string)); dt.Columns.Add("Ma", typeof(string)); DataTable source = QuanLyCongViecKTXVaPSController.LoadCongViecForExport(dt, ConvertUtility.ToInt32(dropTrungTam.SelectedValue), IDPhongBan, 1, IDDotDanhGia); foreach (DataRow item in source.Rows) { int level = ConvertUtility.ToInt32(item["Level"]); int idCongViec = ConvertUtility.ToInt32(item["ID"]); QuanLyCongViecKTXVaPSController.UpdateCapDoCongViec(idCongViec, level); } }
protected void btnImport_Click(object sender, EventArgs e) { if (fileImport.HasFile) { if (!Directory.Exists(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/"))) { Directory.CreateDirectory(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/")); } string ext = ".xls"; if (fileImport.FileName.IndexOf(".xlsx") > 0) { ext = ".xlsx"; } fileImport.PostedFile.SaveAs(Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/") + fileImport.FileName.Replace(ext, "") + "_Temp" + ext); string path = Server.MapPath("/UpLoad/Temp/" + CurrentUser.UserID + "/") + fileImport.FileName.Replace(ext, "") + "_Temp" + ext; if (File.Exists(path)) { DataTable returnTable = ImportExcelToDataTable.ImportExcel(path); if (returnTable != null && returnTable.Rows.Count > 0) { if (chkDeleteAll.Checked) { QuanLyCongViecKTXVaPSController.DeleteAll(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue)); } for (int i = 0; i < returnTable.Rows.Count; i++) { try { DataRow row = returnTable.Rows[i]; #region Import QuanLyCongViecKTXVaPSInfo info = new QuanLyCongViecKTXVaPSInfo(); info.Ten = row[0].ToString(); info.ParentID = 0; info.TyTrong = 0; info.KeHoach = ""; info.IDTrungTam = ConvertUtility.ToInt32(dropTrungTam.SelectedValue); info.DonViDo = ""; info.IDPhongBan = 0;//ConvertUtility.ToInt32(dropPhong.SelectedValue); info.Loai = 1; info.IDDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue); info.SoGio = 0; info.IsKPI = 1; info.NgayBatDau = DateTime.Now; info.NgayKetThuc = DateTime.Now; info.IDNhomCongViec = 1; info.TrangThaiCV = 2; info.TuanLamViec = "1,2,3,4,5"; QuanLyCongViecKTXVaPSController.Insert(info); info = new QuanLyCongViecKTXVaPSInfo(); info.Ten = row[1].ToString(); int parentID = GetParentID(row[0].ToString(), ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(dropTrungTam.SelectedValue)); info.ParentID = parentID; info.TyTrong = 0; info.KeHoach = ConvertUtility.ToString(row[3].ToString()); info.IDTrungTam = ConvertUtility.ToInt32(dropTrungTam.SelectedValue); info.DonViDo = ""; info.IDPhongBan = 0;//ConvertUtility.ToInt32(dropPhong.SelectedValue); info.Loai = 1; info.IDDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue); info.SoGio = ConvertUtility.ToDouble(row[2].ToString()); info.IsKPI = 1; info.NgayBatDau = DateTime.Now; info.NgayKetThuc = DateTime.Now; info.IDNhomCongViec = 1; info.TrangThaiCV = 2; info.TuanLamViec = ConvertUtility.ToString(row[4].ToString()); QuanLyCongViecKTXVaPSController.Insert(info); if (info.ParentID > 0) { UpdateCapDoCongViec(); } #endregion } catch { continue; } } } } else { lblStatusUpdate.Text = GetLocalResourceObject("lblUpdateStatusResource4.Text").ToString(); } } Session["Nav"] = "1"; }
protected void dgrKhoiLuongCV2_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex < 0) { return; } DataRowView crrData = (DataRowView)e.Row.DataItem; Button btnDelete = (Button)e.Row.FindControl("btnDelete"); TextBox txtSoLieuCamKet = (TextBox)e.Row.FindControl("txtSoLieuCamKet"); TextBox txtTenCongViec = (TextBox)e.Row.FindControl("txtTenCongViec"); TextBox txtTyTrongCV = (TextBox)e.Row.FindControl("txtTyTrongCV"); if (CurrentUser.RoleID == (int)Constants.Role.NhanVien || CurrentUser.RoleID == (int)Constants.Role.NhanVienKD) { QuanLyCongViecKTXVaPSInfo infoCongViec = QuanLyCongViecKTXVaPSController.GetInfo(ConvertUtility.ToInt32(crrData["IDCongViec"])); if (infoCongViec != null) { if (CurrentUser.UserID == infoCongViec.CreateBy) { if (ConvertUtility.ToInt32(dt.Rows[0]["TrangThai"]) <= (int)Constants.TrangThaiDanhGiaNhanVien.DangDanhGia) { btnDelete.Visible = true; } else { btnDelete.Visible = false; } txtSoLieuCamKet.ReadOnly = false; txtTenCongViec.ReadOnly = false; txtTyTrongCV.ReadOnly = false; } else { btnDelete.Visible = false; txtSoLieuCamKet.ReadOnly = true; txtTenCongViec.ReadOnly = true; txtTyTrongCV.ReadOnly = true; } } else { btnDelete.Visible = false; txtSoLieuCamKet.ReadOnly = true; txtTenCongViec.ReadOnly = true; txtTyTrongCV.ReadOnly = true; } } else { btnDelete.Visible = true; txtSoLieuCamKet.ReadOnly = false; txtTenCongViec.ReadOnly = false; txtTyTrongCV.ReadOnly = false; } ListBox dropBoPhanHoTro = (ListBox)e.Row.FindControl("dropBoPhanHoTro"); dropBoPhanHoTro.Items.Clear(); dropBoPhanHoTro.DataSource = dtBoPhanHoTro; dropBoPhanHoTro.DataBind(); int idDotDanhGia = ConvertUtility.ToInt32(crrData["IDDotDanhGia"]); int idCongViec = ConvertUtility.ToInt32(crrData["IDCongViec"]); DataTable dtBoPhanHoTroSelected = DanhGiaThang_DGCBCNVDanhGiaTTCVController.GetKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec); if (dtBoPhanHoTroSelected != null && dtBoPhanHoTroSelected.Rows.Count > 0) { foreach (ListItem item in dropBoPhanHoTro.Items) { DataRow[] row = dtBoPhanHoTroSelected.Select("IDBoPhanHoTro = " + item.Value); if (row.Length > 0) { item.Selected = true; } } } TextBox txtNguoiThamGia = (TextBox)e.Row.FindControl("txtNguoiThamGia"); DataTable dtTen = DanhGiaThang_BoPhanTTCVController.GetNguoiThamGiaCongViecKTXVaPS(idDotDanhGia, idCongViec); if (dtTen != null && dtTen.Rows.Count > 0) { txtNguoiThamGia.Text = dtTen.Rows[0]["Ten"].ToString(); } else { txtNguoiThamGia.Text = ""; } btnDelete.OnClientClick = "return window.confirm('Bạn chắc chắn xóa công việc này không ?')"; }
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(); }
protected void btnDelete_Click(object sender, EventArgs e) { QuanLyCongViecKTXVaPSController.DeleteAll(ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 1, ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue)); Session["Nav"] = "1"; }
private void LoadInfo(int id) { QuanLyCongViecKTXVaPSInfo info = QuanLyCongViecKTXVaPSController.GetInfo(id); if (info == null) { cmdEmpty_Click(null, null); return; } txtID.Text = info.ID.ToString(); txtName.Text = info.Ten; txtTyTrong.Text = Math.Round(info.TyTrong, 3).ToString(); txtKeHoach.Text = info.KeHoach; dropCongViecKPI.SelectedValue = info.ParentID.ToString(); txtDonViDo.Text = info.DonViDo; selectedparentid = info.ParentID; lblTuanLV.Text = info.TuanLamViec; try { dropMaNhom.SelectedValue = info.IDNhomCongViec.ToString(); } catch (Exception) { dropMaNhom.SelectedIndex = -1; } try { dropTrangThai.SelectedValue = info.TrangThaiCV.ToString(); } catch (Exception) { dropTrangThai.SelectedIndex = -1; } //try //{ // dropPhong.SelectedValue = info.IDPhongBan.ToString(); //} //catch (Exception) //{ // dropPhong.SelectedIndex = -1; //} try { txtSoGio.Text = info.SoGio.ToString(); } catch (Exception) { txtSoGio.Text = ""; } try { dropKPIBoPhan.SelectedValue = info.IsKPI.ToString(); } catch (Exception) { dropKPIBoPhan.SelectedValue = "1"; } try { dtFrom.Text = info.NgayBatDau.ToShortDateString(); } catch (Exception) { dtFrom.Text = DateTime.Now.ToShortDateString(); } try { dtTo.Text = info.NgayKetThuc.ToShortDateString(); } catch (Exception) { dtTo.Text = DateTime.Now.ToShortDateString(); } }
protected void btnLayCongViecThangTruoc_Click(object sender, EventArgs e) { QuanLyCongViecKTXVaPSController.ClearAllCongViecTheoBoPhanVaDotDanhGia(ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue), ConvertUtility.ToInt32(dropTrungTam.SelectedValue), 1); #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, 1, 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"]); if (ConvertUtility.ToInt32(item["ID"]) == 31279) { string a = "a"; } 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, 1, 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 = 1; 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"] = "1"; }
protected void cmdUpdate_Click(object sender, EventArgs e) { QuanLyCongViecKTXVaPSInfo info = QuanLyCongViecKTXVaPSController.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.Ten = txtName.Text; info.ParentID = ConvertUtility.ToInt32(dropCongViecKPI.SelectedValue); info.TyTrong = ConvertUtility.ToDouble(txtTyTrong.Text); info.IDTrungTam = ConvertUtility.ToInt32(dropTrungTam.SelectedValue); info.KeHoach = txtKeHoach.Text; info.DonViDo = txtDonViDo.Text; info.IDPhongBan = 0;//ConvertUtility.ToInt32(dropPhong.SelectedValue); info.Loai = 1; info.IDDotDanhGia = ConvertUtility.ToInt32(dropDotDanhGia.SelectedValue);; info.SoGio = ConvertUtility.ToDouble(txtSoGio.Text); info.IsKPI = ConvertUtility.ToInt32(dropKPIBoPhan.SelectedValue); info.NgayBatDau = ConvertUtility.ToDateTime(dtFrom.Text.ToString()); info.NgayKetThuc = ConvertUtility.ToDateTime(dtTo.Text); info.IDNhomCongViec = ConvertUtility.ToInt32(dropMaNhom.SelectedValue); info.TrangThaiCV = ConvertUtility.ToInt32(dropTrangThai.SelectedValue); DateConverter objDate = new DateConverter(); int tuanBD = objDate.GetWeekOfMonth(info.NgayBatDau); int tuanKT = objDate.GetWeekOfMonth(info.NgayKetThuc); string tuanLV = ""; for (int i = tuanBD; i <= tuanKT; i++) { tuanLV += i + ","; } info.TuanLamViec = tuanLV.Substring(0, tuanLV.Length - 1); try { QuanLyCongViecKTXVaPSController.Update(info); lblStatusUpdate.Text = MiscUtility.MSG_UPDATE_SUCCESS; #region Log Action LogFileInfo logFileInfo = new LogFileInfo(); logFileInfo.Log_Action = "Update"; 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: " + oldData; logFileInfo.Description_After = "Update KPI with info: <br />" + GetObjectInfo(info); logFileInfo.UserName = CurrentUser.Username; logFileInfo.UserID = CurrentUser.UserID; CreateLogFile.LogAction(logFileInfo); #endregion UpdateCapDoCongViec(); } catch (Exception ex) { lblStatusUpdate.Text = ex.Message; } Session["Nav"] = "1"; }