From a5120e14b27921ea9804fd15bb7c30071a5b668c Mon Sep 17 00:00:00 2001 From: vfedosevich Date: Thu, 18 Dec 2014 03:09:23 -0800 Subject: [PATCH] ST fixes --- WebsitePanel/Database/update_db.sql | 411 +++++++++--------- .../SchedulerTasks/DomainExpirationTask.cs | 15 +- .../SchedulerTasks/DomainLookupViewTask.cs | 14 +- .../DomainLookup/DomainDnsChanges.cs | 1 + .../App_LocalResources/Domains.ascx.resx | 3 + .../WebsitePanel/Domains.ascx.cs | 11 +- 6 files changed, 242 insertions(+), 213 deletions(-) diff --git a/WebsitePanel/Database/update_db.sql b/WebsitePanel/Database/update_db.sql index 0b4c21ad..0b4b54b5 100644 --- a/WebsitePanel/Database/update_db.sql +++ b/WebsitePanel/Database/update_db.sql @@ -6200,91 +6200,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' - - Domain Expiration Information - - - -
- - -
- Domain Expiration Information -
- - -

-Hello #user.FirstName#, -

-
- -

-Please, find below details of your domain expiration information. -

- - - - - - - - - - - - - - - - - - -
DomainCustomerExpiration Date
#Domain.DomainName##Domain.Customer#Expired
- - -

- 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. -

- -

-Best regards +INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainExpirationLetter', N'HtmlBody', N' + + Domain Expiration Information + + + +

+ + +
+ Domain Expiration Information +
+ + +

+Hello #user.FirstName#, +

+
+ +

+Please, find below details of your domain expiration information. +

+ + + + + + + + + + + + + + + + + + +
DomainCustomerExpiration Date
#Domain.DomainName##Domain.Customer##Domain.ExpirationDate#
+ + +

+ 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. +

+ +

+Best regards

') END GO @@ -6313,7 +6313,7 @@ Please, find below details of your domain expiration information. Domain: #Domain.DomainName# Customer: #Domain.Customer# - Expiration Date: Expired + Expiration Date: #Domain.ExpirationDate# @@ -6348,76 +6348,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' - - MX and NS Changes Information - - - -
- - -
- MX and NS Changes Information -
- - -

-Hello #user.FirstName#, -

-
- -

-Please, find below details of MX and NS changes. -

- - -

#Domain.DomainName#

- - - - - - - - - - - - - - - - - - - - - - -
DNSTypeStatusOld ValueNew 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' + + MX and NS Changes Information + + + +

+ + +
+ MX and NS Changes Information +
+ + +

+Hello #user.FirstName#, +

+
+ +

+Please, find below details of MX and NS changes. +

+ + +

#Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName#

+ + + + + + + + + + + + + + + + + + + + + + +
DNSTypeStatusOld ValueNew 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 @@ -6440,20 +6440,19 @@ INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [Property Hello #user.FirstName#, -Please, find below MX and NS Changes Information. - +Please, find below details of MX and NS changes. - #Domain.DomainName# + #Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName# - DNS: #DnsChange.DnsServer# - Type: #DnsChange.Type# - Status: #DnsChange.Status# - Old Value: #DnsChange.OldRecord.Value# - New Value: #DnsChange.NewRecord.Value# + DNS: #DnsChange.DnsServer# + Type: #DnsChange.Type# + Status: #DnsChange.Status# + Old Value: #DnsChange.OldRecord.Value# + New Value: #DnsChange.NewRecord.Value# @@ -6468,48 +6467,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' - - MX and NS Changes Information - - - -
- - -
- MX and NS Changes Information -
- - -

-Hello #user.FirstName#, -

-
- -

-No MX and NS changes have been founded. -

- -

-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' + + MX and NS Changes Information + + + +

+ + +
+ MX and NS Changes Information +
+ + +

+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 9fb16aad..ef0cce8d 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainExpirationTask.cs @@ -32,7 +32,7 @@ namespace WebsitePanel.EnterpriseServer var checkedDomains = new List(); var expiredDomains = new List(); var nonExistenDomains = new List(); - var subDomains = new List(); + var allDomains = new List(); var allTopLevelDomains = new List(); // get input parameters @@ -58,7 +58,7 @@ namespace WebsitePanel.EnterpriseServer { var domains = ServerController.GetDomains(package.PackageId); - subDomains.AddRange(domains.Where(x => x.IsSubDomain)); + allDomains.AddRange(domains); domains = domains.Where(x => !x.IsSubDomain && !x.IsDomainPointer).ToList(); //Selecting top-level domains @@ -96,17 +96,24 @@ namespace WebsitePanel.EnterpriseServer } } - subDomains = subDomains.GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); + var subDomains = allDomains.Where(x => x.ExpirationDate == null || CheckDomainExpiration(x.ExpirationDate, daysBeforeNotify)).GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); allTopLevelDomains = allTopLevelDomains.GroupBy(p => p.DomainId).Select(g => g.First()).ToList(); foreach (var subDomain in subDomains) { - var mainDomain = allTopLevelDomains.Where(x => subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ; + var mainDomain = allTopLevelDomains.Where(x => subDomain.DomainId != x.DomainId && subDomain.DomainName.ToLowerInvariant().Contains(x.DomainName.ToLowerInvariant())).OrderByDescending(s => s.DomainName.Length).FirstOrDefault(); ; if (mainDomain != null) { ServerController.UpdateDomainRegistrationData(subDomain, mainDomain.CreationDate, mainDomain.ExpirationDate); + var nonExistenDomain = nonExistenDomains.FirstOrDefault(x => subDomain.DomainId == x.DomainId); + + if (nonExistenDomain != null) + { + nonExistenDomains.Remove(nonExistenDomain); + } + Thread.Sleep(100); } } diff --git a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs index 150c9c25..d21a92a7 100644 --- a/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs +++ b/WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Code/SchedulerTasks/DomainLookupViewTask.cs @@ -32,6 +32,7 @@ namespace WebsitePanel.EnterpriseServer BackgroundTask topTask = TaskManager.TopTask; List domainsChanges = new List(); + var domainUsers = new Dictionary(); // get input parameters string dnsServersString = (string)topTask.GetParamValue(DnsServersParameter); @@ -83,8 +84,16 @@ namespace WebsitePanel.EnterpriseServer continue; } + if (!domainUsers.ContainsKey(domain.PackageId)) + { + var domainUser = UserController.GetUser(packages.First(x=>x.PackageId == domain.PackageId).UserId); + + domainUsers.Add(domain.PackageId, domainUser); + } + DomainDnsChanges domainChanges = new DomainDnsChanges(); domainChanges.DomainName = domain.DomainName; + domainChanges.PackageId = domain.PackageId; var dbDnsRecords = ObjectUtils.CreateListFromDataReader(DataProvider.GetDomainAllDnsRecords(domain.DomainId)); @@ -109,7 +118,7 @@ namespace WebsitePanel.EnterpriseServer var changedDomains = FindDomainsWithChangedRecords(domainsChanges); - SendMailMessage(user, changedDomains); + SendMailMessage(user, changedDomains, domainUsers); } @@ -252,7 +261,7 @@ namespace WebsitePanel.EnterpriseServer Thread.Sleep(100); } - private void SendMailMessage(UserInfo user, IEnumerable domainsChanges) + private void SendMailMessage(UserInfo user, IEnumerable domainsChanges, Dictionary domainUsers) { BackgroundTask topTask = TaskManager.TopTask; @@ -286,6 +295,7 @@ namespace WebsitePanel.EnterpriseServer Hashtable items = new Hashtable(); items["user"] = user; + items["DomainUsers"] = domainUsers; items["Domains"] = domainsChanges; body = PackageController.EvaluateTemplate(body, items); diff --git a/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsChanges.cs b/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsChanges.cs index ff178e77..3f19ef39 100644 --- a/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsChanges.cs +++ b/WebsitePanel/Sources/WebsitePanel.Providers.Base/DomainLookup/DomainDnsChanges.cs @@ -8,6 +8,7 @@ namespace WebsitePanel.Providers.DomainLookup public class DomainDnsChanges { public string DomainName { get; set; } + public int PackageId { get; set; } public List DnsChanges { get; set; } diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/Domains.ascx.resx b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/Domains.ascx.resx index 3116414f..8ba7b6a4 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/Domains.ascx.resx +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/App_LocalResources/Domains.ascx.resx @@ -213,4 +213,7 @@ Non-Existent + + Current Real DNS Values + \ No newline at end of file diff --git a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs index da0f5a67..06fb93e2 100644 --- a/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs +++ b/WebsitePanel/Sources/WebsitePanel.WebPortal/DesktopModules/WebsitePanel/Domains.ascx.cs @@ -39,6 +39,7 @@ using System.Web.UI.HtmlControls; using System.Linq; using WebsitePanel.EnterpriseServer; +using System.Collections.Generic; namespace WebsitePanel.Portal { @@ -160,7 +161,15 @@ namespace WebsitePanel.Portal return "No Dns Records"; } - return string.Join("\r\n", records.Select(x=>string.Format("{0}: {1}", x.RecordType, x.Value))); + var header = GetLocalizedString("DomainLookup.TooltipHeader"); + + var tooltipLines = new List(); + + tooltipLines.Add(header); + tooltipLines.Add(" "); + tooltipLines.AddRange( records.Select(x=>string.Format("{0}: {1}", x.RecordType, x.Value))); + + return string.Join("\r\n", tooltipLines); } protected void odsDomainsPaged_Selected(object sender, ObjectDataSourceStatusEventArgs e)