/// <summary> /// GenerateEquipmentCriteria - returns EquipmentCriteriaDto /// </summary> /// <param name="locationId"></param> /// <returns></returns> public EquipmentCriteriaDto GenerateEquipmentCriteria(string locationId) { const string serial = "MRCC001A16B0"; EquipmentCriteriaDto eQDto = new EquipmentCriteriaDto(); eQDto.SerialNumber = serial; eQDto.LocationId = locationId; eQDto.Status = "ACTIVE"; eQDto.Model = "ONT1000M5"; eQDto.UnitAddress = "RDMDWAXAOL4-4-1-29"; eQDto.AssignedPhoneNumber = null; return eQDto; }
public static SubscriberDto UVerseSub2With1ActiveRgAnd1ActiveStb() { const string id = "S1002"; var subId = string.Format("STBJULEISUB{0}", id); var locId = string.Format("STBJULEILOC{0}", id); var stbSerial = string.Format("STBJULEI{0}", id); var rgSerial = string.Format("PACEJULEI{0}", id); var equipCriteria = new EquipmentCriteriaDto { LocationId = locId, SerialNumber = rgSerial, Model = "ARRIS RG", Status = "ACTIVE", UnitAddress = "001E46" }; // Restore location var loc = DefaultAddress(locId); RestoreLocation(loc); // Return unwanted equip to headend Return2Headend(loc.ID); // Restore RG var compositeEquipment = RestoreEquip(equipCriteria); var equipmentDto = new EquipmentDto { SerialNumber = stbSerial, Type = new EquipmentTypeDto { Model = "VIP2250", }, UnitAddress = "66A29F493EF843D69F8CB211D4181105", Status = "ACTIVE", LocationId = locId }; compositeEquipment.Add(equipmentDto); // Restore STB RestoreEquip(equipmentDto); var sub = new SubscriberDto { ID = subId, Name = subId, Accounts = new List<AccountDto> { new AccountDto { Location = loc, Equipment = compositeEquipment } }, CustomFields = new List<CustomFieldDto> { new CustomFieldDto{Label ="MAXSTB", Value = "5"}, } }; return RestoreSubscriber(sub); }
public static SubscriberDto RgTestSubWith1ActiveRg() { const string id = "90090001"; var subId = string.Format("SRGTESTSUB{0}", id); var locId = string.Format("SRGTESTLOC{0}", id); var rgSerial = string.Format("PACE{0}", id); var equipCriteria = new EquipmentCriteriaDto { LocationId = locId, SerialNumber = rgSerial, Model = "ARRIS RG", Status = "ACTIVE", UnitAddress = "001E46" }; var loc = DataHelper.DefaultAddress(locId); RestoreLocation1(loc, false); Return2Headend(locId); var rgEquip = RestoreEquip(equipCriteria); var sub = new SubscriberDto { ID = subId, Name = subId, Accounts = new List<AccountDto> { new AccountDto { Location = loc, Equipment = rgEquip, } } }; return RestoreSubscriber(sub); }
public static SubscriberDto RgTestSub2With1ActiveRg() { const string subId = "999000795551"; const string locId = "REN"; const string rgSerial = "PACE99999991"; var equipCriteria = new EquipmentCriteriaDto { LocationId = locId, SerialNumber = rgSerial, Model = "ARRIS RG", Status = "ACTIVE", UnitAddress = "001E46" }; var loc = new LocationDto { ID = locId, AddressLine1 = "19999 19TH AVE", CityName = "RENTON", StateName = "WA", ZipCode = "98999" }; RestoreLocation1(loc, false); Return2Headend(locId); var rgEquip = RestoreEquip(equipCriteria); var rgDataPort = rgEquip.FirstOrDefault(x => x.SerialNumber.Substring(x.SerialNumber.Length - 3, 3) == "D01"); Assert.IsNotNull(rgDataPort); rgDataPort.CustomFields = new List<CustomFieldDto> { new CustomFieldDto() { Label = "ENET_MAC_ADDR", Value = "A0:B1:C2:D3:E4:F5" } }; RestoreEquip(rgDataPort); var sub = new SubscriberDto { ID = subId, Name = "Cathy Copper", Accounts = new List<AccountDto> { new AccountDto { Location = loc, Equipment = rgEquip, } }, CustomFields = new List<CustomFieldDto> { new CustomFieldDto { Label = "WAN_IP_ADDR", Value = "10.129.96.213" } } }; return RestoreSubscriber(sub); }
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); }
/// <summary> /// Creates an EquipmentCriteriaDto object /// </summary> /// <param name="serialNumber">The serial number of the equipment</param> /// <param name="locationId">The location id of the equipment</param> /// <param name="unitAddress">The unit address/OUI of the equipment</param> /// <param name="macAddress">The ENET Mac address of the equipment</param> /// <param name="model">The model of the equipment</param> /// <param name="assignedTn">The telephone number of the equipment</param> /// <param name="status">The status of the equipment</param> /// <returns>An equipmentcriteriadto object</returns> public static EquipmentCriteriaDto CreateEquipmentCriteria(string serialNumber = null, string locationId = null, string unitAddress = null, string macAddress = null, string model = null, string assignedTn = null, string status = null) { var equipmentCriteria = new EquipmentCriteriaDto { SerialNumber = !string.IsNullOrWhiteSpace(serialNumber) ? serialNumber.ToUpper() : serialNumber, LocationId = !string.IsNullOrWhiteSpace(locationId) ? locationId.ToUpper() : locationId, UnitAddress = !string.IsNullOrWhiteSpace(unitAddress) ? unitAddress.ToUpper() : unitAddress, MacAddress = !string.IsNullOrWhiteSpace(macAddress) ? macAddress.ToUpper() : macAddress, Model = !string.IsNullOrWhiteSpace(model) ? model.ToUpper() : model, AssignedPhoneNumber = !string.IsNullOrWhiteSpace(assignedTn) ? assignedTn.ToUpper() : assignedTn, Status = !string.IsNullOrWhiteSpace(status) ? status.ToUpper() : status }; return equipmentCriteria; }