public static staticpage GetByHeading(String Heading) { var context = new Ecommerce.DbEntity.ecommerceEntities(); var obj = context.staticpages.Where(m => m.Heading == Heading).FirstOrDefault(); var sp = new staticpage(); sp.Content = obj.Content; sp.Groupby = obj.Groupby; sp.Heading = obj.Heading; sp.id = obj.id; return sp; }
public static bool Create(string email) { bool check = true; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); context.newletters.Add(new DbEntity.newletter { email = email }); context.SaveChanges(); } catch (Exception ex) { check = false; } return check; }
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 List<staticpage> GetBygroupId(string Group) { var context = new Ecommerce.DbEntity.ecommerceEntities(); var obj = context.staticpages.Where(m => m.Groupby == Group).ToList(); List<staticpage> sp = new List<staticpage> (); foreach (var x in obj) { sp.Add(new staticpage { Content=x.Content, Groupby=x.Groupby, Heading=x.Heading, id=x.id }); } return sp; }
public static bool Create(staticpage obj) { bool check = true; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); context.staticpages.Add(new DbEntity.staticpage { Content=obj.Content, Groupby=obj.Groupby, Heading=obj.Heading, }); context.SaveChanges(); } catch (Exception ex) { check = false; } return check; }
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 List<newletter> GetAllEmail() { var context = new Ecommerce.DbEntity.ecommerceEntities(); var NewsLetter = context.newletters.ToList(); return NewsLetter; }
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 static bool UpdatePaymentStatusInOrder(int orderid, string PaymantStatus, string TransId) { bool check = true; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); var Order = context.orderheaders.Where(m => m.orderID == orderid).FirstOrDefault(); Order.PaymentStatus = PaymantStatus; Order.TransId = TransId; context.SaveChanges(); } catch (Exception ex) { check = false; } return check; }
public static bool UpdateOrderStatus(int orderid, string trackingNumber, string Status) { bool check = true; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); var Order = context.orderheaders.Where(m => m.orderID == orderid).FirstOrDefault(); Order.TrackingNumber = trackingNumber; Order.OrderStatus = Status; context.SaveChanges(); } catch (Exception ex) { check = false; } return check; }
public static List<OrderHeader> GetOrderUserId(int UserId) { List<int> OrderIds = new List<int>(); List<OrderHeader> ListOrder = new List<OrderHeader>(); var context = new Ecommerce.DbEntity.ecommerceEntities(); OrderIds = context.orderheaders.Where(m => m.Userid == UserId).Select(m => m.orderID).ToList(); foreach (var x in OrderIds) { ListOrder.Add(GetByOrderId(x)); } return ListOrder; }
public static List<OrderHeader> GetOrdersByStatus(string Status, int Orderid) { List<OrderHeader> Order = new List<OrderHeader>(); if (Orderid > 0) { Order.Add(GetByOrderId(Orderid)); } else { var context = new Ecommerce.DbEntity.ecommerceEntities(); var obj = context.orderheaders.Where(m => m.OrderStatus == Status).Select(m => m.orderID).ToList(); foreach (var x in obj) { Order.Add(GetByOrderId(x)); } } return Order; }
public static bool Update(staticpage obj) { bool check = true; try { var context = new Ecommerce.DbEntity.ecommerceEntities(); var sp = context.staticpages.Where(m => m.id == obj.id).FirstOrDefault(); sp.Content = obj.Content; sp.Groupby = obj.Groupby; sp.Heading = obj.Heading; context.SaveChanges(); } catch (Exception ex) { check = false; } return check; }