public ItxOrderHelper(Order order, ShipAddress shipAddress) { _order = order; _orderItems = order.OrderLineItems.ToList(); _shipAddress = shipAddress; _itxOrder = new ItxOrder(); _itxFriendlyItems = GetComplemarFriendlyItems(); UnsentItems = new List<OrderLineItem>(); }
public ItxOrderHelper(Order order, ShipAddress shipAddress, int equipmentCatalog, string wtn = null) { _order = order; _orderItems = order.OrderLineItems.ToList(); _shipAddress = shipAddress; _itxOrder = new ItxOrder(); _itxFriendlyItems = GetComplemarFriendlyItems(); _equipmentCatalog = equipmentCatalog; _wtn = wtn; UnsentItems = new List<OrderLineItem>(); }
/// <summary> /// Deprecated Method for adding a new object to the ItxOrders EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToItxOrders(ItxOrder itxOrder) { base.AddObject("ItxOrders", itxOrder); }
/// <summary> /// Create a new ItxOrder object. /// </summary> /// <param name="itxOrderId">Initial value of the ItxOrderId property.</param> /// <param name="orderId">Initial value of the OrderId property.</param> /// <param name="generationDateTime">Initial value of the GenerationDateTime property.</param> /// <param name="productCatalogTypeId">Initial value of the ProductCatalogTypeId property.</param> /// <param name="productCatalogID">Initial value of the ProductCatalogID property.</param> /// <param name="orderStatusID">Initial value of the OrderStatusID property.</param> /// <param name="customerPhoneNumber">Initial value of the CustomerPhoneNumber property.</param> /// <param name="customerFirstName">Initial value of the CustomerFirstName property.</param> /// <param name="customerLastName">Initial value of the CustomerLastName property.</param> /// <param name="shipName1">Initial value of the ShipName1 property.</param> /// <param name="shipAddress1">Initial value of the ShipAddress1 property.</param> /// <param name="shipCity">Initial value of the ShipCity property.</param> /// <param name="shipState">Initial value of the ShipState property.</param> /// <param name="shipZip">Initial value of the ShipZip property.</param> /// <param name="product01SKU">Initial value of the Product01SKU property.</param> /// <param name="product01Qty">Initial value of the Product01Qty property.</param> public static ItxOrder CreateItxOrder(global::System.Int32 itxOrderId, global::System.Int32 orderId, global::System.String generationDateTime, global::System.Int32 productCatalogTypeId, global::System.Int32 productCatalogID, global::System.Int32 orderStatusID, global::System.String customerPhoneNumber, global::System.String customerFirstName, global::System.String customerLastName, global::System.String shipName1, global::System.String shipAddress1, global::System.String shipCity, global::System.String shipState, global::System.String shipZip, global::System.String product01SKU, global::System.String product01Qty) { ItxOrder itxOrder = new ItxOrder(); itxOrder.ItxOrderId = itxOrderId; itxOrder.OrderId = orderId; itxOrder.GenerationDateTime = generationDateTime; itxOrder.ProductCatalogTypeId = productCatalogTypeId; itxOrder.ProductCatalogID = productCatalogID; itxOrder.OrderStatusID = orderStatusID; itxOrder.CustomerPhoneNumber = customerPhoneNumber; itxOrder.CustomerFirstName = customerFirstName; itxOrder.CustomerLastName = customerLastName; itxOrder.ShipName1 = shipName1; itxOrder.ShipAddress1 = shipAddress1; itxOrder.ShipCity = shipCity; itxOrder.ShipState = shipState; itxOrder.ShipZip = shipZip; itxOrder.Product01SKU = product01SKU; itxOrder.Product01Qty = product01Qty; return itxOrder; }
public void Send(DefinedEmailType emailType, IEnumerable<string> addresses = null, ItxOrder itxOrder = null, int masterOrderId = 0, string userEmail = "", EquipmentCriteriaDto criteria = null, string manufacturer = null, Dictionary<string, string> migrationParams = null) { var message = new MailMessage(); var client = new SmtpClient(ConfigurationManager.AppSettings["MailServer"], 25); var body = new StringBuilder(); message.From = new MailAddress(ConfigurationManager.AppSettings["SupportEmail"]); // Add a CC list if this is not a CreateONT call if(!emailType.Equals(DefinedEmailType.CreateONT)) { // add user defined email addresses in "CC" field if (addresses != null) { foreach (var address in addresses.Where(address => !message.CC.Select(cc => cc.Address).Contains(address))) { message.CC.Add(new MailAddress(address)); } } // add the logged-in user as a CC if (!message.CC.Select(cc => cc.Address).Contains(userEmail)) { message.CC.Add(new MailAddress(userEmail)); } } // define message body and subject depending on the type of email being sent switch (emailType) { case DefinedEmailType.DropshipCancellationRequest: body.AppendLine("A SIMPL production support person has requested that a dropship order be cancelled."); body.AppendLine(); if (itxOrder != null && masterOrderId != 0) { body.AppendLine("The order information is:"); body.AppendLine(string.Format("Subscriber Name: {0}", itxOrder.ShipName1 + " " + itxOrder.ShipName2)); body.AppendLine(string.Format("Phone Number: {0}", "0" + masterOrderId)); body.AppendLine(string.Format("Address: {0}, {1} {2}, {3}, {4}", itxOrder.ShipAddress1, string.IsNullOrEmpty(itxOrder.ShipAddress2) ? "" : (itxOrder.ShipAddress2 + ","), itxOrder.ShipCity, itxOrder.ShipState, itxOrder.ShipZip)); body.AppendLine(); body.AppendLine(string.Format("Uploaded to DSL Order Tool server: {0}", itxOrder.SentDateTime)); } else { body.AppendLine("Please review this dropship cancellation attempt since the order information was missing from this request."); } body.AppendLine(); body.AppendLine("Please use \"Reply to All\" when forwarding or responding to this message."); message.Subject = "Dropship order cancellation request"; // add email addresses for those who are responsible for order cancellation in "To" field var toAddresses = GetRecipients("DropshipCancelEmailList"); foreach (var address in toAddresses) { message.To.Add(address.Trim()); } break; case DefinedEmailType.DropshipCancelledInSimplDB: if (masterOrderId != 0) { body.AppendLine("The order has been successfully cancelled in SIMPL"); Entity requestor; using (var db = new SIMPLEntities()) { requestor = db.Entities.FirstOrDefault( e => e.EntityId == db.MasterOrders.FirstOrDefault(m => m.MasterOrderId == masterOrderId).CreatingEntityId); } if (requestor != null) { message.CC.Add(new MailAddress(requestor.Email)); } } else { body.AppendLine("An order cancellation may not have been processed due to a missing masterOrderId. Please investigate."); } break; case DefinedEmailType.CreateONT: if (criteria != null) { var mfr = !string.IsNullOrEmpty(manufacturer) ? manufacturer : "Unknown"; body.AppendLine("Triad support,"); body.AppendLine(); body.AppendLine("An ONT/RG has been created in SIMPL with the following information:"); body.AppendLine("Manufacturer: " + mfr); body.AppendLine("Model: " + criteria.Model); body.AppendLine("Serial Number: "+ criteria.SerialNumber); body.AppendLine("Created by: " + userEmail); body.AppendLine("Date: " + System.DateTime.Now.ToString()); body.AppendLine(); body.AppendLine("Please verify other associated serial numbers have been added to Triad."); } else { body.AppendLine("An ONT has been created but the equipment information was left out from the notification. Please investigate."); } message.To.Add(new MailAddress(ConfigurationManager.AppSettings["SupportEmail"])); message.Subject = "Create ONT/RG confirmation"; break; case DefinedEmailType.MigrateSTB: if (migrationParams != null && migrationParams.Count > 0) { foreach (var migrationParam in migrationParams) { body.AppendLine(string.Format("{0}:{1}", migrationParam.Key, migrationParam.Value)); body.AppendLine(); } message.Subject = "ATT STB Migration Notification"; } // add email addresses for those who are responsible for order cancellation in "To" field foreach (var address in GetRecipients("MigrateStbEmailList")) { message.To.Add(address.Trim()); } break; case DefinedEmailType.MigrateVOIP: if (migrationParams != null && migrationParams.Count > 0) { foreach (var migrationParam in migrationParams) { body.AppendLine(string.Format("{0}:{1}", migrationParam.Key, migrationParam.Value)); body.AppendLine(); } message.Subject = "ATT VOIP Migration Notification"; } // add email addresses for those who are responsible for order cancellation in "To" field foreach (var address in GetRecipients("MigrateVoipEmailList")) { message.To.Add(address.Trim()); } break; } // add a signature body.AppendLine(); body.AppendLine("Thanks!"); body.AppendLine(); body.AppendLine("SIMPL auto-mailer"); message.Body = body.ToString(); // send the message client.Send(message); }