Exemplo n.º 1
0
        public IActionResult AddSalesOrder(SalesOrderCreditDTO salesOrder)
        {
            string username = this.HttpContext.Session.GetString(SessionConstant.UserNameSession);

            if (string.IsNullOrEmpty(username))
            {
                return(RedirectToAction("Login", "Account"));
            }

            var    userId       = User.FindFirstValue(ClaimTypes.NameIdentifier);
            var    discount     = Convert.ToDecimal(salesOrder.Discount);
            var    total        = Convert.ToDecimal(salesOrder.Total);
            var    amountDue    = Convert.ToDecimal(salesOrder.AmountDue);
            var    tendered     = Convert.ToDecimal(salesOrder.Tendered);
            var    change       = Convert.ToDecimal(salesOrder.Change);
            string errorMessage = "";
            int    salesId      = 0;

            this._salesTranService.AddSalesOrderCredit(
                salesOrder.CustomerId,
                userId,
                total,
                out errorMessage,
                out salesId);
            if (errorMessage != "")
            {
                TempData["Fail"] = errorMessage;
                return(RedirectToAction("Index", "SalesTransactionCredit", new { customerId = salesOrder.CustomerId }));
            }

            this.HttpContext.Session.SetInt32(SessionConstant.SalesId, salesId);
            return(RedirectToAction("Index", "Credit", new { customerId = salesOrder.CustomerId }));
        }
Exemplo n.º 2
0
 public SalesTransactionCreditViewModel()
 {
     AddSalesTranCreditLineDTO     = new AddSalesTranCreditLineDTO();
     UpdatedSalesCreditQuantityDTO = new UpdatedSalesCreditQuantityDTO();
     DeleteSalesCreditLineDTO      = new DeleteSalesCreditLineDTO();
     SalesOrderCreditDTO           = new SalesOrderCreditDTO();
 }