Exemple #1
0
    protected void btnOK_Click(object sender, EventArgs e)
    {
        Product product = new Product();

        product.ProductName = txtProductName.Text;
        product.NormalPrice = decimal.Parse(txtNormalPrice.Text);
        product.MemberPrice = decimal.Parse(txtMemberPrice.Text);

        if (string.IsNullOrEmpty(_productId))
        {
            _productBLL.Insert(product);
        }
        else
        {
            product.ID = int.Parse(_productId);
            _productBLL.Update(product);
        }
        Response.Redirect("ProductList.aspx", true);
    }
    private void Save()
    {
        string productId = Request.QueryString["productId"];

        Model.Product product = new Model.Product();
        product.ProductName = Request.Form["ProductName"];
        product.NormalPrice = decimal.Parse(Request.Form["NormalPrice"]);
        product.MemberPrice = decimal.Parse(Request.Form["MemberPrice"]);

        if (string.IsNullOrEmpty(productId))
        {
            productBLL.Insert(product);
        }
        else
        {
            product.ID = int.Parse(productId);
            productBLL.Update(product);
        }
        Response.Write("{success: true}");
        Response.End();
    }