protected void LinkButton1_Click1(object sender, EventArgs e)
        {
            if (Session["Comm_CGPONo"] != null)
            {
                CG_POOrder model = POSer.GetSimpListArray(string.Format("and pono='{0}'", Session["Comm_CGPONo"]))[0];
                txtAE.Text        = model.AE;
                txtPONo.Text      = model.PONo;
                txtGuestName.Text = model.GuestName;
                txtName.Text      = model.POName;
                //var list = POSer.GetOrder_ToInvoice_1(string.Format(" PONo='{0}'", model.PONo));
                //if (list.Count > 0)
                //{
                //    txtTotal.Text = (list[0].POTotal - list[0].TuiTotal).ToString();
                //}
                var supplierList = new CAI_POCaiService().GetLastSupplier(string.Format("'{0}'", model.PONo));
                txtSalesUnit.Text      = string.Join(",", supplierList.Select(t => t.Supplier).ToArray());
                txtTotal.Text          = supplierList.Sum(t => t.Total).ToString();
                Session["Comm_CGPONo"] = null;

                var list = petitionsSer.GetListArray(string.Format(" PoNo='{0}'", txtPONo.Text), "", "");
                if (list.Count > 0)
                {
                    var modelPetition = list[0];
                    lblError.Text = string.Format("该项目已有签呈单,签呈单编号:{0},签呈单名称:{1}, 签订日期:{2}, 存放位置:{3}",
                                                  modelPetition.Number, modelPetition.Name, modelPetition.SignDate.ToString("yyyy-MM-dd"), modelPetition.Local_String);
                    btnAdd.Enabled    = false;
                    btnUpdate.Enabled = false;
                }
                else
                {
                    btnAdd.Enabled    = true;
                    btnUpdate.Enabled = true;
                    lblError.Text     = "";
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                for (var i = 1; i < 100; i++)
                {
                    ddlL_Month.Items.Add(new ListItem {
                        Text = i.ToString(), Value = i.ToString()
                    });
                }

                List <VAN_OA.Model.User>  user    = new List <VAN_OA.Model.User>();
                VAN_OA.Dal.SysUserService userSer = new VAN_OA.Dal.SysUserService();
                user = userSer.getAllUserByLoginName("");
                ddlHandler.DataSource = user;
                ddlHandler.DataBind();
                ddlHandler.DataTextField  = "LoginName";
                ddlHandler.DataValueField = "LoginName";

                if (base.Request["Id"] != null)
                {
                    this.btnAdd.Visible = false;
                    Petitions model = this.petitionsSer.GetModel(Convert.ToInt32(base.Request["Id"]));
                    txtName.Text           = model.Name;
                    this.ddlType.Text      = model.Type;
                    this.lblNumber.Text    = model.Number;
                    this.txtGuestName.Text = model.GuestName;
                    this.txtSalesUnit.Text = model.SalesUnit;
                    this.txtSummary.Text   = model.Summary;
                    this.txtTotal.Text     = model.Total.ToString();
                    this.txtSignDate.Text  = model.SignDate.ToString();
                    this.txtSumPages.Text  = model.SumPages.ToString();
                    this.txtSumCount.Text  = model.SumCount.ToString();
                    this.txtBCount.Text    = model.BCount.ToString();
                    this.txtPONo.Text      = model.PoNo;
                    this.txtAE.Text        = model.AE;
                    this.ddlHandler.Text   = model.Handler;
                    this.ddlLocal.Text     = model.Local;
                    this.ddlL_Year.Text    = model.L_Year.ToString();
                    this.ddlL_Month.Text   = model.L_Month.ToString();
                    this.txtRemark.Text    = model.Remark;

                    cbIsRequire.Checked = model.IsRequire;
                    if (model.IsRequire)
                    {
                        lbtnSelectPONo.Visible = false;
                    }
                    if (model.IsColse)
                    {
                        rabIsColseB.Checked = true;
                    }
                    hfYear.Value = model.L_Year.ToString();


                    var supplierList = new CAI_POCaiService().GetLastSupplier(string.Format("'{0}'", model.PoNo));
                    txtSalesUnit.Text = string.Join(",", supplierList.Select(t => t.Supplier).ToArray());
                    txtTotal.Text     = supplierList.Sum(t => t.Total).ToString();
                }
                else
                {
                    ddlHandler.Text        = "王汉中";
                    this.btnUpdate.Visible = false;
                }
            }
        }