public ActionResult Update(OrderHeader obj ) { string orderStatus=Request.Form["OrderStatus"].ToString(); if (orderStatus == "Dispatched") { string url = "http://localhost:2585/payment/DispatchEmail/" + obj.orderID; //string url = "http://testing.issoftwaresolution.in/payment/DispatchEmail/" + obj.orderID; string emailMessage = Utility.GetResponse(url); Utility.SendEmail(obj.Email, emailMessage, "Order Dispatch", ConfigurationManager.AppSettings["WebsiteUrl"].ToString()); } OrderDal.UpdateOrderStatus(obj.orderID, obj.TrackingNumber, orderStatus); return RedirectToAction("GetOrderDetail", new { id = obj.orderID}); }
public static OrderHeader GetByOrderId(int id) { OrderHeader Order = new OrderHeader(); var context = new Ecommerce.DbEntity.ecommerceEntities(); var obj = context.orderheaders.Where(m => m.orderID == id).FirstOrDefault(); if (obj != null) { Order.ActualAmountPaid = obj.ActualAmountPaid; Order.AmountInCurrencyChoosenByuser = obj.ActualAmountPaid; Order.CreatedDate = obj.CreatedDate; Order.CurrencyChoosenByUser = obj.CurrencyChoosenByUser; Order.CurrencyInWhichAmmountPaid = obj.CurrencyInWhichAmmountPaid; Order.OrderStatus = obj.OrderStatus; Order.PaymentStatus = obj.PaymentStatus; Order.PermotionCode = obj.PermotionCode; Order.Userid = obj.Userid; Order.orderID = obj.orderID; Order.Name = obj.Name; Order.TotalProductCostInUserCurrency = Convert.ToDecimal(obj.TotalProductCostInUserCurrency); Order.TotalProductCostInConvertedrCurrency = Convert.ToDecimal(obj.TotalProductCostInConvertedrCurrency); Order.Discount = Convert.ToDecimal(obj.Discount); Order.DeliveryCharges = obj.DeliveryCharges; Order.Address1 = obj.Address1; Order.Address2 = obj.Address2; Order.City = obj.City; Order.ContactNumber = obj.ContactNumber; Order.Country = obj.Country; Order.DAddress1 = obj.DAddress1; Order.DAddress2 = obj.DAddress2; Order.DCity = obj.DCity; Order.DCountry = obj.DCountry; Order.DPostCode = obj.DPostCode; Order.DState = obj.DState; Order.Email = obj.Email; Order.Name = obj.Name; Order.PostCode = obj.PostCode; Order.State = obj.State; Order.TrackingNumber = obj.TrackingNumber; Order.TransId = obj.TransId; Order.OrderDetail = new List<OrderDetail>(); Order.OrderDetail = OrderDetailDal.GetByOrderId(Order.orderID, obj.CurrencyChoosenByUser); } else { Order = new OrderHeader(); } return Order; }
public static int Create(OrderHeader obj) { int orderId = 0; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); var Order = new DbEntity.orderheader(); Order.ActualAmountPaid = obj.ActualAmountPaid; Order.AmountInCurrencyChoosenByuser = obj.ActualAmountPaid; Order.CreatedDate = DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); Order.CurrencyChoosenByUser = obj.CurrencyChoosenByUser; Order.CurrencyInWhichAmmountPaid = obj.CurrencyInWhichAmmountPaid; Order.OrderStatus = obj.OrderStatus; Order.PaymentStatus = obj.PaymentStatus; Order.PermotionCode = obj.PermotionCode; Order.Userid = obj.Userid; Order.DeliveryCharges = obj.DeliveryCharges; Order.TransId = obj.TransId; Order.TotalProductCostInUserCurrency = obj.TotalProductCostInUserCurrency; Order.TotalProductCostInConvertedrCurrency = obj.TotalProductCostInConvertedrCurrency; Order.Discount = obj.Discount == null ? 0 : obj.Discount; context.orderheaders.Add(Order); context.SaveChanges(); orderId = Order.orderID; foreach (var x in obj.OrderDetail) { x.OrderId = orderId; OrderDetailDal.Create(x); } } catch (Exception ex) { orderId = 0; } return orderId; }
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); } }
internal static int Update(OrderHeader obj) { int orderId = obj.orderID; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); var Order = context.orderheaders.Where(m => m.orderID == obj.orderID).FirstOrDefault(); Order.ActualAmountPaid = obj.ActualAmountPaid; Order.AmountInCurrencyChoosenByuser = obj.ActualAmountPaid; Order.CreatedDate = DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); Order.CurrencyChoosenByUser = obj.CurrencyChoosenByUser; Order.CurrencyInWhichAmmountPaid = obj.CurrencyInWhichAmmountPaid; Order.OrderStatus = obj.OrderStatus; Order.PaymentStatus = obj.PaymentStatus; Order.PermotionCode = obj.PermotionCode; Order.Userid = obj.Userid; Order.DeliveryCharges = obj.DeliveryCharges; Order.TotalProductCostInUserCurrency = obj.TotalProductCostInUserCurrency; Order.TotalProductCostInConvertedrCurrency = obj.TotalProductCostInConvertedrCurrency; Order.Discount = obj.Discount == null ? 0 : obj.Discount; //context.orderheaders.Add(Order); context.SaveChanges(); var OrderDetail = context.orderdetails.Where(m => m.OrderId == obj.orderID).ToList(); foreach (orderdetail x in OrderDetail) { context.orderdetails.Remove(x); } foreach (var x in obj.OrderDetail) { x.OrderId = orderId; OrderDetailDal.Create(x); } context.SaveChanges(); } catch (Exception ex) { orderId = 0; } return orderId; }
public static bool UpdateUserAddressInOrder(OrderHeader obj) { bool check = true; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); var Order = context.orderheaders.Where(m => m.orderID == obj.orderID).FirstOrDefault(); Order.Address1 = obj.Address1; Order.Address2 = obj.Address2; Order.City = obj.City; Order.ContactNumber = obj.ContactNumber; Order.Country = obj.Country; Order.DAddress1 = obj.DAddress1; Order.DAddress2 = obj.DAddress2; Order.DCity = obj.DCity; Order.DCountry = obj.DCountry; Order.DPostCode = obj.DPostCode; Order.DState = obj.DState; Order.Email = obj.Email; Order.Name = obj.Name; Order.PostCode = obj.PostCode; Order.State = obj.State; context.SaveChanges(); } catch (Exception ex) { check = false; } return check; }
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); }