コード例 #1
0
        public ActionResult Status()
        {
            int orderId = Convert.ToInt32(Session["OrderId"]);
            string url = "";
            try
            {
                HttpCookie cookie = Request.Cookies["OrderId"];
                if (cookie != null)
                {
                    orderId = Convert.ToInt32(cookie.Value);
                }
                OrderDal.UpdatePaymentStatusInOrder(orderId, Convert.ToString(Session["st"]), Convert.ToString(Session["tx"]));
                    var order = OrderDal.GetByOrderId(orderId);
                    url = "http://testing.issoftwaresolution.in/payment/index/" + orderId;
                    string emailMessage = Utility.GetResponse(url);
                    Utility.SendEmail(order.Email, emailMessage, "Order confirmation", ConfigurationManager.AppSettings["WebsiteUrl"].ToString());
                    Session["Cart"] = new CartModel();
                    return View(order);

            }
            catch(Exception ex)
            {
                ViewBag.Cookies = "";
                HttpCookie cookie = Request.Cookies["OrderId"];
                if (cookie != null)
                {
                    orderId = Convert.ToInt32(cookie.Value);
                }

              ViewBag.url = url;
              ViewBag.Error=ex.InnerException;
              ViewBag.Message = ex.Message;
              ViewBag.StakeTrace=ex.TargetSite+" ------   "+ex.StackTrace ;

              ViewBag.orderId = orderId;

              ViewBag.SessionorderId = orderId;
              return View("Test");
            }
        }
コード例 #2
0
ファイル: CartDal.cs プロジェクト: issoftwaresoultion/Ecom
 public static CartModel UpdateQuantity(CartModel obj, string Currency, int rowid, int quantity)
 {
     List<ReCalculateCart> qtyList = new List<ReCalculateCart>();
     if (obj == null)
     {
         obj = new CartModel();
         obj.Product = new List<ProductModel>();
     }
     foreach (var x in obj.Product)
     {
         if (!(x.CountId == rowid))
         {
             qtyList.Add(new ReCalculateCart { Id = x.Price.Id, Quantity = x.Price.Quantity });
         }
         else
         {
             qtyList.Add(new ReCalculateCart { Id = x.Price.Id, Quantity = quantity });
         }
     }
     obj = new CartModel();
     foreach (var x in qtyList)
     {
         AddItemTocart(x.Id, obj, Currency, x.Quantity,0);
     }
     return obj;
 }
コード例 #3
0
ファイル: CartDal.cs プロジェクト: issoftwaresoultion/Ecom
 public static CartModel UpdateDelivery(CartModel obj,  string Currency, int deliverId)
 {
     List<ReCalculateCart> qtyList = new List<ReCalculateCart>();
     if (obj == null)
     {
         obj = new CartModel();
         obj.Product = new List<ProductModel>();
     }
     foreach (var x in obj.Product)
     {
         qtyList.Add(new ReCalculateCart { Id = x.Price.Id, Quantity = x.Price.Quantity });
     }
     obj = new CartModel();
     foreach (var x in qtyList)
     {
         AddItemTocart(x.Id, obj, Currency, x.Quantity, deliverId);
     }
     return obj;
 }
コード例 #4
0
ファイル: CartDal.cs プロジェクト: issoftwaresoultion/Ecom
        public static int SaveOrUpdateCartAsOrder(CartModel obj, string Currency, int userid, int orderId)
        {
            OrderHeader Orderheaderobj = new OrderHeader();
            Orderheaderobj.OrderDetail = new List<OrderDetail>();
            if ((Currency != "Dollar") && (Currency != "Euro") && (Currency != "Pound"))
            {
                Orderheaderobj.CurrencyChoosenByUser = Currency;
                Orderheaderobj.CurrencyInWhichAmmountPaid = "Dollar";
                Orderheaderobj.ActualAmountPaid = Utility.GetConvertedPrice(obj.Total, Currency, "USD");
                Orderheaderobj.AmountInCurrencyChoosenByuser = obj.Total;
                Orderheaderobj.DeliveryCharges = Utility.GetConvertedPrice(obj.DelivierCharges, Currency, "USD");
                Orderheaderobj.TotalProductCostInUserCurrency = obj.AllProductPrice;
                Orderheaderobj.TotalProductCostInConvertedrCurrency = Utility.GetConvertedPrice(obj.AllProductPrice, Currency, "USD");

                foreach (var x in obj.Product)
                {
                    Orderheaderobj.OrderDetail.Add(new OrderDetail
                    {
                        ActualPriceInUserSeletedCurrency = x.Price.TotalPrice,
                        PricePaidInConvertedCurrency = Utility.GetConvertedPrice(x.Price.TotalPrice, Currency, "USD"),
                        ProductPriceId = x.Price.Id,
                        Quantity = x.Price.Quantity,
                        //ProductName = x.Name + " | Length: " + x.Price.LengthName + " inch | Color: " + x.Price.ColorName,
                        ProductName = x.Name
                    });
                }
            }
            else
            {
                Orderheaderobj.CurrencyChoosenByUser = Currency;
                Orderheaderobj.CurrencyInWhichAmmountPaid = Currency;
                Orderheaderobj.ActualAmountPaid = obj.Total;
                Orderheaderobj.AmountInCurrencyChoosenByuser = obj.Total;
                Orderheaderobj.DeliveryCharges = obj.DelivierCharges;
                Orderheaderobj.TotalProductCostInUserCurrency = obj.AllProductPrice;
                Orderheaderobj.TotalProductCostInConvertedrCurrency = obj.AllProductPrice;

                foreach (var x in obj.Product)
                {
                    Orderheaderobj.OrderDetail.Add(new OrderDetail
                    {
                        ActualPriceInUserSeletedCurrency = x.Price.TotalPrice,
                        PricePaidInConvertedCurrency = x.Price.TotalPrice,
                        ProductPriceId = x.Price.Id,
                        Quantity = x.Price.Quantity,
                        ProductName = x.Name,
                    });
                }
            }
            Orderheaderobj.CreatedDate = DateTime.Now.ToShortDateString();
            Orderheaderobj.OrderStatus = "Pending";
            Orderheaderobj.PaymentStatus = "Not Recived";
            Orderheaderobj.PermotionCode = obj.DiscountCoupan;
            Orderheaderobj.Userid = userid;
            Orderheaderobj.Discount = obj.DiscountAmmount;
            if (orderId > 0)
            {
                Orderheaderobj.orderID = orderId;
                return OrderDal.Update(Orderheaderobj);
            }
            else
            {
                return OrderDal.Create(Orderheaderobj);
            }
        }
コード例 #5
0
ファイル: CartDal.cs プロジェクト: issoftwaresoultion/Ecom
        public static CartModel AddItemTocart(int productPriceId, CartModel obj, string Currency, int? quantity, int? deliverId)
        {
            bool check = true;
            decimal total = 0;
            decimal MinFreeDeliverammount = 0;
            if (obj == null)
            {
                obj = new CartModel();
                obj.Product = new List<ProductModel>();
            }
            if (obj.Product == null)
            {
                obj.Product = new List<ProductModel>();
            }

            if (quantity.HasValue)
            {
                for (int i = 0; i < obj.Product.Count; i++)
                {
                    if (obj.Product[i].Price.Id == productPriceId)
                    {
                        obj.Product[i].Price.Quantity = Convert.ToInt32(quantity);
                        check = false;
                    }
                }
            }

            var context = new Ecommerce.DbEntity.ecommerceEntities();
            var productPrice = new ProductPriceModel();
            productPrice = ProductPricingDal.GetPriceByProductPriceId(productPriceId, Currency);

            var product = new ProductModel();
            product = ProductDal.GetById(productPrice.ProductId);
            product.Price = productPrice;
            if (check)
            {
                if (quantity.HasValue)
                {
                    product.Price.Quantity = Convert.ToInt32(quantity);
                }
                obj.Product.Add(product);

            }
            var deliveryCharges = new DeliveryModel();
            if (deliverId > 0)
            {
                deliveryCharges = DeliveryDal.GetById(Convert.ToInt32(deliverId));
            }
            else
            {
                if (obj.DelivierId == 0)
                {
                    deliveryCharges = DeliveryDal.GetDefault();
                }
                else
                {
                    deliveryCharges = DeliveryDal.GetById(Convert.ToInt32(obj.DelivierId));
                }
            }
            obj.DelivierDays = deliveryCharges.DeliveryDays;
            obj.DelivierId = deliveryCharges.id;
            if (Currency == "Dollar")
            {
                obj.DelivierCharges = (decimal)deliveryCharges.deliveryDoller;
                MinFreeDeliverammount = (decimal)deliveryCharges.freeDeliveryAmountDoller;
            }

            else if (Currency == "Pound")
            {
                obj.DelivierCharges = (decimal)deliveryCharges.deliveryPound;
                MinFreeDeliverammount = (decimal)deliveryCharges.freeDeliveryAmountPound;
            }
            else if (Currency == "Euro")
            {
                obj.DelivierCharges = (decimal)deliveryCharges.deliveryEuro;
                MinFreeDeliverammount = (decimal)deliveryCharges.freeDeliveryAmountEuro;
            }
            else if (Currency == "Naira")
            {
                obj.DelivierCharges = (decimal)deliveryCharges.deliveryNigria;
                MinFreeDeliverammount = (decimal)deliveryCharges.freeDeliveryAmountNigria;
            }
            else if (Currency == "Kwanza")
            {
                obj.DelivierCharges = (decimal)deliveryCharges.deliveryAngola;
                MinFreeDeliverammount = (decimal)deliveryCharges.freeDeliveryAmountAngola;
            }
            else if (Currency == "Cedi")
            {
                obj.DelivierCharges = (decimal)deliveryCharges.deliveryGhana;
                MinFreeDeliverammount = (decimal)deliveryCharges.freeDeliveryAmountGhana;
            }

            for (int i = 0; i < obj.Product.Count; i++)
            {
                decimal _total = Convert.ToDecimal(obj.Product[i].Price.Ourprice) * obj.Product[i].Price.Quantity;
                obj.Product[i].Price.TotalPrice = obj.Product[i].Price.Ourprice * obj.Product[i].Price.Quantity;
                total = total + _total;
                obj.Product[i].CountId = i;
            }
            obj.Difference = MinFreeDeliverammount - total;
            if (obj.Difference <= 0)
            {
                obj.Difference = 0;
            }

            obj.SubTotalTotal = total;
            obj.Total = total + obj.DelivierCharges;

            var validate = CoupanDal.ValidateCoupan(Convert.ToString(obj.DiscountCoupan));
            if (validate != null)
            {
                obj.DiscountCoupan = obj.DiscountCoupan;
                obj.DiscountAmmount = (validate.DiscountPercentage / obj.SubTotalTotal) * 100;
                obj.Total = obj.Total - obj.DiscountAmmount;
                obj.Total = Math.Round(obj.Total, 2);
                obj.DiscountAmmount = Math.Round(obj.DiscountAmmount, 2);
            }
            obj.AllProductPrice=0;
            foreach (var x in obj.Product)
            {
                obj.AllProductPrice = obj.AllProductPrice + x.Price.TotalPrice;
            }
            return obj;
        }
コード例 #6
0
        public ActionResult Ordersummery()
        {
            CartModel obj = new CartModel();
            obj.Product = new List<ProductModel>();
            var order = new OrderHeader();
            order.OrderDetail = new List<OrderDetail>();
            if (Session["OrderId"] != null)
            {
                order = OrderDal.GetByOrderId((int)Session["OrderId"]);
            }
            obj.Total = order.AmountInCurrencyChoosenByuser;
            obj.DelivierCharges = order.DeliveryCharges;
            foreach (var x in order.OrderDetail)
            {
                var productPrice = new ProductPriceModel();
                productPrice = ProductPricingDal.GetPriceByProductPriceId(x.ProductPriceId, Convert.ToString(Session["currency"]));
                var product = new ProductModel();
                product = ProductDal.GetById(productPrice.ProductId);
                var productModel = new ProductModel();
                productModel.Image = product.Image;
                productModel.Name = product.Name;
                productModel.Price = new ProductPriceModel();
                productModel.Price.Ourprice = x.ActualPriceInUserSeletedCurrency;
                productModel.Price.Quantity = x.Quantity;
                productModel.Price.LengthName = productPrice.LengthName;
                productModel.Price.ColorName = productPrice.ColorName;

                obj.Product.Add(productModel);
            }

            return PartialView(obj);
        }