public void FindNoReplyMailSenderUserTest() { var user = MembershipManagementService.FindNoReplyMailSenderUser(); Assert.IsTrue(user != null, "Error: A NULL value was returned when an object was expected"); Assert.IsTrue(user.EMail.IsValidEMail(), $"Error: EMail '{user.EMail}' was returned when a valid EMail address was expected"); }
public Error CheckCompanyForPassedUnpackDates(CompanyModel company) { var error = new Error(); foreach (var undeliveredOrder in PurchasingService.FindUndeliveredPurchaseOrders(company).Items) { string errorMsg = ""; var users = PurchasingService.FindOrderPurchasers(undeliveredOrder, company, undeliveredOrder.OrderNumber.Value, ref errorMsg); if (users == null) { WriteTaskLog(errorMsg, LogSeverity.Severe); } else { // Send an email Dictionary <string, string> dict = new Dictionary <string, string>(); dict.AddProperty("PURCHASEORDERNO", undeliveredOrder.OrderNumber.ToString()); dict.AddProperty("COMPANYNAME", company.FriendlyName); var purchaser = MembershipManagementService.FindUserModel(undeliveredOrder.SalespersonId.Value); dict.AddProperty("PURCHASER", (purchaser == null ? "" : purchaser.FullName)); dict.AddProperty("REALISTICETA", (undeliveredOrder.RealisticRequiredDate == null ? "" : undeliveredOrder.RealisticRequiredDate.Value.ToString(company.DateFormat))); var supplier = SupplierService.FindSupplierModel(undeliveredOrder.SupplierId.Value); dict.AddProperty("SUPPLIER", supplier.Name); string url = GetConfigSetting("SiteHttp", ""); url += "/Purchasing/Purchasing/Edit?id=" + undeliveredOrder.Id.ToString(); dict.AddProperty("URL", url); error = SendMessage(company, MembershipManagementService.FindNoReplyMailSenderUser(), MessageTemplateType.UndeliveredPurchaseNotification, TaskType.Default, users, dict); } } return(error); }