diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index aff39efa..c2c07f94 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -6218,6 +6218,12 @@ INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [D END GO +IF NOT EXISTS (SELECT * FROM [dbo].[ScheduleTaskParameters] WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_EXPIRATION' AND [ParameterID]= N'INCLUDE_NONEXISTEN_DOMAINS' ) +BEGIN +INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [DefaultValue], [ParameterOrder]) VALUES (N'SCHEDULE_TASK_DOMAIN_EXPIRATION', N'INCLUDE_NONEXISTEN_DOMAINS', N'Boolean', N'false', 4) +END +GO + -- Domain lookup tables @@ -6332,6 +6338,29 @@ Please, find below details of your domain expiration information. + +

+ Please, find below details of your non-existen domains. +

+ + + + + + + + + + + + + + + + +
DomainCustomer
#Domain.DomainName##Domain.Customer#
+
+

If you have any questions regarding your hosting account, feel free to contact our support department at any time. @@ -6358,9 +6387,7 @@ INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [Property Domain Expiration Information ================================= -

Hello #user.FirstName#, -

Please, find below details of your domain expiration information. @@ -6373,6 +6400,16 @@ Please, find below details of your domain expiration information. + +Please, find below details of your non-existen domains. + + + Domain: #Domain.DomainName# + Customer: #Domain.Customer# + + + + If you have any questions regarding your hosting account, feel free to contact our support department at any time. Best regards') diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs index 986118e4..f3cbf413 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs @@ -18,6 +18,7 @@ namespace WebsitePanel.EnterpriseServer private static readonly string DaysBeforeNotify = "DAYS_BEFORE"; private static readonly string MailToParameter = "MAIL_TO"; private static readonly string EnableNotification = "ENABLE_NOTIFICATION"; + private static readonly string IncludeNonExistenDomains = "INCLUDE_NONEXISTEN_DOMAINS"; private static readonly string MailBodyTemplateParameter = "MAIL_BODY"; @@ -28,16 +29,18 @@ namespace WebsitePanel.EnterpriseServer BackgroundTask topTask = TaskManager.TopTask; var domainUsers = new Dictionary(); var checkedDomains = new List(); + var expiredDomains = new List(); + var nonExistenDomains = new List(); // get input parameters int daysBeforeNotify; bool sendEmailNotifcation = Convert.ToBoolean( topTask.GetParamValue(EnableNotification)); + bool includeNonExistenDomains = Convert.ToBoolean(topTask.GetParamValue(IncludeNonExistenDomains)); // check input parameters if (String.IsNullOrEmpty((string)topTask.GetParamValue("MAIL_TO"))) { TaskManager.WriteWarning("The e-mail message has not been sent because 'Mail To' is empty."); - return; } @@ -47,7 +50,6 @@ namespace WebsitePanel.EnterpriseServer var packages = GetUserPackages(user.UserId, user.Role); - var expiredDomains = new List(); foreach (var package in packages) { @@ -81,6 +83,11 @@ namespace WebsitePanel.EnterpriseServer { expiredDomains.Add(domain); } + + if (domain.ExpirationDate == null && domain.CreationDate == null) + { + nonExistenDomains.Add(domain); + } } foreach (var subDomain in subDomains) @@ -98,7 +105,7 @@ namespace WebsitePanel.EnterpriseServer if (expiredDomains.Count > 0 && sendEmailNotifcation) { - SendMailMessage(user, expiredDomains, domainUsers); + SendMailMessage(user, expiredDomains, domainUsers, nonExistenDomains, includeNonExistenDomains); } } @@ -133,7 +140,7 @@ namespace WebsitePanel.EnterpriseServer return (date.Value - DateTime.Now).Days < daysBeforeNotify; } - private void SendMailMessage(UserInfo user, IEnumerable domains, Dictionary domainUsers) + private void SendMailMessage(UserInfo user, IEnumerable domains, Dictionary domainUsers, IEnumerable nonExistenDomains, bool includeNonExistenDomains) { BackgroundTask topTask = TaskManager.TopTask; @@ -160,6 +167,15 @@ namespace WebsitePanel.EnterpriseServer items["Domains"] = domains.Select(x => new { DomainName = x.DomainName, ExpirationDate = x.ExpirationDate, Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName) }); + + items["IncludeNonExistenDomains"] = includeNonExistenDomains; + + items["NonExistenDomains"] = nonExistenDomains.Select(x => new + { + DomainName = x.DomainName, + Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName) + }); + body = PackageController.EvaluateTemplate(body, items); diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/App_LocalResources/DomainExpirationView.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/App_LocalResources/DomainExpirationView.ascx.resx index 85ff7ae2..e5d6418b 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/App_LocalResources/DomainExpirationView.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/App_LocalResources/DomainExpirationView.ascx.resx @@ -120,6 +120,9 @@ Enable Client Notification + + Include Non-Existen Domains + Notify before (days) diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx index b74c3128..9f341587 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx @@ -10,6 +10,14 @@
+ + + + + +
+ + diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx.cs index e5e12907..80aaaf00 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx.cs @@ -14,6 +14,7 @@ namespace WebsitePanel.Portal.ScheduleTaskControls private static readonly string DaysBeforeParameter = "DAYS_BEFORE"; private static readonly string MailToParameter = "MAIL_TO"; private static readonly string EnableNotificationParameter = "ENABLE_NOTIFICATION"; + private static readonly string IncludeNonExistenDomainsParameter = "INCLUDE_NONEXISTEN_DOMAINS"; protected void Page_Load(object sender, EventArgs e) { @@ -31,6 +32,7 @@ namespace WebsitePanel.Portal.ScheduleTaskControls this.SetParameter(this.txtDaysBeforeNotify, DaysBeforeParameter); this.SetParameter(this.txtMailTo, MailToParameter); this.SetParameter(this.cbEnableNotify, EnableNotificationParameter); + this.SetParameter(this.cbIncludeNonExistenDomains, IncludeNonExistenDomainsParameter); } /// @@ -42,8 +44,9 @@ namespace WebsitePanel.Portal.ScheduleTaskControls ScheduleTaskParameterInfo daysBefore = this.GetParameter(this.txtDaysBeforeNotify, DaysBeforeParameter); ScheduleTaskParameterInfo mailTo = this.GetParameter(this.txtMailTo, MailToParameter); ScheduleTaskParameterInfo enableNotification = this.GetParameter(this.cbEnableNotify, EnableNotificationParameter); + ScheduleTaskParameterInfo includeNonExistenDomains = this.GetParameter(this.cbIncludeNonExistenDomains, IncludeNonExistenDomainsParameter); - return new ScheduleTaskParameterInfo[3] { daysBefore, mailTo, enableNotification }; + return new ScheduleTaskParameterInfo[4] { daysBefore, mailTo, enableNotification, includeNonExistenDomains }; } } } \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx.designer.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx.designer.cs index 994ed328..27ee5ba7 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx.designer.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/ScheduleTaskControls/DomainExpirationView.ascx.designer.cs @@ -30,6 +30,24 @@ namespace WebsitePanel.Portal.ScheduleTaskControls { /// protected global::System.Web.UI.WebControls.CheckBox cbEnableNotify; + /// + /// lblSendNonExistenDomains control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblSendNonExistenDomains; + + /// + /// cbIncludeNonExistenDomains control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox cbIncludeNonExistenDomains; + /// /// lblMailTo control. ///