public string GetTitleTemp()//1部门,2名字,3部门+名字 { WX.Main.CurUser.LoadMyDepartment(); if (Request["PlanId"] != null && Request["PlanId"] != "") { WX.Model.Plan.MODEL plan = WX.Request.rPlan; if (plan != null && plan.RangeType.ToInt32() == 2) { return(WX.Main.CurUser.MyDepartMent.Name.ToString()); } if (plan != null && plan.RangeType.ToInt32() == 3) { return("公司"); } } else if (Request["rtype"] != null && Request["rtype"] != "") { if (Request["rtype"] == "2") { return(WX.Main.CurUser.MyDepartMent.Name.ToString()); } if (Request["rtype"] == "3") { return("公司"); } } return(WX.Main.CurUser.MyDepartMent.Name.ToString() + WX.Main.CurUser.UserModel.RealName.ToString()); }
protected void Button1_Click(object sender, EventArgs e) { WX.Model.Plan.MODEL plan = WX.Request.rPlan; plan.Summary.value = TextBox1.Text.Trim(); plan.Update(); Response.Redirect("Plan_PlanDetail.aspx?PlanId=" + plan.id.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (Request["PlanId"] != null && Request["PlanId"] != "") { WX.Model.Plan.MODEL planmodel = WX.Request.rPlan; planmodel.PlanState.value = 1; planmodel.Update(); } userid = WX.Main.CurUser.UserID; WX.Main.CurUser.LoadDutyDetailUser(); if (WX.Main.CurUser.DutyDetailUser.GradeID.ToInt32() >= 30)//领导管理层 { rtype = "3"; deptuserid = WX.Main.CurUser.UserID; } else { string sSql = "select ID from TE_DutyDetail where DepartentID=" + WX.Model.User.GetCache(userid).DepartmentID.ToString() + " and DutyCatagoryID=1 and GradeID<30"; WX.Model.DutyDetail.MODEL dd = WX.Model.DutyDetail.GetModel(sSql); if (dd != null) { WX.Model.User.MODEL user = WX.Model.User.GetModel("select * from TU_Users where DutyId=" + dd.ID.ToString()); if (user != null) { deptuserid = user.UserID.ToString(); } } } }
public string GetTitleTemp()//1部门,2名字,3部门+名字 { WX.Main.CurUser.LoadMyDepartment(); if (Request["PlanId"] != null && Request["PlanId"] != "") { WX.Model.Plan.MODEL plan = WX.Request.rPlan; if (plan != null && plan.RangeType.ToInt32() == 2) { return(WX.Main.CurUser.MyDepartMent.Name.ToString()); } if (plan != null && plan.RangeType.ToInt32() == 3) { return("公司"); } } else if (Request["rtype"] != null && Request["rtype"] != "") { if (Request["rtype"] == "2") { return(WX.CommonUtils.GetDeptNameListByDeptIdList(Request["DeptId"]).Trim());//WX.Main.CurUser.MyDepartMent.Name.ToString(); } if (Request["rtype"] == "3") { return("公司"); } } if (Request["UserID"] != "") { WX.Model.User.MODEL usermodel = WX.Model.User.NewDataModel(Request["UserID"]); return(WX.CommonUtils.GetDeptNameListByDeptIdList(usermodel.DepartmentID.ToString()).Trim() + usermodel.RealName.ToString()); } return(WX.Main.CurUser.MyDepartMent.Name.ToString() + WX.Main.CurUser.UserModel.RealName.ToString()); }
private WX.Model.Plan.MODEL GetRequestedPlan() { WX.Model.Plan.MODEL plan = null; if (hiplanid.Value != "") { plan = WX.Model.Plan.GetModel(Convert.ToInt32(hiplanid.Value)); } else if (Request["PlanId"] != null) { plan = WX.Request.rPlan; } else if (Request["type"] != null && Request["starttime"] != null && Request["DeptId"] != null && Request["DeptID"] != "") { int rtype = 1; if (Request["rtype"] != null && Request["rtype"] != "") { rtype = Convert.ToInt32(Request["rtype"]); } plan = WX.Model.Plan.GetModel(WX.Request.rDeptId, Convert.ToDateTime(Request["starttime"]), Convert.ToInt32(Request["type"]), rtype); } else if (Request["type"] != null && Request["starttime"] != null && Request["UserID"] != null && Request["UserID"] != "") { int rtype = 1; if (Request["rtype"] != null && Request["rtype"] != "") { rtype = Convert.ToInt32(Request["rtype"]); } plan = WX.Model.Plan.GetModel(WX.Request.rUserId, Convert.ToDateTime(Request["starttime"]), Convert.ToInt32(Request["type"]), rtype); } return(plan); }
public string GetPlanID(int type, int rtype) { WX.Model.Plan.MODEL plan = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, DateTime.Now, type, rtype); if (plan != null) { return(plan.id.ToString()); } return(""); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WX.Model.Plan.MODEL plan = WX.Request.rPlan; lititle.Text = plan.Title.ToString(); lirealname.Text = WX.CommonUtils.GetRealNameListByUserIdList(plan.UserID.ToString()); licurr.Text = plan.Current.ToString(); litotal.Text = plan.Total.ToString(); licontent.Text = plan.Content.ToString(); litype.Text = plan.Type.ToString() == "3" ? "月计划" : (plan.Type.ToString() == "2" ? "周计划" : "日计划"); liStarttime.Text = plan.Starttime.ToDateTime().ToString("yyyy-MM-dd"); liStoptime.Text = plan.Stoptime.ToDateTime().ToString("yyyy-MM-dd"); TextBox1.Text = plan.Summary.ToString(); } }
private void gridviewBind(WX.Model.Plan.MODEL plan) { lititle.Text = plan.Title.ToString(); lititle.NavigateUrl = "#"; imgwidth = (Convert.ToDouble(plan.Current.ToString()) / Convert.ToDouble(plan.Total.ToString())) * 100; lijindu.Text = " 进度:" + imgwidth.ToString("f0") + "%"; licontent.Text = plan.Content.ToString().Replace("\n", "<br/>"); System.Data.DataTable dtApp = WX.Model.Appraise.GetList(plan.id.ToInt32()); Apptable.Text = ""; for (int i = 0; i < dtApp.Rows.Count; i++) { Apptable.Text += "<li><a title=\"" + dtApp.Rows[i]["Content"] + "\">" + WX.CommonUtils.GetRealNameListByUserIdList(dtApp.Rows[i]["UserID"].ToString()) + ":" + dtApp.Rows[i]["Content"] + " </a><img src=\"/images/Appraise" + dtApp.Rows[i]["Appraise"] + ".jpg\" /><span>" + Convert.ToDateTime(dtApp.Rows[i]["AddTime"]).ToString("yyyy-MM-dd") + "</span></li>"; } string now = DateTime.Now.ToString("yyyy-MM-dd"); WX.Main.CurUser.LoadDutyDetailUser(); if (plan.PlanState.ToInt32() == -1 && plan.UserID.ToString() == WX.Main.CurUser.UserID) { liPlanState.Text = "<b style='color:red;'>审核未通过</b>。原因:" + plan.Reason.ToString() + " <请重新编辑然后提交><br/>"; } //if (plan.Type.ToString() == "2") liSummary.Text = plan.Summary.ToString() == "" ? (DateTime.Now >= plan.Stoptime.ToDateTime().AddDays(-2) && plan.UserID.ToString() == WX.Main.CurUser.UserID ? "<b>总结:</b><a href='Plan_EditSummary.aspx?PlanId=" + plan.id.ToString() + "' style='color:blue;'>创建总结</a>" : "") : "<b>总结:</b>" + plan.Summary.ToString() + (plan.Appraise.ToString() == "" && plan.UserID.ToString() == WX.Main.CurUser.UserID ? "<a href='Plan_EditSummary.aspx?PlanId=" + plan.id.ToString() + "' style='color:blue;'>编辑</a>" : ""); //else if (plan.Type.ToString() == "3") // liSummary.Text = plan.Summary.ToString() == "" ? (DateTime.Now >= plan.Stoptime.ToDateTime().AddDays(-2) && plan.UserID.ToString() == WX.Main.CurUser.UserID ? "<b>总结:</b><a href='Plan_EditSummary.aspx?PlanId=" + plan.id.ToString() + "' style='color:blue;'>创建总结</a>" : "") : "<b>总结:</b>" + plan.Summary.ToString() + (plan.Appraise.ToString() == "" && plan.UserID.ToString() == WX.Main.CurUser.UserID ? "<a href='Plan_EditSummary.aspx?PlanId=" + plan.id.ToString() + "' style='color:blue;'>编辑</a>" : ""); liAppraise.Text = plan.Appraise.ToString() == "" ? (!plan.Summary.isEmpty && WX.Main.CurUser.DutyDetailUser.DutyCatagoryID.ToInt32() == 1 ? "<br/><b>评价:</b><a href='Plan_EditAppraise.aspx?PlanId=" + plan.id.ToString() + "' style='color:blue;'>现在点评</a>" : "") : "<br/><b>评价:</b>" + plan.Appraise.ToString(); string wherestr = " where PlanID=" + plan.id.ToString(); System.Data.DataTable dt = ULCode.QDA.XSql.GetDataTable("select * from PLAN_Task" + wherestr + " order by id"); Gv_duty.DataSource = dt; Gv_duty.DataBind(); if (Request["estate"] != null) { Gv_duty.Columns[2].Visible = true; } if (plan.Type.ToInt32() < 3) { divjd.Visible = false; } if (plan.PlanState.ToInt32() < 2) { Gv_duty.Columns[2].Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WX.Model.Plan.MODEL plan = this.GetRequestedPlan(); if (plan != null) { this.LoadProgressBarState(plan); this.gridviewBind(plan); } else { div1.Visible = false; Response.Write("<br/><center><font style='color:black;font-weight:bold;'>计划还没有创建!</font></center><br/>"); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WX.Model.Plan.MODEL plan = WX.Request.rPlan; lititle.Text = plan.Title.ToString(); lirealname.Text = WX.CommonUtils.GetRealNameListByUserIdList(plan.UserID.ToString()); licurr.Text = plan.Current.ToString(); litotal.Text = plan.Total.ToString(); licontent.Text = plan.Content.ToString(); litype.Text = plan.Type.ToString() == "3"?"月计划":(plan.Type.ToString() == "2"?"周计划":"日计划"); liStarttime.Text = plan.Starttime.ToDateTime().ToString("yyyy-MM-dd"); liStoptime.Text = plan.Stoptime.ToDateTime().ToString("yyyy-MM-dd"); Button2.OnClientClick = "butsumit('" + Request["page"] + ".aspx');"; BindTask(); } }
protected void Page_Load(object sender, EventArgs e) { if (Request["PlanId"] != null && Request["PlanId"] != "") { WX.Model.Plan.MODEL planmodel = WX.Request.rPlan; planmodel.PlanState.value = 1; planmodel.Update(); } if (Request["date"] != null && Request["date"] != "") { DateTime dt = Convert.ToDateTime(Request["date"]); Hidmonth.Value = dt.Month.ToString(); Hidday.Value = dt.Day.ToString(); } else { DateTime dt = DateTime.Now; Hidmonth.Value = dt.Month.ToString(); Hidday.Value = dt.Day.ToString(); } if (Request["rtype"] != null && Request["rtype"] != "") { rtype = Request["rtype"]; if (rtype == "2") { this.MenuBar1.Key = "plan_dept"; } else if (rtype == "3") { this.MenuBar1.Key = "plan_cmp"; } } if (Request["type"] != null && Request["type"] != "") { type = Request["type"]; } //WX.Model.DutyDetail.MODEL dd = WX.Model.DutyDetail.GetModel("select * from TE_DutyDetail where Id=" + WX.Main.CurUser.UserModel.DutyId.ToString()); //if (dd != null && dd.GradeID.ToInt32()<30)//领导管理层 //{ // MenuBar1.Key = "plan_cmp"; //} }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { WX.Model.Plan.MODEL plan = WX.Request.rPlan; lititle.Text = plan.Title.ToString(); lirealname.Text = WX.CommonUtils.GetRealNameListByUserIdList(plan.UserID.ToString()); licurr.Text = plan.Current.ToString(); litotal.Text = plan.Total.ToString(); licontent.Text = plan.Content.ToString(); litype.Text = plan.Type.ToString() == "3" ? "月计划" : (plan.Type.ToString() == "2" ? "周计划" : "日计划"); liStarttime.Text = plan.Starttime.ToDateTime().ToString("yyyy-MM-dd"); liStoptime.Text = plan.Stoptime.ToDateTime().ToString("yyyy-MM-dd"); lisummary.Text = plan.Summary.ToString(); string wherestr = " where PlanID=" + plan.id.ToString(); System.Data.DataTable dt = ULCode.QDA.XSql.GetDataTable("select * from PLAN_Task" + wherestr + " order by id"); Gv_duty.DataSource = dt; Gv_duty.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.LoadNote(); int rtype = Convert.ToInt32(Request["rtype"]); if (Request["dept"] != null) { this.MenuBar1.Key = "plan_cmp_dept"; this.MenuBar1.Param1 = "{Q:dept}"; } if (rtype == 2) { this.MenuBar1.Key = "plan_dept"; } else if (rtype == 3) { this.MenuBar1.Key = "plan_cmp"; } if (Request["type"] != null && Request["type"] != "") { typestr = Request["type"]; MenuBar1.CurIndex = Convert.ToInt32(typestr) + 1; } if (Request["PlanId"] != null && Request["PlanId"] != "") { WX.Model.Plan.MODEL planmodel = WX.Request.rPlan; planmodel.PlanState.value = 1; planmodel.Update(); } // WX.Model.DutyDetail.MODEL dd = WX.Model.DutyDetail.GetModel("select * from TE_DutyDetail where Id=" + WX.Main.CurUser.UserModel.DutyId.ToString()); //if (dd != null && dd.GradeID.ToInt32()<30)//领导管理层 //{ // MenuBar1.Key = "plan_cmp"; //} } }
protected void Gv_List_RowCommand(object sender, GridViewCommandEventArgs e) { //1.验证用户权限 //2.取得主键变量 string id = e.CommandArgument.ToString(); if (e.CommandName == "editstate") { WX.Main.ExcuteUpdate("PLAN_Task", "State=1,Statetime=getdate()", "id=" + id); WX.Main.AddLog(WX.LogType.Default, String.Format("任务状态({0})修改成功!", id), ""); } //5.(用户及业务对象)统计与状态 //7.返回处理结果或返回其它页面。 WX.Model.Plan.MODEL plan = this.GetRequestedPlan(); if (plan != null) { this.LoadProgressBarState(plan); this.gridviewBind(plan); } }
private void Pageinit() { if (Request["PlanId"] != null && Request["PlanId"] != "") { WX.Model.Plan.MODEL planmodel = WX.Request.rPlan; planmodel.PlanState.value = 1; planmodel.Update(); } userid = WX.Main.CurUser.UserID; WX.Main.CurUser.LoadDutyDetailUser(); if (WX.Main.CurUser.DutyDetailUser.GradeID.ToInt32() >= 30)//领导管理层 { rtype = "3"; deptuserid = WX.Main.CurUser.UserID; Div3.InnerHtml = "<img alt=\"个人计划\" src=\"/Images/UserPlan.gif\" />公司本周计划"; Div4.InnerHtml = "<img alt=\"部门计划\" src=\"/Images/DeptPlan.gif\" />公司本月计划"; } else { string sSql = "select ID from TE_DutyDetail where DepartentID=" + WX.Model.User.GetCache(userid).DepartmentID.ToString() + " and DutyCatagoryID=1 and GradeID<30"; WX.Model.DutyDetail.MODEL dd = WX.Model.DutyDetail.GetModel(sSql); if (dd != null) { WX.Model.User.MODEL user = WX.Model.User.GetModel("select * from TU_Users where DutyId=" + dd.ID.ToString()); if (user != null) { deptuserid = user.UserID.ToString(); } } } WX.Model.Plan.MODEL planday = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, DateTime.Now, 1, 1); dayedit.Text = planday != null ?(planday.PlanState.ToInt32() == 0? "<a href='?PlanId=" + planday.id.ToString() + "'>提交审核</a> ":"") + (planday.PlanState.ToInt32() < 1?"<a href='Plan_EditPlan.aspx?PlanId=" + planday.id.ToString() + "'>编辑</a>":""): "<a href='Plan_EditPlan.aspx?type=1'>创建</a>"; WX.Model.Plan.MODEL planweek = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, DateTime.Now, 2, 1); weekedit.Text = planweek != null ? (planweek.PlanState.ToInt32() == 0 ? "<a href='?PlanId=" + planweek.id.ToString() + "'>提交审核</a> " : "") + (planweek.PlanState.ToInt32() < 1 ? "<a href='Plan_EditPlan.aspx?PlanId=" + planweek.id.ToString() + "'>编辑</a>":"") : "<a href='Plan_EditPlan.aspx?type=2'>创建</a>"; WX.Model.Plan.MODEL planmonth = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, DateTime.Now, 3, 1); monthedit.Text = planmonth != null ? (planmonth.PlanState.ToInt32() == 0 ? "<a href='?PlanId=" + planmonth.id.ToString() + "'>提交审核</a> " : "") + (planmonth.PlanState.ToInt32() < 1? "<a href='Plan_EditPlan.aspx?PlanId=" + planmonth.id.ToString() + "'>编辑</a>":"") : "<a href='Plan_EditPlan.aspx?type=3'>创建</a>"; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //添加功能标题 this.LoadTitleObject(); this.LoadRBType(); if (Request["PlanId"] != null && Request["PlanId"] != "") { WX.Model.Plan.MODEL plan = WX.Request.rPlan; //plantype.Items.Add(new ListItem("月计划", "3")); //plantype.Items.Add(new ListItem("周计划", "2")); //plantype.Items.Add(new ListItem("日计划", "1")); //plantype.Enabled = false; //plantype.SelectedValue = plan.Type.ToString(); this.rbPlanType.SelectedValue = plan.Type.ToString(); this.rbPlanType.Enabled = false; table2.Visible = true; plantitle.Text = plan.Title.ToString(); planCurrent.Text = plan.Current.ToString(); planTotle.Text = plan.Total.ToString(); planContent.Text = plan.Content.ToString(); planid = plan.id.ToString(); if (plan.RangeType.ToInt32() > 1) { planrtype.Visible = true; planrtype.SelectedValue = plan.RangeType.ToString(); } MenuBar1.Key = plan.RangeType.ToString() == "2" ? "plan_dept" : (plan.RangeType.ToString() == "3" ? "plan_cmp" : MenuBar1.Key); MenuBar1.CurIndex = 0;// plan.RangeType.ToInt32() > 1 ? 6 : MenuBar1.CurIndex; } else { int rtype = this.rRType; //WX.Model.Plan.MODEL planmonth = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate, 3, rtype); //if (planmonth == null) // plantype.Items.Add(new ListItem("月计划", "3")); //WX.Model.Plan.MODEL planweek = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate, 2, rtype); //if (planweek == null) // plantype.Items.Add(new ListItem("周计划", "2")); //if (rtype == 1) //{ // WX.Model.Plan.MODEL planday = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate, 1, rtype); // if (planday == null) // plantype.Items.Add(new ListItem("日计划", "1")); //} if (this.rbPlanType.SelectedIndex == -1) { Button1.Enabled = false; //Button1.Text = (rtype == 1 ? "今天的计划已经创建,请明天再来" : "本周计划已经创建,请下周再来"); } else if (Request["type"] != null && Request["type"] != "" && this.rbPlanType.Items.FindByValue(Request["type"]) != null) { this.rbPlanType.SelectedValue = Request["type"]; } if (Request["rtype"] != null && Request["rtype"] != "") { planrtype.Visible = true; planrtype.SelectedValue = Request["rtype"]; MenuBar1.Key = Request["rtype"] == "2" ? "plan_dept" : "plan_cmp"; MenuBar1.CurIndex = 6; } //mes = "settitle()"; } } }
private void PageInit() { Image1.ImageUrl = "/images/rtype" + Request["rtype"] + ".png"; Image2.ImageUrl = "/images/type" + Request["type"] + ".png"; if (Request["rtype"] == "3") { RealName.Text = Image1.ToolTip = "公司"; } else if (Request["DeptId"] != null && Request["DeptId"] != "") { RealName.Text = WX.CommonUtils.GetDeptNameListByDeptIdList(Request["DeptId"]).Trim(); Image1.ToolTip = "部门"; } else { Image1.ToolTip = "个人"; RealName.Text = WX.CommonUtils.GetRealNameListByUserIdList(WX.Request.rUserId); } if (Request["type"] != null) { switch (Request["type"]) { case "1": PlanType.Text = Image2.ToolTip = "日"; this.liDatetime.Text = String.Format("{0:yyyy年MM月dd日 dddd}", Convert.ToDateTime(Request["starttime"])); Button1.CssClass = rDate.Date >= DateTime.Now.AddDays(-1).Date ? Button1.CssClass : "button0"; litip.Text = (rDate.Date >= DateTime.Now.AddDays(-1).Date ? "请提交日计划。" : "日计划已过期!!"); litip2.Text = (rDate.Day >= DateTime.Now.Day ? "请提交日总结。" : "日总结已过期!!"); break; case "2": PlanType.Text = Image2.ToolTip = "周"; this.liDatetime.Text = new WX.Model.Plan.Day(Convert.ToDateTime(Request["starttime"])).ToWeekDayStr(); Button1.CssClass = WX.Date.Week.GetWeekOfYear(rDate) >= WX.Date.Week.GetWeekOfYear(DateTime.Now) ? Button1.CssClass : "button0"; litip.Text = "周计划-请在每周周一前提交。"; litip2.Text = "周总结-请在每周周五后提交。"; break; case "3": PlanType.Text = Image2.ToolTip = "月"; this.liDatetime.Text = String.Format("{0:yyyy年MM月}", Convert.ToDateTime(Request["starttime"])); Button1.CssClass = rDate.Month >= DateTime.Now.Month ? Button1.CssClass : "button0"; litip.Text = "月计划-请在27日-3日前提交月计划。"; litip2.Text = "月总结-请在27日后提交月总结。"; break; case "4": PlanType.Text = Image2.ToolTip = "年"; this.liDatetime.Text = String.Format("{0:yyyy年}", Convert.ToDateTime(Request["starttime"])); litip.Text = "年计划-请提交本年计划。"; litip2.Text = "年总结-请提交本年总结。"; break; //case "5": PlanType.Text = "下周"; break; //case "6": PlanType.Text = "下月"; break; default: break; } Image2.ToolTip += "计划"; } WX.Model.Plan.MODEL plan = this.GetRequestedPlan(); int plantype; if (plan != null) { // radioType.Enabled = false; hiplanid.Value = plan.id.ToString(); txtTotal.Text = plan.Total.ToString(); txtCurrent.Text = plan.Current.ToString(); txtSummary.Text = plan.Summary.ToString(); txtContent.Text = plan.Content.ToString(); txtTitle.Text = plan.Title.ToString(); //radioType.SelectedValue = plan.Type.ToString(); plantype = plan.Type.ToInt32(); DateTime nowdt = DateTime.Now; if (plan.Type.ToInt32() == 3) { txtTitle.ReadOnly = txtTotal.ReadOnly = txtContent.ReadOnly = nowdt.Day > 4; txtSummary.ReadOnly = nowdt.Day < 26; } if (plan.Type.ToInt32() == 2) { txtTitle.ReadOnly = txtTotal.ReadOnly = txtContent.ReadOnly = Convert.ToInt32(nowdt.DayOfWeek.ToString("d")) >= 2; txtSummary.ReadOnly = Convert.ToInt32(nowdt.DayOfWeek.ToString("d")) <= 4; } if (txtContent.ReadOnly && txtSummary.ReadOnly) { Button1.CssClass = "button0"; } AppraiseBind(plan.id.ToInt32()); } else { plantype = Convert.ToInt32(Request["type"]); //radioType.SelectedValue = plantype.ToString(); // txtSummary.ReadOnly = true; switch (plantype) { case 1: this.txtTitle.Text = String.Format("{0} {1:yyyy}年Q{2}-{1:MM月dd日}", this.GetTitleTemp(), rDate, WX.Date.Season.GetSeasonFromMonth(rDate.Month)); break; case 2: this.txtTitle.Text = String.Format("{0} {1:yyyy}年Q{2}-{1:MM}-{3}周", this.GetTitleTemp(), rDate, WX.Date.Season.GetSeasonFromMonth(rDate.Month), WX.Date.Week.GetWeekOfYear(rDate)); break; case 3: this.txtTitle.Text = String.Format("{0} {1:yyyy}年Q{2}-{1:MM月}", this.GetTitleTemp(), rDate, WX.Date.Season.GetSeasonFromMonth(rDate.Month)); break; //case 4: this.txtTitle.Text = String.Format("{0} {1:yyyy}年Q{2}-{1:MM月dd日}", this.GetTitleTemp(), rDate.AddDays(1), WX.Date.Season.GetSeasonFromMonth(rDate.AddDays(1).Month)); break; //case 5: this.txtTitle.Text = String.Format("{0} {1:yyyy}年Q{2}-{1:MM}-{3}周", this.GetTitleTemp(), rDate.AddDays(7), WX.Date.Season.GetSeasonFromMonth(rDate.AddDays(1).Month), WX.Date.Week.GetWeekOfYear(rDate.AddDays(7))); break; //case 6: this.txtTitle.Text = String.Format("{0} {1:yyyy}年Q{2}-{1:MM月}", this.GetTitleTemp(), rDate.AddMonths(1), WX.Date.Season.GetSeasonFromMonth(rDate.AddDays(1).Month)); break; } appraisal.Visible = false; } //Button1.CssClass = "button1"; txtContent.ReadOnly = txtSummary.ReadOnly = false; if (Request["estate"] == null || Request["estate"] == "") { Button1.CssClass = "button0"; } else { appraisal.Visible = false; } // Button1.Enabled = Button1.CssClass == "button1"; }
protected void Button1_Click(object sender, EventArgs e) { if (hiplanid.Value != "") { WX.Model.Plan.MODEL plan = this.GetRequestedPlan(); try { plan.Total.value = txtTotal.Text.Trim() == "" ? 0 : Convert.ToInt32(txtTotal.Text); } catch { plan.Total.value = 0; } try { plan.Current.value = txtCurrent.Text.Trim() == "" ? 0 : Convert.ToInt32(txtCurrent.Text); } catch { plan.Current.value = 0; } plan.Title.value = txtTitle.Text.Trim(); plan.Content.value = txtContent.Text.Trim(); plan.Summary.value = txtSummary.Text.Trim(); plan.Update(); WX.Main.AddLog(WX.LogType.Default, "修改计划!", String.Format("{0}", plan.Title.ToString())); } else { WX.Model.Plan.MODEL plan = WX.Model.Plan.NewDataModel(); try { plan.Total.value = txtTotal.Text.Trim() == "" ? 0 : Convert.ToInt32(txtTotal.Text); } catch { plan.Total.value = 0; } try { plan.Current.value = txtCurrent.Text.Trim() == "" ? 0 : Convert.ToInt32(txtCurrent.Text); } catch { plan.Current.value = 0; } plan.Title.value = txtTitle.Text.Trim(); plan.Content.value = txtContent.Text.Trim(); plan.Summary.value = txtSummary.Text.Trim(); if (Request["UserID"] != null && Request["UserID"] != "") { WX.Model.User.MODEL user = WX.Request.rUser; plan.UserID.value = user.UserID.value; plan.DepartmentID.value = user.DepartmentID.value; } else { plan.UserID.value = WX.Main.CurUser.UserID; plan.DepartmentID.value = Request["DeptId"]; } plan.Type.value = Request["type"]; plan.RangeType.value = Request["rtype"] != null && Request["rtype"] != "" ? Request["rtype"] : "1"; switch (Request["type"]) { //case "6": plan.Starttime.value = rDate.AddMonths(1).ToString("yyyy-MM-01"); plan.Stoptime.value = DateTime.Parse(plan.Starttime.ToString()).AddDays(DateTime.DaysInMonth(rDate.AddMonths(1).Year, rDate.AddMonths(1).Month) - 1); break; //case "5": DateTime now = rDate.AddDays(7); now = now.AddDays(-(Convert.ToInt32(now.DayOfWeek) > 0 ? Convert.ToInt32(now.DayOfWeek) : 7)); plan.Starttime.value = now.ToString("yyyy-MM-dd"); plan.Stoptime.value = now.AddDays(6).ToString("yyyy-MM-dd"); break; //case "4": plan.Starttime.value = rDate.AddDays(1).ToString("yyyy-MM-dd"); plan.Stoptime.value = plan.Starttime.value; break; case "3": plan.Starttime.value = rDate.ToString("yyyy-MM-01"); plan.Stoptime.value = DateTime.Parse(plan.Starttime.ToString()).AddDays(DateTime.DaysInMonth(rDate.Year, rDate.Month) - 1); break; case "2": DateTime now1 = rDate; now1 = now1.AddDays(-(Convert.ToInt32(now1.DayOfWeek) > 0 ? Convert.ToInt32(now1.DayOfWeek) : 7)); plan.Starttime.value = now1.ToString("yyyy-MM-dd"); plan.Stoptime.value = now1.AddDays(6).ToString("yyyy-MM-dd"); break; case "1": plan.Starttime.value = rDate.ToString("yyyy-MM-dd"); plan.Stoptime.value = plan.Starttime.value; break; default: break; } if (plan.Type.ToInt32() > 3) { plan.Type.set(plan.Type.ToInt32() - 3); } int id = plan.Insert(true); hiplanid.Value = id.ToString();; WX.Main.AddLog(WX.LogType.Default, "创建计划!", String.Format("{0}", plan.Title.ToString())); } ULCode.Debug.Alert(this, "保存成功!"); }
private void LoadProgressBarState(WX.Model.Plan.MODEL plan) { //日计划 if (plan.Type.ToInt32() == 1) { //隐然总结与评价 this.Label3.Visible = false; this.Label4.Visible = false; //过了时间就完成 if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days > 0) { this.SetProgressBarState(5); } //如果计划不过期,状态为-1,则计划为未通过。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days <= 0 && plan.PlanState.ToInt32() == -1) { this.Label2.Text = "未通过"; this.SetProgressBarState(2); } //如果计划不过期,状态为2,则计划为执行中。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days <= 0 && plan.PlanState.ToInt32() == 2) { this.Label2.Text = "执行中"; this.SetProgressBarState(2); } //如果计划不过期,状态为1, 则计划为审核中。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days <= 0 && plan.PlanState.ToInt32() == 1) { this.SetProgressBarState(1); } //如果计划不过期,状态为0,则计划为创建中。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days <= 0 && plan.PlanState.ToInt32() == 0) { this.SetProgressBarState(0); } } //周计划与月计划 else { //1.如果计划过了期,总结也有,评价也有,则计划为完成。 if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days >= -2 && !plan.Summary.isEmpty && !plan.Appraise.isEmpty) { this.SetProgressBarState(5); } //2.如果计划过了期,总结也有,评价没有,则计划为待评价。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days >= -2 && !plan.Summary.isEmpty && plan.Appraise.isEmpty) { this.SetProgressBarState(4); } //3.如果计划过了期,总结也有,评价没有,则计划为待总结。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days >= -2 && plan.Summary.isEmpty && plan.Appraise.isEmpty) { this.SetProgressBarState(3); } //4.如果计划不过期,状态为-1,则计划为未通过。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days < 0 && plan.PlanState.ToInt32() == -1) { this.Label2.Text = "未通过"; this.SetProgressBarState(2); } //5.如果计划不过期,状态为2,则计划为执行中。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days < 0 && plan.PlanState.ToInt32() == 2) { this.Label2.Text = "执行中"; this.SetProgressBarState(2); } //6.如果计划不过期,状态为1, 则计划为审核中。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days < 0 && plan.PlanState.ToInt32() == 1) { this.SetProgressBarState(1); } //7.如果计划不过期,状态为0,则计划为创建中。 else if ((DateTime.Now - plan.Stoptime.ToDateTime()).Days < 0 && plan.PlanState.ToInt32() == 0) { this.SetProgressBarState(0); } } }
private void LoadRBType() { int rtype = this.rRType; WX.Model.Plan.MODEL planmonth = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate, 3, rtype); if (true) { ListItem li = new ListItem("月计划", "3"); li.Enabled = (planmonth == null); if (!li.Enabled) { li.Attributes.CssStyle.Add(HtmlTextWriterStyle.TextDecoration, "line-through"); } this.rbPlanType.Items.Add(li); } WX.Model.Plan.MODEL planweek = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate, 2, rtype); if (true) { ListItem li = new ListItem("周计划", "2"); li.Enabled = (planweek == null); if (!li.Enabled) { li.Attributes.CssStyle.Add(HtmlTextWriterStyle.TextDecoration, "line-through"); } this.rbPlanType.Items.Add(li); } if (rtype == 1) { WX.Model.Plan.MODEL planday = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate, 1, rtype); if (true) { ListItem li = new ListItem("日计划", "1"); li.Enabled = planday == null; if (!li.Enabled) { li.Attributes.CssStyle.Add(HtmlTextWriterStyle.TextDecoration, "line-through"); } this.rbPlanType.Items.Add(li); } } WX.Model.Plan.MODEL planmonth1 = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate.AddMonths(1), 3, rtype); if (true) { ListItem li = new ListItem("下月计划", "6"); li.Enabled = planmonth1 == null; if (!li.Enabled) { li.Attributes.CssStyle.Add(HtmlTextWriterStyle.TextDecoration, "line-through"); } this.rbPlanType.Items.Add(li); } WX.Model.Plan.MODEL planweek1 = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate.AddDays(7), 2, rtype); if (true) { ListItem li = new ListItem("下周计划", "5"); li.Enabled = planweek1 == null; if (!li.Enabled) { li.Attributes.CssStyle.Add(HtmlTextWriterStyle.TextDecoration, "line-through"); } this.rbPlanType.Items.Add(li); } if (rtype == 1) { WX.Model.Plan.MODEL planday1 = WX.Model.Plan.GetModel(WX.Main.CurUser.UserID, this.rDate.AddDays(1), 1, rtype); if (true) { ListItem li = new ListItem("明天计划", "4"); li.Enabled = planday1 == null && rtype == 1; if (!li.Enabled) { li.Attributes.CssStyle.Add(HtmlTextWriterStyle.TextDecoration, "line-through"); } this.rbPlanType.Items.Add(li); } } }
protected void Button1_Click(object sender, EventArgs e) { //获取用户变量 string title = this.plantitle.Text; string total = this.planTotle.Text; string current = this.planCurrent.Text; string content = this.planContent.Text; //验证 if (String.IsNullOrEmpty(title) || String.IsNullOrEmpty(content)) { ULCode.Debug.Alert(this, "标题与内容不能为空!"); return; } if (!ULCode.Validation.IsNumber(total) || !ULCode.Validation.IsNumber(current)) { ULCode.Debug.Alert(this, "预期数量与完成数量必须为数字"); return; } //操作 WX.Model.Plan.MODEL plan = null; if (Request["PlanId"] != null && Request["PlanId"] != "") { plan = WX.Request.rPlan; } else { plan = WX.Model.Plan.NewDataModel(); } plan.Title.value = plantitle.Text; plan.Total.value = planTotle.Text; plan.Current.value = planCurrent.Text; plan.Content.value = planContent.Text; plan.PlanState.value = 0; if (Request["PlanId"] != null && Request["PlanId"] != "") { plan.Update(); ULCode.Debug.Alert(this, "提交成功!", (plan.RangeType.ToInt32() == 1 ? "Plan_MyPlan.aspx" : "Plan_DeptPlan.aspx?type=" + plan.Type.ToString())); } else { WX.Main.CurUser.LoadUserModel(false); plan.UserID.value = WX.Main.CurUser.UserModel.UserID.ToString(); plan.DepartmentID.value = WX.Main.CurUser.UserModel.DepartmentID.ToString(); switch (this.rbPlanType.SelectedValue) { case "6": plan.Starttime.value = rDate.AddMonths(1).ToString("yyyy-MM-01"); plan.Stoptime.value = DateTime.Parse(plan.Starttime.ToString()).AddDays(DateTime.DaysInMonth(rDate.AddMonths(1).Year, rDate.AddMonths(1).Month) - 1); break; case "5": DateTime now = rDate.AddDays(7); now = now.AddDays(-(Convert.ToInt32(now.DayOfWeek) > 0 ? Convert.ToInt32(now.DayOfWeek) : 7)); plan.Starttime.value = now.ToString("yyyy-MM-dd"); plan.Stoptime.value = now.AddDays(6).ToString("yyyy-MM-dd"); break; case "4": plan.Starttime.value = rDate.AddDays(1).ToString("yyyy-MM-dd"); plan.Stoptime.value = plan.Starttime.value; break; case "3": plan.Starttime.value = rDate.ToString("yyyy-MM-01"); plan.Stoptime.value = DateTime.Parse(plan.Starttime.ToString()).AddDays(DateTime.DaysInMonth(rDate.Year, rDate.Month) - 1); break; case "2": DateTime now1 = rDate; now1 = now1.AddDays(-(Convert.ToInt32(now1.DayOfWeek) > 0 ? Convert.ToInt32(now1.DayOfWeek) : 7)); plan.Starttime.value = now1.ToString("yyyy-MM-dd"); plan.Stoptime.value = now1.AddDays(6).ToString("yyyy-MM-dd"); break; case "1": plan.Starttime.value = rDate.ToString("yyyy-MM-dd"); plan.Stoptime.value = plan.Starttime.value; break; default: break; } plan.Type.value = this.rbPlanType.SelectedValue; if (plan.Type.ToInt32() > 3) { plan.Type.set(plan.Type.ToInt32() - 3); } if (Request["rtype"] != null && Request["rtype"] != "") { plan.RangeType.value = planrtype.SelectedValue; } else { plan.RangeType.value = 1; } int id = plan.Insert(true); ULCode.Debug.Alert(this, "计划提交成功!请添加计划任务,完成后在[我的计划]默认页提交审核!", "Plan_EditPlan.aspx?PlanId=" + id); } }