Example #1
0
        protected void gvProductType_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int productid = Convert.ToInt32(gvProductType.DataKeys[e.RowIndex].Value);

            OfferPriceInfo.DelProductType(productid);
            gvProductBind();

            int    OpId = Convert.ToInt32(Request["OfferPriceId"].ToString());
            string str  = OfferPriceInfo.GetProductMoneySum(OpId);

            if (str == "")
            {
                lblMoneySum.Text = "0元";
            }
            else
            {
                lblMoneySum.Text = OfferPriceInfo.GetProductMoneySum(OpId) + "元";
            }
        }
Example #2
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     if (isPValid())
     {
         try
         {
             int             OpId    = Convert.ToInt32(Request["OfferPriceId"].ToString());
             ProductTypeInfo product = new ProductTypeInfo();
             product.OfferPriceId = OpId;
             product.ProductName  = txtName.Text.ToString();
             product.Model        = txtModel.Text.ToString();
             product.Num          = txtNum.Text.ToString();
             product.Price        = txtPrice.Text.ToString();
             product.Unit         = ddlPUnit.SelectedItem.Text;
             float fNum   = float.Parse(txtNum.Text.ToString());
             float fPrice = float.Parse(txtPrice.Text.ToString());
             float fSum   = fNum * fPrice;
             product.Sums = fSum.ToString();
             product.Save();
             gvProductBind();
             string str = OfferPriceInfo.GetProductMoneySum(OpId);
             if (str == "")
             {
                 lblMoneySum.Text = "0元";
             }
             else
             {
                 lblMoneySum.Text = OfferPriceInfo.GetProductMoneySum(OpId) + "元";
             }
             Clear();
         }
         catch (Exception Ex)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "Save", "alert('新增失败:" + Ex.Message + "');", true);
         }
     }
 }