Example #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         this.btnSave.Attributes["onclick"] = "return CheckEmpty()";
         if (DateTime.Now.DayOfWeek >= DayOfWeek.Friday)
         {
             this.txtWPlanDate.Text = Common2.GetTime(DateTime.Now.AddDays((double)(5 - Convert.ToInt32(DateTime.Now.DayOfWeek))));
         }
         else
         {
             this.txtWPlanDate.Text = Common2.GetTime(DateTime.Now.AddDays((double)(-(double)(Convert.ToInt32(DateTime.Now.DayOfWeek) + 2))));
         }
         if (base.Request.QueryString["Action"] == "Add")
         {
             this.txtReportUser.Text = new MainPlanAndAction().BackUserName(base.UserCode);
             this.txtPart.Text       = MainPlanAndAction.BackDeptOrID(base.UserCode)[1];
             this.txtDuty.Text       = new MainPlanAndAction().BackUserName(base.UserCode);
             string text      = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00");
             string sqlString = string.Concat(new string[]
             {
                 "select max(WkpUserCode) from pm_workplan_weekplan where wkpreporttype=",
                 base.Request.QueryString["planType"].ToString(),
                 "and wkpreportuser='******'and WkpUserCode LIKE '%",
                 text,
                 "%'"
             });
             DataTable dataTable = publicDbOpClass.DataTableQuary(sqlString);
             if (dataTable.Rows.Count > 0)
             {
                 if (string.IsNullOrEmpty(dataTable.Rows[0][0].ToString()))
                 {
                     this.txtWPcode.Text = text + "001";
                 }
                 else
                 {
                     int num = Convert.ToInt32(dataTable.Rows[0][0].ToString().Substring(8, 3)) + 1;
                     if (num < 10)
                     {
                         this.txtWPcode.Text = text + "00" + num.ToString();
                     }
                     else
                     {
                         if (num < 100)
                         {
                             this.txtWPcode.Text = text + "0" + num.ToString();
                         }
                         else
                         {
                             this.txtWPcode.Text = text + num.ToString();
                         }
                     }
                 }
             }
             else
             {
                 this.txtWPcode.Text = text + "001";
             }
         }
         if (base.Request["action"] == null)
         {
             this.Page.ClientScript.RegisterStartupScript(base.GetType(), "", "alert('参数错误,本页无法正常显示')", true);
             return;
         }
         if (base.Request["action"] == "Edit")
         {
             MainPlan          model             = new MainPlanAndAction().GetModel(new Guid(base.Request.QueryString["wkpId"]));
             MainPlanAndAction mainPlanAndAction = new MainPlanAndAction();
             this.txtWPcode.ReadOnly = true;
             this.txtWPcode.ToolTip  = "单号是不允许编辑的";
             this.txtWPcode.Text     = model.WkpUserCode;
             this.txtPart.Text       = mainPlanAndAction.BackDept(model.WkpDeptId);
             this.txtReportUser.Text = mainPlanAndAction.BackUserName(model.WkpReportUser);
             string    sqlString2 = "select wkpremarks from pm_workplan_plansummary where wkpid='" + new Guid(base.Request.QueryString["wkpid"].ToString()) + "'";
             DataTable dataTable2 = publicDbOpClass.DataTableQuary(sqlString2);
             this.txtProduce.Text   = ((dataTable2.Rows.Count > 0) ? PlanDetailAction.DeCodeStr(dataTable2.Rows[0][0].ToString()) : "");
             this.txtWPlanDate.Text = Common2.GetTime(model.WkpRecordDate);
             string    sqlString3 = "select * from pm_workplan_weekplandetails where WkpId='" + base.Request.QueryString["wkpId"].ToString() + "'";
             DataTable dataTable3 = publicDbOpClass.DataTableQuary(sqlString3);
             int       count      = dataTable3.Rows.Count;
             int       count2     = dataTable3.Columns.Count;
             this.hdnDataCount.Value = count.ToString();
             List <PlanDetail> planDemos = new PlanDetailAction().GetPlanDemos(new Guid(base.Request.QueryString["wkpId"]));
             if (count > 0)
             {
                 this.txtContent.Text        = PlanDetailAction.DeCodeStr(planDemos[0].WkpContents);
                 this.txtDuty.Text           = planDemos[0].WkpChief;
                 this.txtResponsibility.Text = planDemos[0].WkpPersons;
                 this.BeginDate.Text         = planDemos[0].WkpStartTime.ToShortDateString();
                 this.EndDate.Text           = planDemos[0].WkpEndTime.ToShortDateString();
                 for (int i = 1; i < count; i++)
                 {
                     for (int j = 0; j < count2; j++)
                     {
                         if (j == count2 - 1)
                         {
                             HtmlInputHidden expr_581 = this.hdnvalue;
                             expr_581.Value = expr_581.Value + dataTable3.Rows[i][j].ToString() + "?";
                         }
                         else
                         {
                             if (j == 3 || j == 4)
                             {
                                 HtmlInputHidden expr_5C5 = this.hdnvalue;
                                 expr_5C5.Value = expr_5C5.Value + DateTime.Parse(dataTable3.Rows[i][j].ToString()) + "|";
                             }
                             else
                             {
                                 if (j == 2)
                                 {
                                     HtmlInputHidden expr_60B = this.hdnvalue;
                                     expr_60B.Value = expr_60B.Value + PlanDetailAction.DeCodeStr(dataTable3.Rows[i][j].ToString()) + "|";
                                 }
                                 else
                                 {
                                     HtmlInputHidden expr_647 = this.hdnvalue;
                                     expr_647.Value = expr_647.Value + dataTable3.Rows[i][j].ToString() + "|";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!base.IsPostBack)
     {
         MainPlan          model             = new MainPlanAndAction().GetModel(new Guid(base.Request.QueryString["wkpId"]));
         MainPlanAndAction mainPlanAndAction = new MainPlanAndAction();
         this.txtWPcode.ReadOnly = true;
         this.txtWPcode.ToolTip  = "单号是不允许编辑的";
         this.txtWPcode.Text     = model.WkpUserCode;
         this.txtPart.Text       = mainPlanAndAction.BackDept(model.WkpDeptId);
         this.txtReportUser.Text = mainPlanAndAction.BackUserName(model.WkpReportUser);
         string[] array = model.WkpCheckerUser.Split(new char[]
         {
             ','
         });
         string str = "";
         for (int i = 0; i < array.Length - 1; i++)
         {
             str = str + new MainPlanAndAction().BackUserName(array[i]) + ",";
         }
         this.DateInTime.Text = model.WkpRecordDate.ToShortDateString();
         string    sqlString = "select wkpremarks from pm_workplan_plansummary where wkpid='" + new Guid(base.Request.QueryString["wkpid"].ToString()) + "'";
         DataTable dataTable = publicDbOpClass.DataTableQuary(sqlString);
         this.txtRemarks.Text = ((dataTable.Rows.Count > 0) ? dataTable.Rows[0][0].ToString() : "");
         if (base.Request.QueryString["Action"].ToString() == "edit")
         {
             string    sqlString2 = "select * from pm_workplan_plansummary where wkpid='" + base.Request.QueryString["wkpid"].ToString() + "'";
             DataTable dataTable2 = publicDbOpClass.DataTableQuary(sqlString2);
             this.txtRemarks.Text = PlanDetailAction.DeCodeStr(dataTable2.Rows[0]["wkpremarks"].ToString());
             this.txtScore.Text   = dataTable2.Rows[0]["wkpselfscore"].ToString();
             this.txtSummPro.Text = dataTable2.Rows[0]["wkpsummary"].ToString();
         }
         string    sqlString3 = "select * from pm_workplan_weekplandetails where WkpId='" + base.Request.QueryString["wkpId"].ToString() + "'";
         DataTable dataTable3 = publicDbOpClass.DataTableQuary(sqlString3);
         int       count      = dataTable3.Rows.Count;
         int       count2     = dataTable3.Columns.Count;
         this.hdnDataCount.Value = count.ToString();
         new PlanDetailAction().GetPlanDemos(new Guid(base.Request.QueryString["wkpId"]));
         if (count > 0)
         {
             string    sqlString4 = "select wkpsmcontents,wkppercent,wkpdetailsid from pm_workplan_weeksummary where wkpid='" + new Guid(base.Request.QueryString["wkpid"].ToString()) + "'";
             DataTable dataTable4 = publicDbOpClass.DataTableQuary(sqlString4);
             int       count3     = dataTable4.Rows.Count;
             int       count4     = dataTable4.Columns.Count;
             for (int j = 0; j < count3; j++)
             {
                 for (int k = 0; k < count4; k++)
                 {
                     if (k == count4 - 1)
                     {
                         HtmlInputHidden expr_34D = this.hdnTextSum;
                         expr_34D.Value = expr_34D.Value + dataTable4.Rows[j][k].ToString() + "?";
                     }
                     else
                     {
                         HtmlInputHidden expr_384 = this.hdnTextSum;
                         expr_384.Value = expr_384.Value + dataTable4.Rows[j][k].ToString() + "|";
                     }
                 }
             }
             for (int l = 0; l < count; l++)
             {
                 for (int m = 0; m < count2; m++)
                 {
                     if (m == count2 - 1)
                     {
                         HtmlInputHidden expr_3EC = this.hdnvalue;
                         expr_3EC.Value = expr_3EC.Value + dataTable3.Rows[l][m].ToString() + "?";
                     }
                     else
                     {
                         if (m == 3 || m == 4)
                         {
                             HtmlInputHidden expr_430 = this.hdnvalue;
                             expr_430.Value = expr_430.Value + DateTime.Parse(dataTable3.Rows[l][m].ToString()) + "|";
                         }
                         else
                         {
                             if (m == 2)
                             {
                                 HtmlInputHidden expr_476 = this.hdnvalue;
                                 expr_476.Value = expr_476.Value + PlanDetailAction.DeCodeStr(dataTable3.Rows[l][m].ToString()) + "|";
                             }
                             else
                             {
                                 HtmlInputHidden expr_4B2 = this.hdnvalue;
                                 expr_4B2.Value = expr_4B2.Value + dataTable3.Rows[l][m].ToString() + "|";
                             }
                         }
                     }
                 }
             }
         }
     }
 }