diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index a6bbcc6c..603f79f0 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -6195,6 +6195,12 @@ INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [D END GO +IF NOT EXISTS (SELECT * FROM [dbo].[ScheduleTaskParameters] WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'PAUSE_BETWEEN_QUERIES' ) +BEGIN +INSERT [dbo].[ScheduleTaskParameters] ([TaskID], [ParameterID], [DataTypeID], [DefaultValue], [ParameterOrder]) VALUES (N'SCHEDULE_TASK_DOMAIN_LOOKUP', N'PAUSE_BETWEEN_QUERIES', N'String', N'100', 4) +END +GO + IF EXISTS (SELECT * FROM [dbo].[ScheduleTaskParameters] WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'SERVER_NAME' ) BEGIN UPDATE [dbo].[ScheduleTaskParameters] SET [DefaultValue] = N'' WHERE [TaskID] = N'SCHEDULE_TASK_DOMAIN_LOOKUP' AND [ParameterID]= N'SERVER_NAME' @@ -6306,91 +6312,91 @@ END GO IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'DomainExpirationLetter' AND [PropertyName]= N'HtmlBody' ) BEGIN -INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainExpirationLetter', N'HtmlBody', N' -
--Hello #user.FirstName#, -
--Please, find below details of your domain expiration information. -
- -Domain | -Customer | -Expiration Date | -
---|---|---|
#Domain.DomainName# | -#Domain.Customer# | -#Domain.ExpirationDate# | -
- Please, find below details of your non-existen domains. -
- -Domain | -Customer | -
---|---|
#Domain.DomainName# | -#Domain.Customer# | -
-If you have any questions regarding your hosting account, feel free to contact our support department at any time. -
- --Best regards +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainExpirationLetter', N'HtmlBody', N' +
++Hello #user.FirstName#, +
++Please, find below details of your domain expiration information. +
+ +Domain | +Customer | +Expiration Date | +
---|---|---|
#Domain.DomainName# | +#Domain.Customer# | +#Domain.ExpirationDate# | +
+ Please, find below details of your non-existen domains. +
+ +Domain | +Customer | +
---|---|
#Domain.DomainName# | +#Domain.Customer# | +
+If you have any questions regarding your hosting account, feel free to contact our support department at any time. +
+ ++Best regards
') END GO @@ -6454,76 +6460,76 @@ END GO IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'DomainLookupLetter' AND [PropertyName]= N'HtmlBody' ) BEGIN -INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'HtmlBody', N' - --Hello #user.FirstName#, -
--Please, find below details of MX and NS changes. -
- -DNS | -Type | -Status | -Old Value | -New Value | -
---|---|---|---|---|
#DnsChange.DnsServer# | -#DnsChange.Type# | -#DnsChange.Status# | -#DnsChange.OldRecord.Value# | -#DnsChange.NewRecord.Value# | -
-If you have any questions regarding your hosting account, feel free to contact our support department at any time. -
- --Best regards +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'HtmlBody', N' +
++Hello #user.FirstName#, +
++Please, find below details of MX and NS changes. +
+ +DNS | +Type | +Status | +Old Value | +New Value | +
---|---|---|---|---|
#DnsChange.DnsServer# | +#DnsChange.Type# | +#DnsChange.Status# | +#DnsChange.OldRecord.Value# | +#DnsChange.NewRecord.Value# | +
+If you have any questions regarding your hosting account, feel free to contact our support department at any time. +
+ ++Best regards
') END GO @@ -6573,48 +6579,48 @@ END GO IF NOT EXISTS (SELECT * FROM [dbo].[UserSettings] WHERE [UserID] = 1 AND [SettingsName]= N'DomainLookupLetter' AND [PropertyName]= N'NoChangesHtmlBody' ) BEGIN -INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'NoChangesHtmlBody', N' - --Hello #user.FirstName#, -
--No MX and NS changes have been found. -
- --If you have any questions regarding your hosting account, feel free to contact our support department at any time. -
- --Best regards +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'NoChangesHtmlBody', N' +
++Hello #user.FirstName#, +
++No MX and NS changes have been found. +
+ ++If you have any questions regarding your hosting account, feel free to contact our support department at any time. +
+ ++Best regards
') END GO diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs index ef0cce8d..521d17be 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs @@ -181,9 +181,11 @@ namespace WebsitePanel.EnterpriseServer Hashtable items = new Hashtable(); items["user"] = user; + 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) }); + Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName) }) + .OrderBy(x => x.ExpirationDate).ThenBy(x => x.Customer).ThenBy(x => x.DomainName); items["IncludeNonExistenDomains"] = includeNonExistenDomains; @@ -191,7 +193,7 @@ namespace WebsitePanel.EnterpriseServer { DomainName = x.DomainName, Customer = string.Format("{0} {1}", domainUsers[x.PackageId].FirstName, domainUsers[x.PackageId].LastName) - }); + }).OrderBy(x => x.Customer).ThenBy(x => x.DomainName); body = PackageController.EvaluateTemplate(body, items); diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs index d5e042c1..b6a7b26d 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs @@ -23,6 +23,7 @@ namespace WebsitePanel.EnterpriseServer private static readonly string MailBodyTemplateParameter = "MAIL_BODY"; private static readonly string MailBodyDomainRecordTemplateParameter = "MAIL_DOMAIN_RECORD"; private static readonly string ServerNameParameter = "SERVER_NAME"; + private static readonly string PauseBetweenQueriesParameter = "PAUSE_BETWEEN_QUERIES"; private const string MxRecordPattern = @"mail exchanger = (.+)"; private const string NsRecordPattern = @"nameserver = (.+)"; @@ -40,7 +41,9 @@ namespace WebsitePanel.EnterpriseServer string dnsServersString = (string)topTask.GetParamValue(DnsServersParameter); string serverName = (string)topTask.GetParamValue(ServerNameParameter); - // check input parameters + int pause; + + // check input parameters if (String.IsNullOrEmpty(dnsServersString)) { TaskManager.WriteWarning("Specify 'DNS' task parameter."); @@ -53,6 +56,13 @@ namespace WebsitePanel.EnterpriseServer return; } + + if (!int.TryParse((string)topTask.GetParamValue(PauseBetweenQueriesParameter), out pause)) + { + TaskManager.WriteWarning("The 'pause between queries' parameter is not valid."); + return; + } + // find server by name ServerInfo server = ServerController.GetServerByName(serverName); if (server == null) @@ -102,8 +112,8 @@ namespace WebsitePanel.EnterpriseServer //execute server foreach (var dnsServer in dnsServers) { - var dnsMxRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.MX) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.MX).ToList(); - var dnsNsRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.NS) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.NS).ToList(); + var dnsMxRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.MX, pause) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.MX).ToList(); + var dnsNsRecords = GetDomainDnsRecords(winServer, domain.DomainName, dnsServer, DnsRecordType.NS, pause) ?? dbDnsRecords.Where(x => x.RecordType == DnsRecordType.NS).ToList(); FillRecordData(dnsMxRecords, domain, dnsServer); FillRecordData(dnsNsRecords, domain, dnsServer); @@ -306,8 +316,10 @@ namespace WebsitePanel.EnterpriseServer MailHelper.SendMessage(from, mailTo, bcc, subject, body, priority, isHtml); } - public List