protected void btnAddProduct_Click(object sender, EventArgs e) { localhost.Product p = new localhost.Product(); p.Id = txtId.Text; p.Name = txtName.Text; p.Information = txtInformation.Text; p.MinCap = int.Parse(txtMinCap.Text); p.MaxCap = int.Parse(txtMaxCap.Text); p.CurCap = int.Parse(txtCurCap.Text); p.Price = int.Parse(txtPrice.Text); p.MyPrice = int.Parse(txtMyPrice.Text); string provider = dropProvider.SelectedValue; p.Provider = s.GetProviderId(provider); if (fuImage.HasFile) { p.Pic = fuImage.FileName; fuImage.SaveAs(Server.MapPath("pics/products/" + fuImage.FileName)); } else { p.Pic = "default.png"; } p.Status = 1; s.AddNewProduct(p); Response.Write(Functions.AlertRedirect("The product added", "Home.aspx")); }