private void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 if (Session["Login"] == null) { Response.Redirect("../Exit.aspx"); return; } string strPoID = Request.QueryString["POID"]; Hashtable htapp = (Hashtable)Application["appconf"]; string strcons = (string)htapp["cons"]; StoBusi = new BusiComm.StorageBusi(strcons); if (!IsPostBack) { if (strPoID == "" || strPoID == null) { this.btAdd.Enabled = true; this.btMod.Enabled = false; this.FillDropDownList("Provider", this.ddlProvider); this.txtPoID.Enabled = false; this.btChState.Visible = false; string strCycle = DateTime.Today.Year.ToString(); if (DateTime.Today.Month < 10) { strCycle += "0" + DateTime.Today.Month.ToString(); } else { strCycle += DateTime.Today.Month.ToString(); } this.txtPoID.Text = "POS" + strCycle + "----"; string strNextCycle = DateTime.Today.AddMonths(1).Year.ToString(); if (DateTime.Today.AddMonths(1).Month < 10) { strNextCycle += "0" + DateTime.Today.AddMonths(1).Month.ToString(); } else { strNextCycle += DateTime.Today.AddMonths(1).Month.ToString(); } this.txtPlanCycle.Text = strNextCycle; } else { this.btAdd.Enabled = false; this.btMod.Enabled = true; this.FillDropDownList("Provider", this.ddlProvider); CMSMStruct.PoStockMainStruct psm1 = StoBusi.GetPoStockMainOne(strPoID); this.txtPoID.Text = psm1.strPoID; this.ddlProvider.SelectedIndex = this.ddlProvider.Items.IndexOf(this.ddlProvider.Items.FindByValue(psm1.strPrvdCode)); this.txtPlanCycle.Text = psm1.strPlanCycle; this.txtAddress.Text = psm1.strAddress; this.txtComments.Text = psm1.strComments; Session["psmold"] = psm1; this.txtPoID.Enabled = false; this.ddlProvider.Enabled = false; switch (psm1.strPoState) { case "0": this.btChState.Text = "执行"; break; case "1": this.txtPlanCycle.Enabled = false; this.txtAddress.Enabled = false; this.txtComments.Enabled = false; this.btMod.Enabled = false; this.btChState.Text = "完成"; break; case "2": this.txtPlanCycle.Enabled = false; this.txtAddress.Enabled = false; this.txtComments.Enabled = false; this.btMod.Enabled = false; this.btChState.Visible = false; break; } } } }