This commit is contained in:
vfedosevich 2014-12-18 03:09:23 -08:00
parent df814794a2
commit a5120e14b2
6 changed files with 242 additions and 213 deletions

View file

@ -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'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain Expiration Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
Domain Expiration Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
Please, find below details of your domain expiration information.
</p>
<table>
<thead>
<tr>
<th>Domain</th>
<th>Customer</th>
<th>Expiration Date</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#Domains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#Domain.Customer#</td>
<td>Expired</td>
</tr>
</ad:foreach>
</tbody>
</table>
<ad:if test="#IncludeNonExistenDomains#">
<p>
Please, find below details of your non-existen domains.
</p>
<table>
<thead>
<tr>
<th>Domain</th>
<th>Customer</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#NonExistenDomains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#Domain.Customer#</td>
</tr>
</ad:foreach>
</tbody>
</table>
</ad:if>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainExpirationLetter', N'HtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Domain Expiration Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
Domain Expiration Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
Please, find below details of your domain expiration information.
</p>
<table>
<thead>
<tr>
<th>Domain</th>
<th>Customer</th>
<th>Expiration Date</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#Domains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#Domain.Customer#</td>
<td>#Domain.ExpirationDate#</td>
</tr>
</ad:foreach>
</tbody>
</table>
<ad:if test="#IncludeNonExistenDomains#">
<p>
Please, find below details of your non-existen domains.
</p>
<table>
<thead>
<tr>
<th>Domain</th>
<th>Customer</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#NonExistenDomains#" var="Domain" index="i">
<tr>
<td>#Domain.DomainName#</td>
<td>#Domain.Customer#</td>
</tr>
</ad:foreach>
</tbody>
</table>
</ad:if>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
</p>')
END
GO
@ -6313,7 +6313,7 @@ Please, find below details of your domain expiration information.
<ad:foreach collection="#Domains#" var="Domain" index="i">
Domain: #Domain.DomainName#
Customer: #Domain.Customer#
Expiration Date: Expired
Expiration Date: #Domain.ExpirationDate#
</ad:foreach>
@ -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'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MX and NS Changes Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
MX and NS Changes Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
Please, find below details of MX and NS changes.
</p>
<ad:foreach collection="#Domains#" var="Domain" index="i">
<h2>#Domain.DomainName#</h2>
<table>
<thead>
<tr>
<th>DNS</th>
<th>Type</th>
<th>Status</th>
<th>Old Value</th>
<th>New Value</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#Domain.DnsChanges#" var="DnsChange" index="j">
<tr>
<td>#DnsChange.DnsServer#</td>
<td>#DnsChange.Type#</td>
<td>#DnsChange.Status#</td>
<td>#DnsChange.OldRecord.Value#</td>
<td>#DnsChange.NewRecord.Value#</td>
</tr>
</ad:foreach>
</tbody>
</table>
</ad:foreach>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'HtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MX and NS Changes Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
MX and NS Changes Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
Please, find below details of MX and NS changes.
</p>
<ad:foreach collection="#Domains#" var="Domain" index="i">
<h2>#Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName#</h2>
<table>
<thead>
<tr>
<th>DNS</th>
<th>Type</th>
<th>Status</th>
<th>Old Value</th>
<th>New Value</th>
</tr>
</thead>
<tbody>
<ad:foreach collection="#Domain.DnsChanges#" var="DnsChange" index="j">
<tr>
<td>#DnsChange.DnsServer#</td>
<td>#DnsChange.Type#</td>
<td>#DnsChange.Status#</td>
<td>#DnsChange.OldRecord.Value#</td>
<td>#DnsChange.NewRecord.Value#</td>
</tr>
</ad:foreach>
</tbody>
</table>
</ad:foreach>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
</p>')
END
GO
@ -6440,20 +6440,19 @@ INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [Property
Hello #user.FirstName#,
</ad:if>
Please, find below MX and NS Changes Information.
Please, find below details of MX and NS changes.
<ad:foreach collection="#Domains#" var="Domain" index="i">
#Domain.DomainName#
#Domain.DomainName# - #DomainUsers[Domain.PackageId].FirstName# #DomainUsers[Domain.PackageId].LastName#
<ad:foreach collection="#Domain.DnsChanges#" var="DnsChange" index="j">
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#
</ad:foreach>
</ad:foreach>
@ -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'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MX and NS Changes Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
MX and NS Changes Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
No MX and NS changes have been founded.
</p>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
INSERT [dbo].[UserSettings] ([UserID], [SettingsName], [PropertyName], [PropertyValue]) VALUES (1, N'DomainLookupLetter', N'NoChangesHtmlBody', N'<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MX and NS Changes Information</title>
<style type="text/css">
.Summary { background-color: ##ffffff; padding: 5px; }
.Summary .Header { padding: 10px 0px 10px 10px; font-size: 16pt; background-color: ##E5F2FF; color: ##1F4978; border-bottom: solid 2px ##86B9F7; }
.Summary A { color: ##0153A4; }
.Summary { font-family: Tahoma; font-size: 9pt; }
.Summary H1 { font-size: 1.7em; color: ##1F4978; border-bottom: dotted 3px ##efefef; }
.Summary H2 { font-size: 1.3em; color: ##1F4978; }
.Summary TABLE { border: solid 1px ##e5e5e5; }
.Summary TH,
.Summary TD.Label { padding: 5px; font-size: 8pt; font-weight: bold; background-color: ##f5f5f5; }
.Summary TD { padding: 8px; font-size: 9pt; }
.Summary UL LI { font-size: 1.1em; font-weight: bold; }
.Summary UL UL LI { font-size: 0.9em; font-weight: normal; }
</style>
</head>
<body>
<div class="Summary">
<a name="top"></a>
<div class="Header">
MX and NS Changes Information
</div>
<ad:if test="#user#">
<p>
Hello #user.FirstName#,
</p>
</ad:if>
<p>
No MX and NS changes have been found.
</p>
<p>
If you have any questions regarding your hosting account, feel free to contact our support department at any time.
</p>
<p>
Best regards
</p>')
END
GO

View file

@ -32,7 +32,7 @@ namespace WebsitePanel.EnterpriseServer
var checkedDomains = new List<int>();
var expiredDomains = new List<DomainInfo>();
var nonExistenDomains = new List<DomainInfo>();
var subDomains = new List<DomainInfo>();
var allDomains = new List<DomainInfo>();
var allTopLevelDomains = new List<DomainInfo>();
// 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);
}
}

View file

@ -32,6 +32,7 @@ namespace WebsitePanel.EnterpriseServer
BackgroundTask topTask = TaskManager.TopTask;
List<DomainDnsChanges> domainsChanges = new List<DomainDnsChanges>();
var domainUsers = new Dictionary<int, UserInfo>();
// 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<DnsRecordInfo>(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<DomainDnsChanges> domainsChanges)
private void SendMailMessage(UserInfo user, IEnumerable<DomainDnsChanges> domainsChanges, Dictionary<int, UserInfo> 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);

View file

@ -8,6 +8,7 @@ namespace WebsitePanel.Providers.DomainLookup
public class DomainDnsChanges
{
public string DomainName { get; set; }
public int PackageId { get; set; }
public List<DnsRecordInfoChange> DnsChanges { get; set; }

View file

@ -213,4 +213,7 @@
<data name="DomainExpirationDate.NotExist" xml:space="preserve">
<value>Non-Existent</value>
</data>
<data name="DomainLookup.TooltipHeader" xml:space="preserve">
<value>Current Real DNS Values</value>
</data>
</root>

View file

@ -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<string>();
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)