Example #1
0
 public IActionResult Success()
 {
     try
     {
         var result = PDTHolder.Success(Request.Query["tx"]);
         if (result != null)
         {
             var membership    = ocmde.MemberShips.Find(result.MemberShipId);
             var accountVendor = ocmde.AccountVendors.SingleOrDefault(v => v.Email.Equals(HttpContext.Session.GetString("email_customer")));
             MemberShipVendor memberShipVendor = new MemberShipVendor()
             {
                 MemerShipId = membership.Id,
                 VendorId    = accountVendor.VendorId,
                 Price       = membership.Price,
                 StartDate   = DateTime.Now,
                 EndDate     = DateTime.Now.AddMonths(membership.Month)
             };
             ocmde.MemberShipVendors.Add(memberShipVendor);
             ocmde.SaveChanges();
             ViewBag.msg = "Success";
         }
         else
         {
             ViewBag.msg = "Error";
         }
         return(View("Success"));
     }
     catch (Exception e)
     {
         throw;
     }
 }
 public ActionResult Success()
 {
     try
     {
         var result = PDTHolder.Success(Request.QueryString.Get("tx"));
         if (result != null)
         {
             var membership = ocmde.MemberShips.Find(result.MemberShipId);
             var vendor     = (Clitzy.Models.Vendor)SessionPersister.account;
             MemberShipVendor memberShipVendor = new MemberShipVendor()
             {
                 MemerShipId = membership.Id,
                 VendorId    = vendor.Id,
                 Price       = membership.Price,
                 StartDate   = DateTime.Now,
                 EndDate     = DateTime.Now.AddMonths(membership.Month)
             };
             ocmde.MemberShipVendors.Add(memberShipVendor);
             ocmde.SaveChanges();
             ViewBag.msg = "Success";
         }
         else
         {
             ViewBag.msg = "Error";
         }
         return(View("Success"));
     }
     catch (Exception e)
     {
         return(View("Error", new HandleErrorInfo(e, "Vendors", "Success")));
     }
 }
Example #3
0
        public IActionResult Success(CheckoutViewModel checkoutViewModel)
        {
            var result = PDTHolder.Success(Request.Query["tx"].ToString());

            checkoutViewModel.cartItem = SessionHelper.GetObjectFromJson <List <CartItem> >(HttpContext.Session, "cart");
            SessionHelper.RemoveSession(HttpContext.Session, "cart");
            return(View(checkoutViewModel));
        }
Example #4
0
        public IActionResult Success()
        {
            var result = PDTHolder.Success(Request.Query["tx"].ToString());

            if (result != null)
            {
                return(RedirectToAction("CheckOut", new { id = "paypal" }));
            }
            return(RedirectToAction("False"));
        }
Example #5
0
        public IActionResult Success()
        {
            //PDTHolder pdtHolder = new PDTHolder();
            var result = PDTHolder.Success(Request.Query["tx"].ToString());

            Debug.WriteLine("First Name: " + result.PayerFirstName);
            Debug.WriteLine("Last Name: " + result.PayerLastName);
            Debug.WriteLine("Email: " + result.PayerEmail);
            Debug.WriteLine("InvoiceNumber: " + result.InvoiceNumber);
            Debug.WriteLine("GrossTotal: " + result.GrossTotal);
            return(View("Success"));
        }
Example #6
0
        public async Task <IActionResult> Success(CheckoutViewModel checkoutViewModel)
        {
            var result = PDTHolder.Success(Request.Query["tx"].ToString());

            checkoutViewModel.cartItem     = SessionHelper.GetObjectFromJson <List <CartItem> >(HttpContext.Session, "cart");
            checkoutViewModel.BillCheckout = SessionHelper.GetObjectFromJson <BillViewModel>(HttpContext.Session, "billInfo");

            if (checkoutViewModel.BillCheckout == null)
            {
                return(NotFound());
            }

            var currentBill = _mapper.Map <Bill>(checkoutViewModel.BillCheckout);

            if (_signInManager.IsSignedIn(User))
            {
                var userId = _userManager.GetUserId(User);
                currentBill.AccountId = userId;
                var userUpdateMoney = await _userManager.FindByIdAsync(userId);

                var amount = checkoutViewModel.cartItem.Sum(x => x.product.DiscountPrice * x.Quantity) + Convert.ToDouble(userUpdateMoney.MoneySpended);
                userUpdateMoney.MoneySpended = amount;
                var resultUpdate = await _userManager.UpdateAsync(userUpdateMoney);
            }

            await _context.Bill.AddAsync(currentBill);

            var addedBill = await _context.SaveChangesAsync();

            if (addedBill > 0)
            {
                List <BillDetails> newDetail = new List <BillDetails>();
                foreach (var item in checkoutViewModel.cartItem)
                {
                    var temp = _mapper.Map <BillDetails>(item);
                    temp.BillId = currentBill.BillId;
                    newDetail.Add(temp);
                }

                await _context.BillDetails.AddRangeAsync(newDetail);

                var addedBillDetail = await _context.SaveChangesAsync();

                SessionHelper.RemoveSession(HttpContext.Session, "cart");
                SessionHelper.RemoveSession(HttpContext.Session, "billInfo");
            }

            return(View(checkoutViewModel));
        }
Example #7
0
        public ActionResult Success()
        {
            ViewBag.result = PDTHolder.Success(Request.QueryString.Get("tx"));

            PayPalModel newPayPal = new PayPalModel()
            {
                Date                = DateTime.Now,
                PaymentAmount       = ViewBag.result.GrossTotal,
                PayPalTransactionID = ViewBag.result.TransactionId
            };

            db.PayPalModel.Add(newPayPal);
            db.SaveChanges();

            return(View("Success"));
        }
 public ActionResult Success()
 {
     ViewBag.result = PDTHolder.Success(Request.QueryString.Get("tx"));
     return(View("Success"));
 }
Example #9
0
        public IActionResult Success()
        {
            var result = PDTHolder.Success(Request.Query["tx"].ToString());

            return(View());
        }
Example #10
0
 public ActionResult OrderConfirmation()
 {
     ViewBag.result = PDTHolder.Success(Request.QueryString.Get("tx"));
     return(View("orderConfirmation"));
 }
        public async Task <IActionResult> Success()
        {
            //This action returns the result of the payment.
            //This is when the order will receive it's first update: it's either payed or encountered an error.
            var result = PDTHolder.Success(Request.Query["tx"].ToString());

            //Update the order status and history, update the offeredservice


            //Get previously entered order information
            string form      = HttpContext.Session.GetString("FORM");
            char   separator = ';';

            string[] formVars = form.Split(separator);

            //Send a confirmation email
            await ConstructOrderVerificationMailAsync(formVars);


            string     email             = formVars[4];
            List <int> offeredServiceIds = ParsePursToList();

            foreach (int olsId in offeredServiceIds)
            {
                //Fetch the order id
                int orderId = MollShopContext.FindOrderId(olsId, email);


                //Insert a new order history
                tbl_orderhistory history = new tbl_orderhistory();
                history.fld_ActionDate  = DateTime.Now;
                history.fld_lastAction  = "Paid order";
                history.fld_orderstatus = "Sent";
                history.fld_orderid     = orderId;

                MollShopContext.CreateRow(history, "tbl_orderhistory");

                //Insert a new order status
                tbl_orderstatus orderStatus = new tbl_orderstatus();
                orderStatus.fld_dateOrdered        = DateTime.Now;
                orderStatus.fld_orderid            = orderId;
                orderStatus.fld_targetDeliveryDate = DateTime.Now.AddDays(7);
                orderStatus.fld_DateUpdated        = DateTime.Now;
                MollShopContext.CreateRow(orderStatus);

                //Set the availability of the service to 'N'

                //ElasticSearch
                EsUpdater <OfferedLabourerService> .UpdateField("" + olsId, "fld_stillavailable", 'N');

                //Database
                tbl_offeredservicesdata os = new tbl_offeredservicesdata();
                os.fld_stillavailable = 'N';

                MollShopContext.UpdateRow(os, "fld_OfferedServiceId", olsId);
            }



            return(View("Success"));
        }