public string ChangeStatus(int id = 0, int statusID = 0) { Profile p = ViewBag.profile; Cart order = new Cart(); order = order.GetByPayment(id); order.SetStatus(statusID, p.first + " " + p.last); return "success"; }
internal void ReadAcknowledgement(string editext) { List<string> purchaseOrderIDs = new List<string>(); Cart order = new Cart(); Settings settings = new Settings(); string EDIPOPreface = settings.Get("EDIPOPreface"); List<string> edilines = editext.Split('~').ToList<string>(); foreach (string line in edilines) { List<string> lineelements = line.Split('*').ToList<string>(); switch (lineelements[0]) { case "AK1": // Original Shipment Number from Shipper string purchaseOrderID = lineelements[2]; if (EDIPOPreface != "") { purchaseOrderID = purchaseOrderID.Replace(EDIPOPreface, ""); } if(!String.IsNullOrWhiteSpace(purchaseOrderID)) { purchaseOrderIDs.Add(purchaseOrderID); } break; } } foreach(string purchaseOrderID in purchaseOrderIDs) { if (!String.IsNullOrWhiteSpace(purchaseOrderID)) { try { order = new Cart().GetByPaymentID(Convert.ToInt32(purchaseOrderID)); order.SetStatus((int)OrderStatuses.Processed); OrderEDI edi = new OrderEDI().GetByOrderID(order.ID); if (edi != null && edi.ID > 0) { edi.SetAcknowledged(); } } catch { } } } }
internal void ReadShippingNotification(string editext) { string trackingcode = ""; string purchaseOrderID = ""; string shipmentNumber = ""; string weight = ""; Cart order = new Cart(); List<Shipment> shipments = new List<Shipment>(); DateTime shipdate = DateTime.Now; Settings settings = new Settings(); string EDIPOPreface = settings.Get("EDIPOPreface"); List<string> edilines = editext.Split('~').ToList<string>(); foreach (string line in edilines) { List<string> lineelements = line.Split('*').ToList<string>(); switch (lineelements[0]) { case "ST": // Beginning of invoice order = new Cart(); shipments = new List<Shipment>(); weight = ""; break; case "BSN": // Original Shipment Number from Shipper shipmentNumber = lineelements[2]; break; case "PRF": // Purchase Order Reference purchaseOrderID = lineelements[1]; if (EDIPOPreface != "") { purchaseOrderID = purchaseOrderID.Replace(EDIPOPreface, ""); } break; case "REF": // Tracking Code reference trackingcode = lineelements[2]; Shipment shipment = new Shipment { tracking_number = trackingcode }; shipments.Add(shipment); break; case "DTM": shipdate = Convert.ToDateTime(lineelements[2].Substring(4, 2) + "/" + lineelements[2].Substring(6, 2) + "/20" + lineelements[2].Substring(2, 2)); break; case "TD1": weight = lineelements[7] + " " + lineelements[8]; break; case "SE": // End of Invoice try { order = new Cart().GetByPaymentID(Convert.ToInt32(purchaseOrderID)); order.SetStatus((int)OrderStatuses.Shipped); foreach (Shipment s in shipments) { s.order_id = order.ID; s.dateShipped = shipdate; s.shipment_number = shipmentNumber; s.weight = weight; } EcommercePlatformDataContext db = new EcommercePlatformDataContext(); db.Shipments.InsertAllOnSubmit(shipments); db.SubmitChanges(); order.SendShippingNotification(); } catch { } break; } } }