Initial project's source code check-in.
This commit is contained in:
commit
b03b0b373f
4573 changed files with 981205 additions and 0 deletions
2784
WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Reports/OverusageReport.Designer.cs
generated
Normal file
2784
WebsitePanel/Sources/WebsitePanel.EnterpriseServer.Base/Reports/OverusageReport.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,437 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer.Base.Reports
|
||||
{
|
||||
public partial class OverusageReport
|
||||
{
|
||||
#region BandwidthOverusageRow Extension Functions
|
||||
public partial class BandwidthOverusageRow
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="BandwidthOverusageRow"/> using the <see cref="OverusageReport"/>
|
||||
/// DataSet from a row that contains information about bandwidth usage.
|
||||
/// </summary>
|
||||
/// <param name="report">Instance of <see cref="OverusageReport"/> class.</param>
|
||||
/// <param name="hostingSpaceDataRow">DataRow with bandwidth information.</param>
|
||||
/// <returns><see cref="BandwidthOverusageRow"/>.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/> or either <paramref name="hostingSpaceDataRow"/> is <code>null</code>.</exception>
|
||||
public static BandwidthOverusageRow CreateFromHostingSpaceDataRow(OverusageReport report, DataRow hostingSpaceDataRow)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
if (hostingSpaceDataRow == null)
|
||||
{
|
||||
throw new ArgumentNullException("hostingSpaceDataRow");
|
||||
}
|
||||
|
||||
BandwidthOverusageRow row = report.BandwidthOverusage.NewBandwidthOverusageRow();
|
||||
|
||||
row.HostingSpaceId = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceDataRow["PackageID"].ToString(), 0);
|
||||
row.Allocated = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceDataRow["QuotaValue"].ToString(), 0);
|
||||
row.Used = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceDataRow["Bandwidth"].ToString(), 0);
|
||||
row.Usage = (row.Used - row.Allocated);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates <see cref="BandwidthOverusageRow"/> using <see cref="PackageInfo"/> as a data source.
|
||||
/// </summary>
|
||||
/// <param name="report">Current <see cref="OverusageReport"/> dataset.</param>
|
||||
/// <param name="packageInfo"><see cref="PackageInfo"/> instance.</param>
|
||||
/// <returns><see cref="BandwidthOverusageRow"/> instance.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/> or either <paramref name="packageInfo"/> is <code>null</code>.</exception>
|
||||
public static BandwidthOverusageRow CreateFromPackageInfo(OverusageReport report, PackageInfo packageInfo)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
|
||||
if (packageInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("packageInfo");
|
||||
}
|
||||
|
||||
BandwidthOverusageRow row = report.BandwidthOverusage.NewBandwidthOverusageRow();
|
||||
|
||||
row.HostingSpaceId = packageInfo.PackageId;
|
||||
row.Allocated = packageInfo.BandWidthQuota;
|
||||
row.Used = packageInfo.BandWidth;
|
||||
row.Usage = (row.Used - row.Allocated);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region OverusageDetailsRow Extension methods
|
||||
public partial class OverusageDetailsRow
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates <see cref="OverusageDetailsRow"/> using the information about Hosting Space disk space.
|
||||
/// </summary>
|
||||
/// <param name="report"><see cref="OverusageReport"/> data set. Current report.</param>
|
||||
/// <param name="packageDiskspaceRow"><see cref="DataRow"/> containing the Hosting Space disk space information.</param>
|
||||
/// <param name="hostingSpaceId">Hosting Space id.</param>
|
||||
/// <param name="overusageType">Type of overusage, can be Diskspace, Bandwidth, etc.</param>
|
||||
/// <returns>An instance of <see cref="OverusageDetailsRow"/>.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/>, <paramref name="packageDiskspaceRow"/> or <paramref name="overusageType"/> is null.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">When <paramref name="hostingSpaceId"/> less then 1.</exception>
|
||||
public static OverusageDetailsRow CreateFromPackageDiskspaceRow(OverusageReport report, DataRow packageDiskspaceRow, long hostingSpaceId, string overusageType)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
if (packageDiskspaceRow == null)
|
||||
{
|
||||
throw new ArgumentNullException("packageDiskspaceRow");
|
||||
}
|
||||
if (String.IsNullOrEmpty(overusageType))
|
||||
{
|
||||
throw new ArgumentNullException("overusageType");
|
||||
}
|
||||
|
||||
if (hostingSpaceId < 1)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
"hostingSpaceId"
|
||||
, String.Format(
|
||||
"Hosting Space Id cannot be less then 1, however it is {0}."
|
||||
, hostingSpaceId
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
OverusageDetailsRow row = report.OverusageDetails.NewOverusageDetailsRow();
|
||||
|
||||
row.HostingSpaceId = hostingSpaceId;
|
||||
row.OverusageType = overusageType;
|
||||
row.ResourceGroupName = OverusageReportUtils.GetStringOrDefault(packageDiskspaceRow, "GroupName", "Files");
|
||||
row.Used = OverusageReportUtils.GetLongValueOrDefault(packageDiskspaceRow["Diskspace"].ToString(), 0);
|
||||
row.Allowed = 0;
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates <see cref="OverusageDetailsRow"/> using information about Hosting Space bandwidth.
|
||||
/// </summary>
|
||||
/// <param name="report">Current <see cref="OverusageReport"/> instance.</param>
|
||||
/// <param name="bandwidthRow"><see cref="DataRow"/> containing information about Hosting Space bandwidth.</param>
|
||||
/// <param name="hostingSpaceId">Hosting Space Id.</param>
|
||||
/// <param name="overusageType">Type of overusage. Diskspace, Bandwidth, etc.</param>
|
||||
/// <returns><see cref="OverusageDetailsRow"/> filled from <paramref name="bandwidthRow"/>.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/>, <paramref name="bandwidthRow"/> or <paramref name="overusageType"/> is null.</exception>
|
||||
/// <exception cref="ArgumentOutOfRangeException">When <paramref name="hostingSpaceId"/> less then 1.</exception>
|
||||
public static OverusageDetailsRow CreateFromBandwidthRow(OverusageReport report, DataRow bandwidthRow, long hostingSpaceId, string overusageType)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
if (bandwidthRow == null)
|
||||
{
|
||||
throw new ArgumentNullException("bandwidthRow");
|
||||
}
|
||||
if (String.IsNullOrEmpty(overusageType))
|
||||
{
|
||||
throw new ArgumentNullException("overusageType");
|
||||
}
|
||||
|
||||
if (hostingSpaceId < 1)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
"hostingSpaceId"
|
||||
, String.Format(
|
||||
"Hosting Space Id cannot be less then 1, however it is {0}."
|
||||
, hostingSpaceId
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
OverusageDetailsRow row = report.OverusageDetails.NewOverusageDetailsRow();
|
||||
|
||||
row.HostingSpaceId = hostingSpaceId;
|
||||
row.OverusageType = overusageType;
|
||||
row.ResourceGroupName = OverusageReportUtils.GetStringOrDefault(bandwidthRow, "GroupName", "Files");
|
||||
row.Used = OverusageReportUtils.GetLongValueOrDefault(bandwidthRow["MegaBytesSent"].ToString(), 0);
|
||||
row.AdditionalField = OverusageReportUtils.GetLongValueOrDefault(bandwidthRow["MegaBytesReceived"].ToString(), 0);
|
||||
row.Allowed = 0;
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region HostingSpaceRow Extension functions
|
||||
public partial class HostingSpaceRow
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a package id
|
||||
/// </summary>
|
||||
/// <param name="hostingSpaceRow"><see cref="DataRow"/> containing information about Hosting Space</param>
|
||||
/// <returns>Hosting space ID.</returns>
|
||||
/// <exception cref="ArgumentOutOfRangeException">When DataRow does not contain PackageID field or this field contains value less then 1.</exception>
|
||||
public static long GetPackageId(DataRow hostingSpaceRow)
|
||||
{
|
||||
long hostingSpaceId = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceRow["PackageID"].ToString(), 0);
|
||||
if (hostingSpaceId < 1)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
"hostingSpaceId"
|
||||
, String.Format(
|
||||
"PackageID field is either empty or contains incorrect value. Received package ID value: {0}."
|
||||
, hostingSpaceId
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return hostingSpaceId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates <see cref="HostingSpaceRow"/> using <see cref="PackageInfo"/>.
|
||||
/// </summary>
|
||||
/// <param name="report">Current <see cref="OverusageReport"/>.</param>
|
||||
/// <param name="packageInfo">Information about Hosting Space</param>
|
||||
/// <param name="userInfo">Information about user <paramref name="packageInfo"/> belongs to.</param>
|
||||
/// <param name="serverInfo">Information about server. Physical storage of a hosting space described in <paramref name="packageInfo"/></param>
|
||||
/// <param name="isDiskspaceOverused">Indicates whether disk space is overused.</param>
|
||||
/// <param name="isBandwidthOverused">Indicates whether bandwidht is overused.</param>
|
||||
/// <param name="packageFullTree">File system -like path of the location of a hosting space described in <paramref name="packageInfo"/></param>
|
||||
/// <returns><see cref="HostingSpaceRow"/> instance.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/>, <paramref name="packageInfo"/>, <paramref name="userInfo"/> or <paramref name="serverInfo"/> is null.</exception>
|
||||
public static HostingSpaceRow CreateFromPackageInfo(OverusageReport report, PackageInfo packageInfo, UserInfo userInfo, ServerInfo serverInfo,bool isDiskspaceOverused, bool isBandwidthOverused, string packageFullTree)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
if (packageInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("packageInfo");
|
||||
}
|
||||
if (userInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("userInfo");
|
||||
}
|
||||
if (serverInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("serverInfo");
|
||||
}
|
||||
|
||||
|
||||
HostingSpaceRow row = report.HostingSpace.NewHostingSpaceRow();
|
||||
|
||||
row.IsBandwidthOverused = isBandwidthOverused;
|
||||
row.IsDiskspaceOverused = isDiskspaceOverused;
|
||||
|
||||
row.HostingSpaceName = packageInfo.PackageName;
|
||||
row.UserEmail = userInfo.Username;
|
||||
row.UserName = userInfo.Email;
|
||||
row.ChildSpaceQuantity = 1;
|
||||
row.UserId = packageInfo.UserId;
|
||||
row.HostingSpaceId = packageInfo.PackageId;
|
||||
row.Status = packageInfo.StatusId.ToString();
|
||||
row.HostingSpaceFullTreeName = packageFullTree;
|
||||
row.HostingSpaceCreationDate = packageInfo.PurchaseDate;
|
||||
row.Location = serverInfo.ServerName;
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creating <see cref="HostingSpaceRow"/> from DataRow containing data about Hosting Space
|
||||
/// </summary>
|
||||
/// <param name="report">Current <see cref="OverusageReport"/></param>
|
||||
/// <param name="hostingSpaceRow"><see cref="DataRow"/> containing information about Hosting Space.</param>
|
||||
/// <param name="isDiskspaceOverused">Indicates whether disk space is overused.</param>
|
||||
/// <param name="isBandwidthOverused">Indicates whether bandwidth is overusaed.</param>
|
||||
/// <param name="packageFullTree">File system -like path to hosting space described by <paramref name="hostingSpaceRow"/></param>
|
||||
/// <returns><see cref="HostingSpaceRow"/> instance.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/> or <paramref name="hostingSpaceRow"/> is null.</exception>
|
||||
public static HostingSpaceRow CreateFromHostingSpacesRow(OverusageReport report, DataRow hostingSpaceRow, bool isDiskspaceOverused, bool isBandwidthOverused, string packageFullTree)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
if (hostingSpaceRow == null)
|
||||
{
|
||||
throw new ArgumentNullException("hostingSpaceRow");
|
||||
}
|
||||
|
||||
HostingSpaceRow row = report.HostingSpace.NewHostingSpaceRow();
|
||||
|
||||
row.IsBandwidthOverused = isBandwidthOverused;
|
||||
row.IsDiskspaceOverused = isDiskspaceOverused;
|
||||
|
||||
row.HostingSpaceName = OverusageReportUtils.GetStringOrDefault(hostingSpaceRow, "PackageName", String.Empty);
|
||||
row.UserEmail = OverusageReportUtils.GetStringOrDefault(hostingSpaceRow, "Email", String.Empty);
|
||||
row.UserName = OverusageReportUtils.GetStringOrDefault(hostingSpaceRow, "Username", String.Empty);
|
||||
row.UserId = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceRow["UserId"].ToString(), 0);
|
||||
row.HostingSpaceId = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceRow["PackageID"].ToString(), 0);
|
||||
row.ChildSpaceQuantity = (int)OverusageReportUtils.GetLongValueOrDefault(hostingSpaceRow["PackagesNumber"].ToString(), 0);
|
||||
row.Status = hostingSpaceRow["StatusID"].ToString();
|
||||
row.HostingSpaceFullTreeName = packageFullTree;
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify whether <paramref name="hostingSpacesRow"/> contains child spaces.
|
||||
/// </summary>
|
||||
/// <param name="hostingSpacesRow"><see cref="DataRow"/> containing information about Hosting Space.</param>
|
||||
/// <returns>True it Hosting space contains child spaces. Otherwise, False.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="hostingSpacesRow"/> is null.</exception>
|
||||
public static bool IsContainChildSpaces(DataRow hostingSpacesRow)
|
||||
{
|
||||
if (hostingSpacesRow == null)
|
||||
{
|
||||
throw new ArgumentNullException("hostingSpacesRow");
|
||||
}
|
||||
|
||||
return OverusageReportUtils.GetLongValueOrDefault(hostingSpacesRow["PackagesNumber"].ToString(), 0) > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify is disk space is overused by a Hosting Space.
|
||||
/// </summary>
|
||||
/// <param name="hostingSpacesRow"><see cref="DataRow"/> containing information about Hosting Space.</param>
|
||||
/// <returns>True, if Hosting Space overuses disk space quota. Otherwise, False.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="hostingSpacesRow"/> is null.</exception>
|
||||
public static bool VerifyIfDiskspaceOverused(DataRow hostingSpacesRow)
|
||||
{
|
||||
if (hostingSpacesRow == null)
|
||||
{
|
||||
throw new ArgumentNullException("hostingSpacesRow");
|
||||
}
|
||||
|
||||
long
|
||||
allocated = OverusageReportUtils.GetLongValueOrDefault(hostingSpacesRow["QuotaValue"].ToString(), 0),
|
||||
used = OverusageReportUtils.GetLongValueOrDefault(hostingSpacesRow["Diskspace"].ToString(), 0);
|
||||
|
||||
return (used > allocated);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Vefiry if bandwidth is overused by Hosting Space
|
||||
/// </summary>
|
||||
/// <param name="hostingSpacesRow"><see cref="DataRow"/> containing bandwidth information about Hosting Space.</param>
|
||||
/// <returns>True, if bandwidth is overused by a Hosting Space. Otherwise, False.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="hostingSpacesRow"/> is null.</exception>
|
||||
public static bool VerifyIfBandwidthOverused(DataRow hostingSpacesRow)
|
||||
{
|
||||
if (hostingSpacesRow == null)
|
||||
{
|
||||
throw new ArgumentNullException("hostingSpacesRow");
|
||||
}
|
||||
|
||||
long
|
||||
allocated = OverusageReportUtils.GetLongValueOrDefault(hostingSpacesRow["QuotaValue"].ToString(), 0),
|
||||
used = OverusageReportUtils.GetLongValueOrDefault(hostingSpacesRow["Bandwidth"].ToString(), 0);
|
||||
|
||||
return (used > allocated);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region DiskspaceOverusageRow extension functions
|
||||
public partial class DiskspaceOverusageRow
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates <see cref="DiskspaceOverusageRow"/> from Hosting Space row.
|
||||
/// </summary>
|
||||
/// <param name="report">Current <paramref name="OverusageReport"/></param>
|
||||
/// <param name="hostingSpaceRow"><see cref="DataRow"/> containing Hosting Space information.</param>
|
||||
/// <returns><see cref="DiskspaceOverusageRow"/> instance.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/> or <paramref name="hostingSpaceRow"/> is null.</exception>
|
||||
public static DiskspaceOverusageRow CreateFromHostingSpacesRow(OverusageReport report, DataRow hostingSpaceRow)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
if (hostingSpaceRow == null)
|
||||
{
|
||||
throw new ArgumentNullException("hostingSpaceRow");
|
||||
}
|
||||
|
||||
DiskspaceOverusageRow row = report.DiskspaceOverusage.NewDiskspaceOverusageRow();
|
||||
|
||||
row.HostingSpaceId = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceRow["PackageID"].ToString(), 0);
|
||||
row.Allocated = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceRow["QuotaValue"].ToString(), 0);
|
||||
row.Used = OverusageReportUtils.GetLongValueOrDefault(hostingSpaceRow["Diskspace"].ToString(), 0);
|
||||
row.Usage = (row.Used - row.Allocated);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates <see cref="DiskspaceOverusageRow"/> using <see cref="PackageInfo"/> information.
|
||||
/// </summary>
|
||||
/// <param name="report">Current <see cref="OverusageReport"/></param>
|
||||
/// <param name="packageInfo">Hosting Space information.</param>
|
||||
/// <returns><see cref="DiskspaceOverusageRow"/> instance.</returns>
|
||||
/// <exception cref="ArgumentNullException">When <paramref name="report"/> or <paramref name="packageInfo"/> is null.</exception>
|
||||
public static DiskspaceOverusageRow CreateFromPackageInfo(OverusageReport report, PackageInfo packageInfo)
|
||||
{
|
||||
if (report == null)
|
||||
{
|
||||
throw new ArgumentNullException("report");
|
||||
}
|
||||
if (packageInfo == null)
|
||||
{
|
||||
throw new ArgumentNullException("packageInfo");
|
||||
}
|
||||
|
||||
DiskspaceOverusageRow row = report.DiskspaceOverusage.NewDiskspaceOverusageRow();
|
||||
|
||||
row.HostingSpaceId = packageInfo.PackageId;
|
||||
row.Allocated = packageInfo.DiskSpaceQuota;
|
||||
row.Used = packageInfo.DiskSpace;
|
||||
row.Usage = (row.Used - row.Allocated);
|
||||
|
||||
return row;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DataSetUISetting Version="1.00" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<TableUISettings>
|
||||
</TableUISettings>
|
||||
</DataSetUISetting>
|
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xs:schema id="OverusageReport" targetNamespace="http://tempuri.org/DataSet1.xsd" xmlns:mstns="http://tempuri.org/DataSet1.xsd" xmlns="http://tempuri.org/DataSet1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
|
||||
<xs:annotation>
|
||||
<xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
|
||||
<Connections>
|
||||
</Connections>
|
||||
<Tables>
|
||||
</Tables>
|
||||
<Sources>
|
||||
</Sources>
|
||||
</DataSource>
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
<xs:element name="OverusageReport" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="OverusageReport" msprop:Generator_DataSetName="OverusageReport">
|
||||
<xs:complexType>
|
||||
<xs:choice minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:element name="HostingSpace" msprop:Generator_UserTableName="HostingSpace" msprop:Generator_RowDeletedName="HostingSpaceRowDeleted" msprop:Generator_RowChangedName="HostingSpaceRowChanged" msprop:Generator_RowClassName="HostingSpaceRow" msprop:Generator_RowChangingName="HostingSpaceRowChanging" msprop:Generator_RowEvArgName="HostingSpaceRowChangeEvent" msprop:Generator_RowEvHandlerName="HostingSpaceRowChangeEventHandler" msprop:Generator_TableClassName="HostingSpaceDataTable" msprop:Generator_TableVarName="tableHostingSpace" msprop:Generator_RowDeletingName="HostingSpaceRowDeleting" msprop:Generator_TablePropName="HostingSpace">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="HostingSpaceId" msprop:Generator_UserColumnName="HostingSpaceId" msprop:Generator_ColumnPropNameInRow="HostingSpaceId" msprop:Generator_ColumnVarNameInTable="columnHostingSpaceId" msprop:Generator_ColumnPropNameInTable="HostingSpaceIdColumn" type="xs:long" />
|
||||
<xs:element name="HostingSpaceName" msprop:Generator_UserColumnName="HostingSpaceName" msprop:Generator_ColumnPropNameInRow="HostingSpaceName" msprop:Generator_ColumnVarNameInTable="columnHostingSpaceName" msprop:Generator_ColumnPropNameInTable="HostingSpaceNameColumn" type="xs:string" minOccurs="0" />
|
||||
<xs:element name="ChildSpaceQuantity" msprop:Generator_UserColumnName="ChildSpaceQuantity" msprop:Generator_ColumnPropNameInRow="ChildSpaceQuantity" msprop:Generator_ColumnVarNameInTable="columnChildSpaceQuantity" msprop:Generator_ColumnPropNameInTable="ChildSpaceQuantityColumn" type="xs:int" minOccurs="0" />
|
||||
<xs:element name="HostingPlanId" msprop:Generator_UserColumnName="HostingPlanId" msprop:Generator_ColumnPropNameInRow="HostingPlanId" msprop:Generator_ColumnVarNameInTable="columnHostingPlanId" msprop:Generator_ColumnPropNameInTable="HostingPlanIdColumn" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="HostingPlanName" msprop:Generator_UserColumnName="HostingPlanName" msprop:Generator_ColumnPropNameInRow="HostingPlanName" msprop:Generator_ColumnVarNameInTable="columnHostingPlanName" msprop:Generator_ColumnPropNameInTable="HostingPlanNameColumn" type="xs:string" minOccurs="0" />
|
||||
<xs:element name="HostingSpaceFullTreeName" msprop:Generator_UserColumnName="HostingSpaceFullTreeName" msprop:Generator_ColumnPropNameInRow="HostingSpaceFullTreeName" msprop:Generator_ColumnVarNameInTable="columnHostingSpaceFullTreeName" msprop:Generator_ColumnPropNameInTable="HostingSpaceFullTreeNameColumn" type="xs:string" minOccurs="0" />
|
||||
<xs:element name="UserId" msprop:Generator_UserColumnName="UserId" msprop:Generator_ColumnPropNameInRow="UserId" msprop:Generator_ColumnVarNameInTable="columnUserId" msprop:Generator_ColumnPropNameInTable="UserIdColumn" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="UserName" msprop:Generator_UserColumnName="UserName" msprop:Generator_ColumnPropNameInRow="UserName" msprop:Generator_ColumnVarNameInTable="columnUserName" msprop:Generator_ColumnPropNameInTable="UserNameColumn" type="xs:string" minOccurs="0" />
|
||||
<xs:element name="UserEmail" msprop:Generator_UserColumnName="UserEmail" msprop:Generator_ColumnPropNameInRow="UserEmail" msprop:Generator_ColumnVarNameInTable="columnUserEmail" msprop:Generator_ColumnPropNameInTable="UserEmailColumn" type="xs:string" minOccurs="0" />
|
||||
<xs:element name="HostingSpaceCreationDate" msprop:Generator_UserColumnName="HostingSpaceCreationDate" msprop:Generator_ColumnPropNameInRow="HostingSpaceCreationDate" msprop:Generator_ColumnVarNameInTable="columnHostingSpaceCreationDate" msprop:Generator_ColumnPropNameInTable="HostingSpaceCreationDateColumn" type="xs:dateTime" minOccurs="0" />
|
||||
<xs:element name="Status" msprop:Generator_UserColumnName="Status" msprop:Generator_ColumnPropNameInRow="Status" msprop:Generator_ColumnVarNameInTable="columnStatus" msprop:Generator_ColumnPropNameInTable="StatusColumn" type="xs:string" minOccurs="0" />
|
||||
<xs:element name="Location" msprop:Generator_UserColumnName="Location" msprop:Generator_ColumnPropNameInRow="Location" msprop:Generator_ColumnVarNameInTable="columnLocation" msprop:Generator_ColumnPropNameInTable="LocationColumn" type="xs:string" minOccurs="0" />
|
||||
<xs:element name="IsBandwidthOverused" msprop:Generator_UserColumnName="IsBandwidthOverused" msprop:Generator_ColumnPropNameInRow="IsBandwidthOverused" msprop:Generator_ColumnVarNameInTable="columnIsBandwidthOverused" msprop:Generator_ColumnPropNameInTable="IsBandwidthOverusedColumn" type="xs:boolean" minOccurs="0" />
|
||||
<xs:element name="IsDiskspaceOverused" msprop:Generator_UserColumnName="IsDiskspaceOverused" msprop:Generator_ColumnPropNameInRow="IsDiskspaceOverused" msprop:Generator_ColumnVarNameInTable="columnIsDiskspaceOverused" msprop:Generator_ColumnPropNameInTable="IsDiskspaceOverusedColumn" type="xs:boolean" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="BandwidthOverusage" msprop:Generator_UserTableName="BandwidthOverusage" msprop:Generator_RowDeletedName="BandwidthOverusageRowDeleted" msprop:Generator_RowChangedName="BandwidthOverusageRowChanged" msprop:Generator_RowClassName="BandwidthOverusageRow" msprop:Generator_RowChangingName="BandwidthOverusageRowChanging" msprop:Generator_RowEvArgName="BandwidthOverusageRowChangeEvent" msprop:Generator_RowEvHandlerName="BandwidthOverusageRowChangeEventHandler" msprop:Generator_TableClassName="BandwidthOverusageDataTable" msprop:Generator_TableVarName="tableBandwidthOverusage" msprop:Generator_RowDeletingName="BandwidthOverusageRowDeleting" msprop:Generator_TablePropName="BandwidthOverusage">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="HostingSpaceId" msprop:Generator_UserColumnName="HostingSpaceId" msprop:Generator_ColumnPropNameInRow="HostingSpaceId" msprop:Generator_ColumnVarNameInTable="columnHostingSpaceId" msprop:Generator_ColumnPropNameInTable="HostingSpaceIdColumn" type="xs:long" />
|
||||
<xs:element name="Allocated" msprop:Generator_UserColumnName="Allocated" msprop:Generator_ColumnPropNameInRow="Allocated" msprop:Generator_ColumnVarNameInTable="columnAllocated" msprop:Generator_ColumnPropNameInTable="AllocatedColumn" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="Used" msprop:Generator_UserColumnName="Used" msprop:Generator_ColumnPropNameInRow="Used" msprop:Generator_ColumnVarNameInTable="columnUsed" msprop:Generator_ColumnPropNameInTable="UsedColumn" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="Usage" msprop:Generator_UserColumnName="Usage" msprop:Generator_ColumnPropNameInRow="Usage" msprop:Generator_ColumnVarNameInTable="columnUsage" msprop:Generator_ColumnPropNameInTable="UsageColumn" type="xs:long" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="DiskspaceOverusage" msprop:Generator_UserTableName="DiskspaceOverusage" msprop:Generator_RowDeletedName="DiskspaceOverusageRowDeleted" msprop:Generator_RowChangedName="DiskspaceOverusageRowChanged" msprop:Generator_RowClassName="DiskspaceOverusageRow" msprop:Generator_RowChangingName="DiskspaceOverusageRowChanging" msprop:Generator_RowEvArgName="DiskspaceOverusageRowChangeEvent" msprop:Generator_RowEvHandlerName="DiskspaceOverusageRowChangeEventHandler" msprop:Generator_TableClassName="DiskspaceOverusageDataTable" msprop:Generator_TableVarName="tableDiskspaceOverusage" msprop:Generator_RowDeletingName="DiskspaceOverusageRowDeleting" msprop:Generator_TablePropName="DiskspaceOverusage">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="HostingSpaceId" msprop:Generator_UserColumnName="HostingSpaceId" msprop:Generator_ColumnPropNameInRow="HostingSpaceId" msprop:Generator_ColumnVarNameInTable="columnHostingSpaceId" msprop:Generator_ColumnPropNameInTable="HostingSpaceIdColumn" type="xs:long" />
|
||||
<xs:element name="Allocated" msprop:Generator_UserColumnName="Allocated" msprop:Generator_ColumnPropNameInRow="Allocated" msprop:Generator_ColumnVarNameInTable="columnAllocated" msprop:Generator_ColumnPropNameInTable="AllocatedColumn" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="Used" msprop:Generator_UserColumnName="Used" msprop:Generator_ColumnPropNameInRow="Used" msprop:Generator_ColumnVarNameInTable="columnUsed" msprop:Generator_ColumnPropNameInTable="UsedColumn" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="Usage" msprop:Generator_UserColumnName="Usage" msprop:Generator_ColumnPropNameInRow="Usage" msprop:Generator_ColumnVarNameInTable="columnUsage" msprop:Generator_ColumnPropNameInTable="UsageColumn" type="xs:long" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="OverusageDetails" msprop:Generator_UserTableName="OverusageDetails" msprop:Generator_RowDeletedName="OverusageDetailsRowDeleted" msprop:Generator_RowChangedName="OverusageDetailsRowChanged" msprop:Generator_RowClassName="OverusageDetailsRow" msprop:Generator_RowChangingName="OverusageDetailsRowChanging" msprop:Generator_RowEvArgName="OverusageDetailsRowChangeEvent" msprop:Generator_RowEvHandlerName="OverusageDetailsRowChangeEventHandler" msprop:Generator_TableClassName="OverusageDetailsDataTable" msprop:Generator_TableVarName="tableOverusageDetails" msprop:Generator_RowDeletingName="OverusageDetailsRowDeleting" msprop:Generator_TablePropName="OverusageDetails">
|
||||
<xs:complexType>
|
||||
<xs:sequence>
|
||||
<xs:element name="HostingSpaceId" msprop:Generator_UserColumnName="HostingSpaceId" msprop:Generator_ColumnPropNameInRow="HostingSpaceId" msprop:Generator_ColumnVarNameInTable="columnHostingSpaceId" msprop:Generator_ColumnPropNameInTable="HostingSpaceIdColumn" type="xs:long" />
|
||||
<xs:element name="ResourceGroupName" msprop:Generator_UserColumnName="ResourceGroupName" msprop:Generator_ColumnPropNameInRow="ResourceGroupName" msprop:Generator_ColumnVarNameInTable="columnResourceGroupName" msprop:Generator_ColumnPropNameInTable="ResourceGroupNameColumn" type="xs:string" />
|
||||
<xs:element name="Used" msprop:Generator_UserColumnName="Used" msprop:Generator_ColumnPropNameInRow="Used" msprop:Generator_ColumnVarNameInTable="columnUsed" msprop:Generator_ColumnPropNameInTable="UsedColumn" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="Allowed" msprop:Generator_UserColumnName="Allowed" msprop:Generator_ColumnPropNameInRow="Allowed" msprop:Generator_ColumnVarNameInTable="columnAllowed" msprop:Generator_ColumnPropNameInTable="AllowedColumn" type="xs:long" minOccurs="0" />
|
||||
<xs:element name="OverusageType" msprop:Generator_UserColumnName="OverusageType" msprop:Generator_ColumnPropNameInRow="OverusageType" msprop:Generator_ColumnVarNameInTable="columnOverusageType" msprop:Generator_ColumnPropNameInTable="OverusageTypeColumn" type="xs:string" />
|
||||
<xs:element name="AdditionalField" msprop:Generator_UserColumnName="AdditionalField" msprop:Generator_ColumnPropNameInRow="AdditionalField" msprop:Generator_ColumnVarNameInTable="columnAdditionalField" msprop:Generator_ColumnPropNameInTable="AdditionalFieldColumn" type="xs:long" minOccurs="0" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:choice>
|
||||
</xs:complexType>
|
||||
<xs:unique name="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:HostingSpace" />
|
||||
<xs:field xpath="mstns:HostingSpaceId" />
|
||||
</xs:unique>
|
||||
<xs:unique name="BandwidthOverusage_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:BandwidthOverusage" />
|
||||
<xs:field xpath="mstns:HostingSpaceId" />
|
||||
</xs:unique>
|
||||
<xs:unique name="DiskspaceOverusage_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:DiskspaceOverusage" />
|
||||
<xs:field xpath="mstns:HostingSpaceId" />
|
||||
</xs:unique>
|
||||
<xs:unique name="OverusageDetails_Constraint1" msdata:ConstraintName="Constraint1" msdata:PrimaryKey="true">
|
||||
<xs:selector xpath=".//mstns:OverusageDetails" />
|
||||
<xs:field xpath="mstns:ResourceGroupName" />
|
||||
<xs:field xpath="mstns:HostingSpaceId" />
|
||||
<xs:field xpath="mstns:OverusageType" />
|
||||
</xs:unique>
|
||||
</xs:element>
|
||||
<xs:annotation>
|
||||
<xs:appinfo>
|
||||
<msdata:Relationship name="HostingSpace_BandwidthOverusage" msdata:parent="HostingSpace" msdata:child="BandwidthOverusage" msdata:parentkey="HostingSpaceId" msdata:childkey="HostingSpaceId" msprop:Generator_UserRelationName="HostingSpace_BandwidthOverusage" msprop:Generator_RelationVarName="relationHostingSpace_BandwidthOverusage" msprop:Generator_UserChildTable="BandwidthOverusage" msprop:Generator_UserParentTable="HostingSpace" msprop:Generator_ParentPropName="HostingSpaceRow" msprop:Generator_ChildPropName="GetBandwidthOverusageRows" />
|
||||
<msdata:Relationship name="HostingSpace_DiskspaceOverusage" msdata:parent="HostingSpace" msdata:child="DiskspaceOverusage" msdata:parentkey="HostingSpaceId" msdata:childkey="HostingSpaceId" msprop:Generator_UserRelationName="HostingSpace_DiskspaceOverusage" msprop:Generator_RelationVarName="relationHostingSpace_DiskspaceOverusage" msprop:Generator_UserChildTable="DiskspaceOverusage" msprop:Generator_UserParentTable="HostingSpace" msprop:Generator_ParentPropName="HostingSpaceRow" msprop:Generator_ChildPropName="GetDiskspaceOverusageRows" />
|
||||
<msdata:Relationship name="BandwidthOverusage_OverusageDetails" msdata:parent="BandwidthOverusage" msdata:child="OverusageDetails" msdata:parentkey="HostingSpaceId" msdata:childkey="HostingSpaceId" msprop:Generator_UserRelationName="BandwidthOverusage_OverusageDetails" msprop:Generator_RelationVarName="relationBandwidthOverusage_OverusageDetails" msprop:Generator_UserChildTable="OverusageDetails" msprop:Generator_UserParentTable="BandwidthOverusage" msprop:Generator_ParentPropName="BandwidthOverusageRow" msprop:Generator_ChildPropName="GetOverusageDetailsRows" />
|
||||
<msdata:Relationship name="DiskspaceOverusage_OverusageDetails" msdata:parent="DiskspaceOverusage" msdata:child="OverusageDetails" msdata:parentkey="HostingSpaceId" msdata:childkey="HostingSpaceId" msprop:Generator_UserRelationName="DiskspaceOverusage_OverusageDetails" msprop:Generator_RelationVarName="relationDiskspaceOverusage_OverusageDetails" msprop:Generator_UserChildTable="OverusageDetails" msprop:Generator_UserParentTable="DiskspaceOverusage" msprop:Generator_ParentPropName="DiskspaceOverusageRow" msprop:Generator_ChildPropName="GetOverusageDetailsRows" />
|
||||
</xs:appinfo>
|
||||
</xs:annotation>
|
||||
</xs:schema>
|
|
@ -0,0 +1,68 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--<autogenerated>
|
||||
This code was generated by a tool to store the dataset designer's layout information.
|
||||
Changes to this file may cause incorrect behavior and will be lost if
|
||||
the code is regenerated.
|
||||
</autogenerated>-->
|
||||
<DiagramLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ex:showrelationlabel="False" ViewPortX="-22" ViewPortY="0" xmlns:ex="urn:schemas-microsoft-com:xml-msdatasource-layout-extended" xmlns="urn:schemas-microsoft-com:xml-msdatasource-layout">
|
||||
<Shapes>
|
||||
<Shape ID="DesignTable:HostingSpace" ZOrder="8" X="463" Y="30" Height="315" Width="175" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="311" />
|
||||
<Shape ID="DesignTable:BandwidthOverusage" ZOrder="7" X="243" Y="40" Height="105" Width="190" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="101" />
|
||||
<Shape ID="DesignTable:DiskspaceOverusage" ZOrder="6" X="227" Y="216" Height="106" Width="184" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="102" />
|
||||
<Shape ID="DesignTable:OverusageDetails" ZOrder="1" X="2" Y="114" Height="143" Width="167" AdapterExpanded="true" DataTableExpanded="true" OldAdapterHeight="0" OldDataTableHeight="0" SplitterPosition="139" />
|
||||
</Shapes>
|
||||
<Connectors>
|
||||
<Connector ID="DesignRelation:HostingSpace_BandwidthOverusage" ZOrder="5" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>463</X>
|
||||
<Y>92</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>433</X>
|
||||
<Y>92</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:HostingSpace_DiskspaceOverusage" ZOrder="4" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>463</X>
|
||||
<Y>269</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>411</X>
|
||||
<Y>269</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:BandwidthOverusage_OverusageDetails" ZOrder="3" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>260</X>
|
||||
<Y>145</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>260</X>
|
||||
<Y>185</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>169</X>
|
||||
<Y>185</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
<Connector ID="DesignRelation:DiskspaceOverusage_OverusageDetails" ZOrder="2" LineWidth="11">
|
||||
<RoutePoints>
|
||||
<Point>
|
||||
<X>227</X>
|
||||
<Y>227</Y>
|
||||
</Point>
|
||||
<Point>
|
||||
<X>169</X>
|
||||
<Y>227</Y>
|
||||
</Point>
|
||||
</RoutePoints>
|
||||
</Connector>
|
||||
</Connectors>
|
||||
</DiagramLayout>
|
|
@ -0,0 +1,80 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Data;
|
||||
|
||||
namespace WebsitePanel.EnterpriseServer.Base.Reports
|
||||
{
|
||||
public static class OverusageReportUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// Returns a long value from <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <param name="value">String representing a number.</param>
|
||||
/// <param name="detaultValue">Default value.</param>
|
||||
/// <returns>Long value.</returns>
|
||||
public static long GetLongValueOrDefault(string value, long detaultValue)
|
||||
{
|
||||
long result = 0;
|
||||
|
||||
if (!long.TryParse(value, out result))
|
||||
{
|
||||
result = detaultValue;
|
||||
}
|
||||
|
||||
if (result == -1)
|
||||
{
|
||||
result = long.MaxValue;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return string value specified by <paramref name="column"/> or <paramref name="defaultValue"/> in case there is no such column in <see cref="DataRow"/>.
|
||||
/// </summary>
|
||||
/// <param name="dr"><see cref="DataRow"/> containing data.</param>
|
||||
/// <param name="column">Columns name to take data from.</param>
|
||||
/// <param name="defaultValue">Default value in case if there is no such <paramref name="column"/></param>
|
||||
/// <returns>String value.</returns>
|
||||
public static string GetStringOrDefault(DataRow dr, string column, string defaultValue)
|
||||
{
|
||||
string result = defaultValue;
|
||||
|
||||
if (dr.Table.Columns.Contains(column))
|
||||
{
|
||||
result = dr[column].ToString();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue