Exemplo n.º 1
0
        protected void gvList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#EAF1FD',this.style.fontWeight='';");
                e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor,this.style.fontWeight='';");
                Petitions model = e.Row.DataItem as Petitions;

                var wherePoNo = supplierList.Where(t => t.PONo == model.PoNo);
                (e.Row.FindControl("SalesUnit") as Label).Text = string.Join(",", wherePoNo.Select(t => t.Supplier).ToArray());
                (e.Row.FindControl("Total") as Label).Text     = wherePoNo.Sum(t => t.Total).ToString();
            }
        }
Exemplo n.º 2
0
        public Petitions getModel()
        {
            string Type = this.ddlType.Text;

            string   GuestName = this.txtGuestName.Text.Trim();
            string   SalesUnit = this.txtSalesUnit.Text.Trim();
            string   Summary   = this.txtSummary.Text.Trim();
            decimal  Total     = decimal.Parse(this.txtTotal.Text);
            DateTime SignDate  = DateTime.Parse(this.txtSignDate.Text);
            int      SumPages  = int.Parse(this.txtSumPages.Text);
            int      SumCount  = int.Parse(this.txtSumCount.Text);
            int      BCount    = int.Parse(this.txtBCount.Text);
            string   PoNo      = this.txtPONo.Text.Trim();
            string   AE        = this.txtAE.Text.Trim();
            string   Handler   = this.ddlHandler.Text;
            bool     IsColse   = this.rabIsColseB.Checked;
            string   Local     = this.ddlLocal.Text;
            int      L_Year    = int.Parse(this.ddlL_Year.Text);
            int      L_Month   = int.Parse(this.ddlL_Month.Text);
            string   Remark    = this.txtRemark.Text;

            Petitions model = new Petitions();

            model.Type      = Type;
            model.GuestName = GuestName;
            model.SalesUnit = SalesUnit;
            model.Summary   = Summary;
            model.Total     = Total;
            model.SignDate  = SignDate;
            model.SumPages  = SumPages;
            model.SumCount  = SumCount;
            model.BCount    = BCount;
            model.PoNo      = PoNo;
            model.AE        = AE;
            model.Handler   = Handler;
            model.IsColse   = IsColse;
            model.Local     = Local;
            model.L_Year    = L_Year;
            model.L_Month   = L_Month;
            model.Remark    = Remark;
            model.Name      = txtName.Text.Trim();
            model.IsRequire = cbIsRequire.Checked;

            if (Request["Id"] != null)
            {
                model.Id = Convert.ToInt32(Request["Id"]);
            }
            return(model);
        }
Exemplo n.º 3
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (this.FormCheck())
     {
         try
         {
             Petitions model = getModel();
             if (this.petitionsSer.Add(model) > 0)
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加成功!');</script>");
                 Clear();
             }
             else
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('添加失败!');</script>");
             }
         }
         catch (Exception ex)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>");
         }
     }
 }
Exemplo n.º 4
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     if (this.FormCheck())
     {
         try
         {
             Petitions model = getModel();
             if (this.petitionsSer.Update(model, hfYear.Value))
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改成功!');</script>");
                 base.Response.Redirect("~/BaseInfo/WFPetitionsList.aspx?PONO=" + txtPONo.Text);
             }
             else
             {
                 base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('修改失败!');</script>");
             }
         }
         catch (Exception ex)
         {
             base.ClientScript.RegisterStartupScript(base.GetType(), null, "<script>alert('" + ex.Message + "!');</script>");
         }
     }
 }
Exemplo n.º 5
0
        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;
                }
            }
        }