299 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			299 lines
		
	
	
		
			10 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Data; | |||
|  | using System.Configuration; | |||
|  | using System.Collections; | |||
|  | using System.Web; | |||
|  | using System.Web.Security; | |||
|  | using System.Web.UI; | |||
|  | using System.Web.UI.WebControls; | |||
|  | using System.Web.UI.WebControls.WebParts; | |||
|  | using System.Web.UI.HtmlControls; | |||
|  | using ajax; | |||
|  | using DeiNiu.Utils; | |||
|  | using DeiNiu.wms.Logical; | |||
|  | 
 | |||
|  | public partial class Desktop : PageBase | |||
|  | { | |||
|  |     | |||
|  |     protected   void Page_Load(object sender, EventArgs e) | |||
|  |     { | |||
|  |          | |||
|  |         bindWorkplan(); | |||
|  |         //bindProjectInfo(); | |||
|  |         //bindTrainingInfo();  | |||
|  |         showOnlineUsers(); | |||
|  |     } | |||
|  | 
 | |||
|  |     void bindWorkplan() | |||
|  |     { | |||
|  |         LWorkplan wp = new LWorkplan(); | |||
|  |         lbToday.Text = DateTime.Today.ToShortDateString(); | |||
|  |         lbTomorrow.Text = DateTime.Today.AddDays(1).ToShortDateString(); | |||
|  |         lbafterTomorrow.Text = DateTime.Today.AddDays(2).ToShortDateString(); | |||
|  |         gvWorkplan1.DataSource = wp.GetLWorkplan.getWorkplanDetails(lem.GetEmployee.ID, lbToday.Text); | |||
|  |         gvWorkplan2.DataSource = wp.GetLWorkplan.getWorkplanDetails(lem.GetEmployee.ID, lbTomorrow.Text); | |||
|  |         gvWorkplan3.DataSource = wp.GetLWorkplan.getWorkplanDetails(lem.GetEmployee.ID, lbafterTomorrow.Text); | |||
|  |         gvWorkplan3.DataBind(); | |||
|  |         gvWorkplan2.DataBind(); | |||
|  |         gvWorkplan1.DataBind(); | |||
|  |     } | |||
|  |     /* | |||
|  |     void bindProjectInfo() | |||
|  |     { | |||
|  |         LProject lpj = new LProject(); | |||
|  |       | |||
|  |         //上个月 | |||
|  | 
 | |||
|  | 
 | |||
|  |         DataTable lmDt = lpj.GetProject.GetProjects(lem.GetEmployee.ID,DateTime.Now.AddMonths(-1).Year.ToString(), | |||
|  |                                                  DateTime.Now.AddMonths(-1).Month.ToString()) ; | |||
|  |         DataView dv = lmDt.DefaultView; | |||
|  |        //上个月通过数量  | |||
|  |         dv.RowFilter = "   pj_status in('" + | |||
|  |                        ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "')" + | |||
|  |                        " or pd_status in('" + ProjectDetailStatus.审核通过 + "','" + ProjectDetailStatus.考核通过 + "') ";   | |||
|  |         lbLMPassed.Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  |         //上个月未通过数量 | |||
|  |         dv.RowFilter = " pj_status like '%未通过%'  or pd_status  like '%未通过%'"; | |||
|  |         lblmFailed.Text = dv.Count.ToString(); | |||
|  |         //上个月待提交数量 | |||
|  |         dv.RowFilter = "   pj_status in('" + | |||
|  |                 ProjectStatus.项目已分配 + "','" + ProjectStatus.新增未提交  + "')" + | |||
|  |                 " and pd_status in('" + ProjectDetailStatus.月度未提交 +   "') "; | |||
|  |         lblm4submit.Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  | 
 | |||
|  |         | |||
|  |         //上个月得分 | |||
|  |         dv.RowFilter = string.Empty; | |||
|  |         Double lmscore = 0; | |||
|  |         for(int i =0;i<lmDt.Rows.Count;i++) | |||
|  |         { | |||
|  |             lmscore += Convert.ToDouble(lmDt.Rows[i]["pj_score"]); | |||
|  |         } | |||
|  | 
 | |||
|  |         lblmScore.Text = lmscore.ToString(); | |||
|  | 
 | |||
|  | 
 | |||
|  |         //上月待审核 | |||
|  |         lb4preapprove.Text = "0"; | |||
|  |         if (lem.CanShenHe || lem.CanYuShen)   | |||
|  |         { | |||
|  |             lmDt = lpj.Get4ApproveList(lem.GetCanApproveDeptList(), DateTime.Now.AddMonths(-1).Year.ToString(), | |||
|  |                                                     DateTime.Now.AddMonths(-1).Month.ToString()); | |||
|  |             dv = lmDt.DefaultView; | |||
|  |             lb4preapprove.Text = dv.Count.ToString(); | |||
|  |         } | |||
|  |         if (lem.CanKaoHe)    | |||
|  |         { | |||
|  |             dv = lpj.GetProjectsByYearMonth(DateTime.Now.AddMonths(-1).Year.ToString(),DateTime.Now.AddMonths(-1).Month.ToString()).DefaultView;   | |||
|  |             dv.RowFilter = "pj_status in('" + ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "') and pd_status <>'" | |||
|  |                         + ProjectDetailStatus.考核通过 + | |||
|  |                     "' or pd_status in('" + ProjectDetailStatus.审核通过 + "')"; | |||
|  |               | |||
|  |             lb4preapprove.Text = (Convert.ToInt32( lb4preapprove.Text)+ dv.Count).ToString(); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |         //本月 | |||
|  | 
 | |||
|  | 
 | |||
|  |         lmDt = lpj.GetProject.GetProjects(lem.GetEmployee.ID, DateTime.Now.Year.ToString(), | |||
|  |                                                  DateTime.Now.Month.ToString()); | |||
|  |         dv = lmDt.DefaultView; | |||
|  |         //本月通过数量  | |||
|  |         dv.RowFilter = "   pj_status in('" + | |||
|  |                        ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "')" + | |||
|  |                        " or pd_status in('" + ProjectDetailStatus.审核通过 + "','" + ProjectDetailStatus.考核通过 + "') "; | |||
|  |         lbpassed.Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  |         //本月未通过数量 | |||
|  |         dv.RowFilter = " pj_status like '%未通过%'  or pd_status  like '%未通过%'"; | |||
|  |         lbfailed.Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  | 
 | |||
|  |         //本月得分 | |||
|  |         dv.RowFilter = string.Empty; | |||
|  |         lmscore = 0; | |||
|  |         for (int i = 0; i < lmDt.Rows.Count; i++) | |||
|  |         { | |||
|  |             lmscore += Convert.ToDouble(lmDt.Rows[i]["pj_score"]); | |||
|  |         } | |||
|  | 
 | |||
|  |         lbscore.Text = lmscore.ToString(); | |||
|  | 
 | |||
|  |         //本月待提交数量 | |||
|  |         dv.RowFilter = "   pj_status in('" + | |||
|  |                 ProjectStatus.项目已分配 + "','" + ProjectStatus.新增未提交 + "')" + | |||
|  |                 " and pd_status in('" + ProjectDetailStatus.月度未提交 + "') "; | |||
|  |         lb4submit.Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  | 
 | |||
|  |         //本月待审核 | |||
|  |         lb4approve.Text = "0"; | |||
|  |         if (lem.CanShenHe || lem.CanYuShen) | |||
|  |         { | |||
|  |             lmDt = lpj.Get4ApproveList(lem.GetCanApproveDeptList(), DateTime.Now .Year.ToString(), | |||
|  |                                                     DateTime.Now .Month.ToString()); | |||
|  |             dv = lmDt.DefaultView; | |||
|  |             lb4approve.Text = dv.Count.ToString(); | |||
|  |         } | |||
|  |         if (lem.CanKaoHe) | |||
|  |         { | |||
|  |             dv = lpj.GetProjectsByYearMonth(DateTime.Now .Year.ToString(), DateTime.Now .Month.ToString()).DefaultView; | |||
|  |             dv.RowFilter = "pj_status in('" + ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "') and pd_status <>'" | |||
|  |                         + ProjectDetailStatus.考核通过 + | |||
|  |                     "' or pd_status in('" + ProjectDetailStatus.审核通过 + "')"; | |||
|  | 
 | |||
|  |             lb4approve.Text = (Convert.ToInt32(lb4preapprove.Text) + dv.Count).ToString(); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  |         //全年项目 | |||
|  | 
 | |||
|  | 
 | |||
|  |         lmDt = lpj.GetProject.GetProjects(lem.GetEmployee.ID, DateTime.Now.Year.ToString() ); | |||
|  |         dv = lmDt.DefaultView; | |||
|  |         //全年通过数量  | |||
|  |         dv.RowFilter = "   pj_status in('" + | |||
|  |                        ProjectStatus.新增审核通过 + "','" + ProjectStatus.项目完成 + "','" + ProjectStatus.删减审核通过 + "')" + | |||
|  |                        " or pd_status in('" + ProjectDetailStatus.审核通过 + "','" + ProjectDetailStatus.考核通过 + "') "; | |||
|  |         lbYearPassed .Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  |         //全年未通过数量 | |||
|  |         dv.RowFilter = " pj_status like '%未通过%'  or pd_status  like '%未通过%'"; | |||
|  |         lbYearFailed.Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  | 
 | |||
|  |         //全年得分 | |||
|  |         dv.RowFilter = string.Empty; | |||
|  |         lmscore = 0; | |||
|  |         for (int i = 0; i < lmDt.Rows.Count; i++) | |||
|  |         { | |||
|  |             lmscore += Convert.ToDouble(lmDt.Rows[i]["pj_score"]); | |||
|  |         } | |||
|  | 
 | |||
|  |         lbYearscore1.Text = lmscore.ToString(); | |||
|  | 
 | |||
|  |         //全年待提交数量 | |||
|  |         dv.RowFilter = "   pj_status in('" + | |||
|  |                 ProjectStatus.项目已分配 + "','" + ProjectStatus.新增未提交 + "')" + | |||
|  |                 " and pd_status in('" + ProjectDetailStatus.月度未提交 + "') "; | |||
|  |         lbyear4submit.Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  | 
 | |||
|  |     } | |||
|  |     */ | |||
|  |    /* | |||
|  |     void bindTrainingInfo() | |||
|  |     { | |||
|  | 
 | |||
|  |         DataTable dt = lem.GetLessons(lem.GetEmployee.ID); | |||
|  |         DataView dv  = dt.DefaultView; | |||
|  |         dv.RowFilter = "train_passed=1"; | |||
|  |         lbtpassed.Text = dv.Count.ToString(); | |||
|  |         dv.RowFilter = "train_passed=0 and le_enddate< '" + DateTime.Now.ToShortDateString() +"'"; | |||
|  |         lbtfailed.Text = dv.Count.ToString(); | |||
|  | 
 | |||
|  |         //总学分 | |||
|  |         decimal allScore = 0; | |||
|  | 
 | |||
|  |         for(int i=0;i<dt.Rows.Count;i++) | |||
|  |         { | |||
|  |             try | |||
|  |             { | |||
|  |                 if (dt.Rows[i]["le_xuefen"].ToString() != null) | |||
|  |                     allScore += Convert.ToDecimal(dt.Rows[0]["le_xuefen"].ToString()); | |||
|  |             } | |||
|  |             catch (Exception er) | |||
|  |             { | |||
|  |                 continue; | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         lbtxuefen.Text = allScore.ToString(); | |||
|  | 
 | |||
|  |         //取得学分 | |||
|  |         dv.RowFilter = "train_passed=1"; | |||
|  |         decimal passedScore = 0; | |||
|  |         for (int i = 0; i < dv.Count; i++) | |||
|  |         { | |||
|  |             try | |||
|  |             { | |||
|  |                 if (dv.Table.Rows[i]["le_xuefen"].ToString() != null) | |||
|  |                     passedScore += Convert.ToDecimal(dv.Table.Rows[0]["le_xuefen"].ToString()); | |||
|  |             } | |||
|  |             catch (Exception er) | |||
|  |             { | |||
|  |                 continue; | |||
|  |             } | |||
|  |         } | |||
|  |         lbtxuefenPassed.Text = passedScore.ToString(); | |||
|  | 
 | |||
|  | 
 | |||
|  |         //在修课程 | |||
|  | 
 | |||
|  |         dv.RowFilter = "train_passed=0 and le_enddate > '" + DateTime.Now.ToShortDateString() +"'"; | |||
|  |         lbt4learn.Text = dv.Count.ToString(); | |||
|  |     } | |||
|  |     */ | |||
|  |     void showOnlineUsers() | |||
|  |     { | |||
|  |         lbOnLineUserCnt.Text = ""; | |||
|  |         ArrayList al = lem.OnLineUsers; | |||
|  |         foreach (string s in al) | |||
|  |         { | |||
|  |             lbOnLineUserCnt.Text = lbOnLineUserCnt.Text + s + " <br>  "; | |||
|  |         } | |||
|  |     } | |||
|  | 
 | |||
|  |     protected void btn_save_Click(object sender, EventArgs e) | |||
|  |     { | |||
|  | 
 | |||
|  |         if(lem.GetEmployee.ValidUser(lem.GetEmployee.em_account, txtOldPasswd.Text)>0) | |||
|  |         { | |||
|  |             lem.GetEmployee.em_passwd = Util.Encrypt(txtNewPasswd.Text); | |||
|  |             lem.GetEmployee.Update(); | |||
|  |         } | |||
|  |        | |||
|  |          | |||
|  |         this.divPasswdChg.Visible = false; | |||
|  |     } | |||
|  |     protected void btn_cancel_Click(object sender, EventArgs e) | |||
|  |     { | |||
|  | 
 | |||
|  |         this.divPasswdChg.Visible = false; | |||
|  |     } | |||
|  |     protected void lkChgPswd_Click(object sender, EventArgs e) | |||
|  |     { | |||
|  | 
 | |||
|  |         this.divPasswdChg.Visible = !divPasswdChg.Visible; | |||
|  |     } | |||
|  |     /* | |||
|  |     protected void LinkButton1_Click(object sender, EventArgs e) | |||
|  |     { | |||
|  |         Response.Redirect("~/training/Lessonview.aspx"); | |||
|  |     } | |||
|  |     protected void LinkButton4_Click(object sender, EventArgs e) | |||
|  |     { | |||
|  |         Response.Redirect("~/training/Lessonview.aspx"); | |||
|  |     } | |||
|  |     protected void LinkButton2_Click(object sender, EventArgs e) | |||
|  |     { | |||
|  |         Response.Redirect("~/training/Lessonview.aspx"); | |||
|  |     } | |||
|  |     protected void LinkButton3_Click(object sender, EventArgs e) | |||
|  |     { | |||
|  |         Response.Redirect("~/training/Lessonview.aspx"); | |||
|  |     } | |||
|  |     */ | |||
|  |     protected void lkbtnusers_Click(object sender, EventArgs e) | |||
|  |     { | |||
|  |         divOnlineUsers.Visible = !divOnlineUsers.Visible; | |||
|  |     } | |||
|  | } |