Пример #1
0
 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;
 }
Пример #2
0
        public SaleVm GetSaleDetails(int id)
        {
            Sale   sale = Data.Data.Context.Sales.Find(id);
            SaleVm vm   = Mapper.Map <Sale, SaleVm>(sale);

            return(vm);
        }
Пример #3
0
        public SaleVm GetSale(int id)
        {
            Sale sale = this.Context.Sales.Find(id);

            SaleVm vm = Mapper.Map <Sale, SaleVm>(sale);

            return(vm);
        }
Пример #4
0
 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));
 }
Пример #5
0
        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));
        }
Пример #6
0
 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();
 }
Пример #7
0
        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;
        }
Пример #8
0
 /// <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();
 }
Пример #9
0
        public ActionResult About(int id)
        {
            SaleVm saleVm = this.service.GetSale(id);

            return(this.View(saleVm));
        }
Пример #10
0
        public ActionResult About(int id)
        {
            SaleVm saleVm = this.business.GetSale(id);

            return(this.View(saleVm));
        }
Пример #11
0
 /// <summary>
 /// Implements the execution of <see cref="CancelSalesCommand" />
 /// </summary>
 private void CancelSalesCommand_Execute(object obj)
 {
     SelectedSaleVm = new SaleVm();
 }
Пример #12
0
        public ActionResult Details(int id)
        {
            SaleVm viewModels = this.service.GetSaleDetails(id);

            return(this.View(viewModels));
        }