public String LineCreate(string fkidx, orderline line) { order header = db.orders.Find(Convert.ToInt32(fkidx)); line.order = header; db.orderlines.Add(line); db.SaveChanges(); return(""); }
public Product(orderline p) { this.Id = p.idProduct; this.Type = new ProductType(p.product.producttype); this.Name = p.product.ProductName; this.Description = p.product.Description; this.ImagePath = p.product.ImagePath; this.Price = p.product.Price; this.offer = new SpecialOffer(p.specialoffer); this.Quantity = p.Quantity; }
public String LineDelete(string key) { if (ModelState.IsValid) { orderline data = db.orderlines.Find(Convert.ToInt32(key)); db.orderlines.Remove(data); db.SaveChanges(); return(""); } return(""); }
public String LineEdit(string fkidx, orderline line) { if (ModelState.IsValid) { order header = db.orders.Find(Convert.ToInt32(fkidx)); line.order = header; db.Entry(line).State = EntityState.Modified; db.SaveChanges(); return(""); } return(""); }
public ActionResult AddToCart(int id) { ShoppingCartActions shopping = new ShoppingCartActions(); orderline or = new orderline { idProduct_fk = id, qte = 1 }; shopping.addToCart(or); foreach (var item in shopping.getCurrentSessionOrderLines()) { System.Diagnostics.Debug.WriteLine(" order lines" + item.idProduct_fk + " " + item.qte); } return(RedirectToAction("Index")); }
public void addToCart(orderline orderlineP) { sessionID = GetCartId(); System.Diagnostics.Debug.WriteLine(" into cart with id : " + sessionID); int x = 0; for (int i = 0; i < globalList.Count(); i++) { if (globalList[i].idProduct_fk == orderlineP.idProduct_fk) { globalList[i].qte = globalList[i].qte + orderlineP.qte; System.Diagnostics.Debug.WriteLine(" qte finale " + globalList[i].qte); x = 1; } } if (x == 0) { globalList.Add(orderlineP); } HttpContext.Current.Session[CartSessionKey] = globalList; }
public int DispatchOrders(Dictionary <Models.Orders.Order, List <Models.Orders.OrderLine> > orderLines, Models.Vendors.Vendor vendor, AuditLog4Net.Adapter.IAuditLogAdapter log, DataAccess.UnitOfWork.IUnitOfWork uni) { var CustNo = vendor.VendorSettings.GetValueByKey("CopacoCustomerNo", string.Empty); var SenderID = vendor.VendorSettings.GetValueByKey("CopacoSenderID", string.Empty); var FtpUrl = vendor.VendorSettings.GetValueByKey("FtpUrl", string.Empty); var FtpUserName = vendor.VendorSettings.GetValueByKey("Username", string.Empty); var FtpPassword = vendor.VendorSettings.GetValueByKey("Password", string.Empty); var UploadDirectory = vendor.VendorSettings.GetValueByKey("UploadDirectory", string.Empty); Concentrator.Objects.Ordering.XmlClasses.Customer customer = new Concentrator.Objects.Ordering.XmlClasses.Customer(); customer.customerid = CustNo; foreach (var order in orderLines.Keys) { int count = 0; //new order XML_order orderxml = new XML_order(); orderxml.documentsource = "order_in"; orderxml.external_document_id = order.OrderID.ToString(); orderxml.supplier = "COPACO"; //order header with customer and shipping info orderheader header = new orderheader(); header.Customer = customer; // set customer header.completedelivery = "N"; header.requested_deliverydate = ""; header.customer_ordernumber = order.OrderID.ToString(); header.sender_id = SenderID; header.testflag = "Y"; header.recipientsreference = order.CustomerOrderReference; // shipping info ShipTo ship = new ShipTo(); adress adress = new adress(); adress.name1 = order.ShippedToCustomer.CustomerName; //overige ook toevoegen? adress.street = order.ShippedToCustomer.CustomerAddressLine1 + " " + order.ShippedToCustomer.HouseNumber; adress.postalcode = order.ShippedToCustomer.PostCode.Substring(0, 4) + " " + order.ShippedToCustomer.PostCode.Substring(4); adress.city = order.ShippedToCustomer.City; adress.country = order.ShippedToCustomer.Country; ship.Items = new adress[1]; ship.ItemsElementName = new ItemsChoiceType[1]; ship.ItemsElementName[0] = ItemsChoiceType.adress; ship.Items[0] = adress; #region future use //notification notification = new notification(); //ordertext ordertext = new ordertext(); //License_data license_data = new License_data(); //end_user_contact end_user_contact = new end_user_contact(); //header.notification = notification; //header.ordertext = new ordertext[1]; //header.ordertext[0] = ordertext; //header.License_data = license_data; //header.License_data.end_user_contact = end_user_contact; #endregion //orderline array orderxml.orderline = new orderline[order.OrderLines.Count]; //add basic info to xml orderxml.orderheader = header; orderxml.orderheader.ShipTo = ship; foreach (var itemOrder in order.OrderLines) { //add orderline orderline orderline = new orderline(); orderline.linenumber = itemOrder.OrderLineID.ToString(); orderline.item_id = new item_id[1]; orderline.item_id[0] = new item_id(); orderline.item_id[0].tag = "PN"; orderline.item_id[0].Value = itemOrder.Product.VendorAssortments.FirstOrDefault(x => x.VendorID == vendor.VendorID).CustomItemNumber; orderline.quantity = new quantity(); orderline.quantity.unit = "ST"; orderline.quantity.Value = itemOrder.GetDispatchQuantity().ToString(); //orderline.deliverydate = "";//DateTime.Today.AddDays(1).ToString("DD-MM-YYYY"); orderline.price = new price(); orderline.price.currency = "EUR"; orderline.price.Value = itemOrder.Price.Value.ToString().Replace(',', '.'); orderxml.orderline[count] = orderline; count++; } string fileName = string.Format("Order_{0}.xml", order.OrderID.ToString()); StringBuilder requestString = new StringBuilder(); XmlWriterSettings settings = new XmlWriterSettings(); settings.Encoding = Encoding.UTF8; using (XmlWriter xw = XmlWriter.Create(requestString, settings)) { xw.WriteProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); XmlSerializer serializer = new XmlSerializer(orderxml.GetType()); XmlSerializerNamespaces nm = new XmlSerializerNamespaces(); nm.Add("", ""); serializer.Serialize(xw, orderxml, nm); XmlDocument xml = new XmlDocument(); xml.LoadXml(requestString.ToString()); xml.DocumentElement.RemoveAttribute("xmlns:xsi"); xml.DocumentElement.RemoveAttribute("xmlns:xsd"); System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding(); byte[] file = encoding.GetBytes(xml.InnerXml.ToString()); SimpleFtp ftp = new SimpleFtp(FtpUrl, FtpUserName, FtpPassword, log, true); ftp.UploadFile(file, fileName, UploadDirectory); LogOrder(xml, vendor.VendorID, fileName, log); } } return(0); }