public FormSale() { InitializeComponent(); presenterAddSale = new PresenterAddSale(new MYSQLSaleRepository(), this); presenterLoadProducts = new PresenterLoadProduct(new MYSQLProductRepository(), this); presenterLoadProducts.LoadProductPresenter(); carItemSale = new CarItemSale(); shoppingSale = new ShoppingSale(); }
private void btnAdd_Click(object sender, EventArgs e) { ProductViewModel productViewModel = cbproducts.SelectedItem as ProductViewModel; carItemSale = productViewModel.ConvertToCarItem(); carItemSale.Quantity = int.Parse(txtQuantity.Text); carItemSale.Fkuser = SessionUser.Instance.Currentuser.Id; shoppingSale.AddSale(carItemSale, int.Parse(productViewModel.Stock)); RefreshData(); }
public static CarItemSale ConvertToCarItem(this ProductViewModel product) { CarItemSale car = new CarItemSale(); car.Code = int.Parse(product.Id); car.Name = product.Name; car.Price = decimal.Parse(product.Saleprice); car.Quantity = int.Parse(product.Stock); return(car); }