public void DeleteTempOrder(TempOrder temporder)
            {
            if (temporder == null)
                throw new ArgumentNullException("temp order");

            temporder.Deleted = true;
            UpdateTempOrder(temporder);

            }
        public void UpdateTempOrder(TempOrder temporder)
            {
            if (temporder == null)
                throw new ArgumentNullException("temp order");

            _temporderRepository.Update(temporder);

            //event notification
            _eventPublisher.EntityUpdated(temporder);
            }
		//Customization Propeers info (changed by ravi)
		public ActionResult OpcCompleteRedirectionPayment1()
		{
			try
			{

				var Orginalcart = _workContext.CurrentCustomer.ShoppingCartItems
			 .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart)
			 .Where(sci => sci.StoreId == _storeContext.CurrentStore.Id)
			 .ToList();



				if (Orginalcart.Count == 0)
					throw new Exception("Your cart is empty");



				//place order
				var processPaymentRequest = _httpContext.Session["OrderPaymentInfo"] as ProcessPaymentRequest;
				if (processPaymentRequest == null)
				{
					//Check whether payment workflow is required
					if (IsPaymentWorkflowRequired(Orginalcart))
					{
						throw new Exception("Payment information is not entered");
					}
					else
						processPaymentRequest = new ProcessPaymentRequest();
				}




				processPaymentRequest.StoreId = _storeContext.CurrentStore.Id;
				processPaymentRequest.CustomerId = _workContext.CurrentCustomer.Id;

				processPaymentRequest.PaymentMethodSystemName = _workContext.CurrentCustomer.GetAttribute<string>(
					 SystemCustomerAttributeNames.SelectedPaymentMethod,
					 _genericAttributeService, _storeContext.CurrentStore.Id);

				TempOrder tempOrderObj = new TempOrder();
				tempOrderObj.TempOrderGuid = Guid.NewGuid();
				this.Session["orderGuid"] = tempOrderObj.TempOrderGuid;
				_tempOrderService.InsertTempOrder(tempOrderObj);
				this.Session["orderobj"] = processPaymentRequest;
				var placeOrderResult = _payPalOrderProcessingService.PaypalOrderDetails(processPaymentRequest);
				TempData["OrderCancelValue"] = 1;


				//_shoppingCartService.AddToCart(, )





				var customer = _workContext.CurrentCustomer;
				var paymentMethodSystemName = processPaymentRequest.PaymentMethodSystemName;/*customer.GetAttribute<string>(
                   SystemCustomerAttributeNames.SelectedPaymentMethod,
                   _genericAttributeService, _storeContext.CurrentStore.Id);   */

				var paymentMethod = _paymentService.LoadPaymentMethodBySystemName(paymentMethodSystemName);
				Guid ogid = processPaymentRequest.OrderGuid;


				//int oid = processPaymentRequest.InitialOrderId;


				//Order odObject = _orderService.GetOrderByGuid(ogid);

				IList<ShoppingCartItem> cart = null;
				cart = Orginalcart.ToList();

				/*cart = _workContext.CurrentCustomer.ShoppingCartItems
						 .Where(sci => sci.ShoppingCartType == ShoppingCartType.ShoppingCart)
						 .Where(sci => sci.StoreId == _storeContext.CurrentStore.Id)
						 .ToList();        */



				/*  var postProcessPaymentRequest = new PostProcessPaymentRequest()
				  {
						Order = odObject//new Order { PaymentStatus = PaymentStatus.Pending, PaymentMethodSystemName = paymentMethodSystemName }
				  };     */

				var postProcessPaymentRequest = new PostProcessPaymentRequest();
				Order or = new Order();
				or = placeOrderResult.PlacedOrder;
				or.PaymentMethodSystemName = paymentMethodSystemName;
				or.PaymentStatus = PaymentStatus.Pending;
				or.OrderDiscount = placeOrderResult.PlacedOrder.OrderDiscount;
				or.OrderGuid = tempOrderObj.TempOrderGuid;
				or.Id = _tempOrderService.GetTempOrderByGuid(tempOrderObj.TempOrderGuid).Id;
				postProcessPaymentRequest.Order = or;
				//postProcessPaymentRequest.Cart = Orginalcart;
				// _orderProcessingService.ReOrder(or);




				_paymentService.PostProcessPayment(postProcessPaymentRequest);

				if (_webHelper.IsRequestBeingRedirected || _webHelper.IsPostBeingDone)
				{
					//redirection or POST has been done in PostProcessPayment
					return Content("Redirected");
				}
				else
				{
					//if no redirection has been done (to a third-party payment page)
					//theoretically it's not possible
					return RedirectToRoute("CheckoutCompleted", new { orderId = 2 });
				}
			}
			catch (Exception exc)
			{
				_logger.Warning(exc.Message, exc, _workContext.CurrentCustomer);
				return Content(exc.Message);
			}
		}