Example #1
0
 public Product(Product p)
 {
     this.Id = p.Id;
     this.Category = p.Category;
     this.Name = p.Name;
     this.PartNumber = p.PartNumber;
     this.Price = p.Price;
     this.Cost = p.Cost;
     this.DefaultQuantity = p.DefaultQuantity;
 }
Example #2
0
        protected void Add_Click(object sender, EventArgs e)
        {
            var ID = HiddenFieldAdd.Value;
            Product p = new Product();

            //CHECKS DB for existing product to update
            if(ID != "") p = session.Load<Product>(ID);

            //prevents accidental override
            if(p.PartNumber != PartNumber.Text)
                p = new Product();

            p.Category = CategoryDDL.SelectedValue;
            p.Name = Name.Text;
            p.PartNumber = PartNumber.Text;
            if (Price.Text != "") p.Price = Convert.ToDouble(Price.Text);
            p.Cost = Convert.ToDouble(Cost.Text);
            p.DefaultQuantity = Convert.ToInt32(DefaultQuantity.Text);

            session.Store(p);
            session.SaveChanges();

            Response.Redirect(Request.RawUrl);
        }
Example #3
0
 public LineItem()
 {
     Product = new Product();
 }