Ejemplo n.º 1
0
 public PurchaseItem(decimal quantity, decimal unitPrice, ProductDB product)
 {
     this.Quantity = quantity;
     this.UnitPrice = unitPrice;
     this.Product = product;
     this.Provider = null;
 }
Ejemplo n.º 2
0
 public void saveProduct(ProductDB product)
 {
     if (product.IsNew())
     {
         int id = this.dbConnection.addProduct(product.Code, product.Name, product.Stockable, product.Stock, product.Price);
         product.Id = id;
     }
     else
     {
         this.dbConnection.updateProduct((int)product.Id, product.Code, product.Name, product.Stockable, product.Stock, product.Price);
     }
 }
 public DialogResult ShowDialog(ProductDB product, DbActionsEnum operation)
 {
     if (operation == DbActionsEnum.Create)
     {
         this.originalProduct = null;
     }
     else
     {
         this.originalProduct = product;
     }
     this.setBehaviorFromOperation(operation);
     return this.ShowDialog();
 }
 private void bAccept_Click(object sender, EventArgs e)
 {
     if (this.validData())
     {
         if (this.originalProduct == null || this.originalProduct.Id == null)
         {
             this.resultProduct = new ProductDB(long.Parse(this.tbProductCode.Text), this.tbProductName.Text, this.cbProductStockable.Checked);
         }
         else
         {
             this.resultProduct = new ProductDB((int)this.originalProduct.Id, long.Parse(this.tbProductCode.Text), this.tbProductName.Text, this.cbProductStockable.Checked);
         }
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
Ejemplo n.º 5
0
 public SaleItem(decimal quantity, ProductDB product)
 {
     this.Quantity = quantity;
     this.Product = product;
 }
Ejemplo n.º 6
0
 public void deleteProduct(ProductDB product)
 {
     this.dbConnection.deleteProduct((int)product.Id);
 }