/// <summary>
		/// ctor the Mighty
		/// </summary>
		public SendToShopInProgressMessage(SendToShopOrder sendToShopOrder, Partner partner, PartnerSendToShopSettings partnerSendToShopSettings,
			IWebSettings webSettings)
		{
			this.SendToShopOrder = sendToShopOrder;
			this.Partner = partner;
			this.PartnerSendToShopSettings = partnerSendToShopSettings;

			this.FormatAsHtml = false;
			this.ToRecipients.Add(sendToShopOrder.EmailAddress);
			this.Subject = "IN-PROGRESS: Send-To-Shop Order #: " + sendToShopOrder.SendToShopOrderId;
			this.SenderAddress = webSettings.SenderAddress;
			this.SenderDisplayName = webSettings.SenderDisplayName;
		}
        /// <summary>
        /// ctor the Mighty
        /// </summary>
        public SendToShopConfirmationMessage(SendToShopOrder sendToShopOrder, Partner partner, PartnerSendToShopSettings partnerSendToShopSettings,
                                             IWebSettings webSettings)
        {
            this.SendToShopOrder           = sendToShopOrder;
            this.Partner                   = partner;
            this.PartnerSendToShopSettings = partnerSendToShopSettings;

            this.FormatAsHtml = false;
            this.ToRecipients.Add(sendToShopOrder.EmailAddress);
            this.Subject           = "Send-To-Shop Order #: " + sendToShopOrder.SendToShopOrderId;
            this.SenderAddress     = webSettings.SenderAddress;
            this.SenderDisplayName = webSettings.SenderDisplayName;
        }
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public SendToShopCancellationMessage(SendToShopOrder sendToShopOrder, Partner partner, PartnerSendToShopSettings partnerSendToShopSettings,
			IWebSettings webSettings)
		{
			this.SendToShopOrder = sendToShopOrder;
			this.Partner = partner;
			this.PartnerSendToShopSettings = partnerSendToShopSettings;
			this.WebSettings = webSettings;

			this.FormatAsHtml = false;
			this.ToRecipients.Add(sendToShopOrder.EmailAddress);
			this.Subject = "CANCELLED: Send-To-Shop Order #: " + sendToShopOrder.SendToShopOrderId;
			this.SenderAddress = webSettings.SenderAddress;
			this.SenderDisplayName = webSettings.SenderDisplayName;
		}
		/// <summary>
		/// ctor the Mighty
		/// </summary>
		public SendToShopOrderPartnerNotificationMessage(Partner partner, PartnerSendToShopSettings partnerSendToShopSettings, 
			SendToShopOrder sendToShopOrder, User user, IStringCryptoService stringCryptoService, IWebSettings webSettings,
			IRecipeDataService recipeDataService)
		{
			this.Partner = partner;
			this.SendToShopOrder = sendToShopOrder;
			this.User = user;
			this.StringCryptoService = stringCryptoService;
			this.WebSettings = webSettings;

			this.Ingredients = recipeDataService.GetAllPublicIngredients();

			// Message Setup
			this.FormatAsHtml = true;
			this.Subject = "Brewgr.com - Send-To-Shop Order #:" + sendToShopOrder.SendToShopOrderId;
			this.SenderAddress = webSettings.SenderAddress;
			this.SenderDisplayName = webSettings.SenderDisplayName;
			this.ToRecipients.Add(partnerSendToShopSettings.DeliveryEmailAddress);
		}
        /// <summary>
        /// ctor the Mighty
        /// </summary>
        public SendToShopOrderPartnerNotificationMessage(Partner partner, PartnerSendToShopSettings partnerSendToShopSettings,
                                                         SendToShopOrder sendToShopOrder, User user, IStringCryptoService stringCryptoService, IWebSettings webSettings,
                                                         IRecipeDataService recipeDataService)
        {
            this.Partner             = partner;
            this.SendToShopOrder     = sendToShopOrder;
            this.User                = user;
            this.StringCryptoService = stringCryptoService;
            this.WebSettings         = webSettings;

            this.Ingredients = recipeDataService.GetAllPublicIngredients();

            // Message Setup
            this.FormatAsHtml      = true;
            this.Subject           = "Brewgr.com - Send-To-Shop Order #:" + sendToShopOrder.SendToShopOrderId;
            this.SenderAddress     = webSettings.SenderAddress;
            this.SenderDisplayName = webSettings.SenderDisplayName;
            this.ToRecipients.Add(partnerSendToShopSettings.DeliveryEmailAddress);
        }
Ejemplo n.º 6
0
		public ActionResult SendToShopSettings(PartnerSendToShopSettings partnerSendToShopSettings)
		{
			var partner = this.GetPartnerIfAuthorized(partnerSendToShopSettings.PartnerId);
			if (partner == null)
			{
				return this.Issue404();
			}

			ViewBag.Title = partner.Name;

			using(var unitOfWork = this.UnitOfWorkFactory.NewUnitOfWork())
			{
				try
				{
					var currentSettings = this.PartnerService.GetPartnerSendToShopSettings(partnerSendToShopSettings.PartnerId);
					Mapper.Map(partnerSendToShopSettings, currentSettings);
					unitOfWork.Commit();
					return new EmptyResult();
				}
				catch(Exception ex)
				{
					unitOfWork.Rollback();
					this.LogHandledException(ex);
					return this.Issue500();
				}	
			}
		}