public async Task Init() { BeverageCategories = new ObservableCollection <BeverageCategory>(await Service.GetAllBeverageCategoriesAsync()); this.Beverages = new ObservableCollection <Beverage>(await Service.GetAllPopularBeveragesAsync()); // this.Beverages = new ObservableCollection<Beverage>(await Service.GetAllBeveragesByDrinkTypeAsync(SelectedDrinkType)); Customers = new ObservableCollection <LedgerAccount>(await Service.GetAllCustomerAccountsAsync()); this.Banks = new ObservableCollection <LedgerAccount>(await Service.GetAllBanksAsync()); SelectedBeverages = new ObservableCollection <BeverageVm>(); DrinkTypes = Enum.GetNames(typeof(Drinktype)).ToList(); SaleOrder = new SaleOrder(); PostPurchaseToLedger = ((App)Application.Current).AutomateLedgerPost; // BeverageCategories.Insert(0, new BeverageCategory { BeverageCategoryName = "Popular" }); if (!PostPurchaseToLedger) { PostLedgerCheckEnabled = true; } else { PostLedgerCheckEnabled = false; } if (((App)Application.Current).UseBarCodeService) { StartWebService(); } SelectedSaleVm = new SaleVm(); IsDiscountApplied = false; IsDiscountNotApplied = true; IsCash = true; }
public SaleVm GetSaleDetails(int id) { Sale sale = Data.Data.Context.Sales.Find(id); SaleVm vm = Mapper.Map <Sale, SaleVm>(sale); return(vm); }
public SaleVm GetSale(int id) { Sale sale = this.Context.Sales.Find(id); SaleVm vm = Mapper.Map <Sale, SaleVm>(sale); return(vm); }
public IActionResult Create(SaleVm form) { if (ModelState.IsValid) { Sale formCo = _mapper.Map <Sale>(form); _unitOfWork.Sales.Add(formCo); _unitOfWork.Complate(); TempData["Message"] = "Sikeres hozzáadás!"; return(RedirectToAction(nameof(Index))); } return(View(form)); }
public IActionResult Edit(SaleVm form) { if (ModelState.IsValid) { Sale saleCo = _mapper.Map <Sale>(form); _unitOfWork.Sales.Update(saleCo); _unitOfWork.Complate(); TempData["Message"] = "A változtatásokat sikeresen elmentettük!"; return(RedirectToAction(nameof(Index))); } return(View(form)); }
public InvoiceView(SaleVm vm) : this() { this.vm = vm; DataContext = this; invoicetext.Text = "Invoice Number :" + vm.SaleOrderId.ToString(); usertxt.Text = "User :" + ((App)Application.Current).CurrentUser.UserName; date.Text = vm.SaleDate.ToShortDateString(); cn.Text = ((App)Application.Current).SelectedCompany.CompanyName; ca.Text = ((App)Application.Current).SelectedCompany.CompanyAddress; cpn.Text = ((App)Application.Current).SelectedCompany.CompanyPanNumber; cp.Text = ((App)Application.Current).SelectedCompany.CompanyPhone; cc.Text = ((App)Application.Current).SelectedCompany.CompanyCity; PrintInvoice(); }
public async Task Init() { BeverageCategories = new ObservableCollection <BeverageCategory>(await Service.GetAllBeverageCategoriesAsync()); this.Beverages = new ObservableCollection <Beverage>(await Service.GetAllPopularBeveragesAsync()); // this.Beverages = new ObservableCollection<Beverage>(await Service.GetAllBeveragesByDrinkTypeAsync(SelectedDrinkType)); Customers = new ObservableCollection <LedgerAccount>(await Service.GetAllCustomerAccountsAsync()); this.Banks = new ObservableCollection <LedgerAccount>(await Service.GetAllBanksAsync()); SelectedBeverages = new ObservableCollection <BeverageVm>(); DrinkTypes = Enum.GetNames(typeof(Drinktype)).ToList(); SaleOrder = new SaleOrder(); SelectedSaleVm = new SaleVm(); IsDiscountApplied = false; IsDiscountNotApplied = true; IsCash = true; }
/// <summary> /// Implements the execution of <see cref="SaveSalesCommand" /> /// </summary> private void SaveSalesCommand_Execute(object obj) { if (SelectedSaleVm.BevarageVms.Count > 0) { SaleOrder so = new SaleOrder(); var TotalAmount = SelectedSaleVm.BevarageVms.Sum(a => a.Total); //TotalAmount = TotalAmount - Discount ?? 0; so.TotalAmount = SelectedSaleVm.TotalAmount;; so.Discount = SelectedSaleVm.Discount; so.SaleDate = SelectedSaleVm.SaleDate; so.AmountPaid = SelectedSaleVm.AmountPaid; so.Due = SelectedSaleVm.Due; so.Customer = SelectedSaleVm.Customer; so.AmountAfterDiscount = SelectedSaleVm.AmountAfterDiscount; so.Sales = SelectedSaleVm.BevarageVms.Select(a => new Sale { BeverageId = a.BeverageId, Quantity = a.Quantity, UnitPrice = a.Price ?? 0, SaleDate = SelectedSaleVm.SaleDate }).ToList(); string mode; if (IsCash) { mode = "IsCash"; } else if (IsCredit) { mode = "IsCredit"; } else if (IsBank) { mode = "IsBank"; } else { mode = "IsCash"; } if (Service.SaveSaleOrder(so, mode, SelectedCustomer, SelectedBankAccount, ChequeNumber) > 0) { } } SelectedSaleVm = new SaleVm(); }
public ActionResult About(int id) { SaleVm saleVm = this.service.GetSale(id); return(this.View(saleVm)); }
public ActionResult About(int id) { SaleVm saleVm = this.business.GetSale(id); return(this.View(saleVm)); }
/// <summary> /// Implements the execution of <see cref="CancelSalesCommand" /> /// </summary> private void CancelSalesCommand_Execute(object obj) { SelectedSaleVm = new SaleVm(); }
public ActionResult Details(int id) { SaleVm viewModels = this.service.GetSaleDetails(id); return(this.View(viewModels)); }