本文整理汇总了C#中ASC.Core.Tenants.Tenant.GetTrustedDomains方法的典型用法代码示例。如果您正苦于以下问题:C# Tenant.GetTrustedDomains方法的具体用法?C# Tenant.GetTrustedDomains怎么用?C# Tenant.GetTrustedDomains使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ASC.Core.Tenants.Tenant
的用法示例。
在下文中一共展示了Tenant.GetTrustedDomains方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveTenant
public Tenant SaveTenant(Tenant t)
{
if (t == null) throw new ArgumentNullException("tenant");
ExecAction(db =>
{
t.LastModified = DateTime.UtcNow;
if (t.TenantId != 0)
{
// TenantId == 0 in open source version
ValidateDomain(db, t.TenantAlias, t.TenantId, true);
}
if (!string.IsNullOrEmpty(t.MappedDomain))
{
var baseUrl = ConfigurationManager.AppSettings["core.base-domain"];
if (baseUrl != null && t.MappedDomain.EndsWith("." + baseUrl, StringComparison.InvariantCultureIgnoreCase))
{
ValidateDomain(db, t.MappedDomain.Substring(0, t.MappedDomain.Length - baseUrl.Length - 1), t.TenantId, false);
}
else
{
ValidateDomain(db, t.MappedDomain, t.TenantId, false);
}
}
if (t.TenantId == Tenant.DEFAULT_TENANT)
{
var i = new SqlInsert("tenants_tenants", true)
.InColumnValue("id", t.TenantId)
.InColumnValue("alias", t.TenantAlias.ToLowerInvariant())
.InColumnValue("mappeddomain", !string.IsNullOrEmpty(t.MappedDomain) ? t.MappedDomain.ToLowerInvariant() : null)
.InColumnValue("name", t.Name ?? t.TenantAlias)
.InColumnValue("language", t.Language)
.InColumnValue("timezone", t.TimeZone.Id)
.InColumnValue("owner_id", t.OwnerId.ToString())
.InColumnValue("trusteddomains", t.GetTrustedDomains())
.InColumnValue("trusteddomainsenabled", (int)t.TrustedDomainsType)
.InColumnValue("creationdatetime", t.CreatedDateTime)
.InColumnValue("status", (int)t.Status)
.InColumnValue("statuschanged", t.StatusChangeDate)
.InColumnValue("last_modified", t.LastModified)
.Identity<int>(0, t.TenantId, true);
t.TenantId = db.ExecScalar<int>(i);
t.Version = db.ExecScalar<int>(new SqlQuery("tenants_tenants").Select("version").Where("id", t.TenantId));
}
else
{
var u = new SqlUpdate("tenants_tenants")
.Set("alias", t.TenantAlias.ToLowerInvariant())
.Set("mappeddomain", !string.IsNullOrEmpty(t.MappedDomain) ? t.MappedDomain.ToLowerInvariant() : null)
.Set("version", t.Version)
.Set("name", t.Name ?? t.TenantAlias)
.Set("language", t.Language)
.Set("timezone", t.TimeZone.Id)
.Set("owner_id", t.OwnerId.ToString())
.Set("trusteddomains", t.GetTrustedDomains())
.Set("trusteddomainsenabled", (int)t.TrustedDomainsType)
.Set("creationdatetime", t.CreatedDateTime)
.Set("status", (int)t.Status)
.Set("statuschanged", t.StatusChangeDate)
.Set("last_modified", t.LastModified)
.Where("id", t.TenantId);
db.ExecNonQuery(u);
}
});
CalculateTenantDomain(t);
return t;
}
示例2: SaveTenant
public Tenant SaveTenant(Tenant t)
{
if (t == null) throw new ArgumentNullException("tenant");
ExecAction(db =>
{
if (t.TenantId != 0)
{
// TenantId == 0 in open source version
ValidateDomain(db, t.TenantAlias, t.TenantId, true);
}
if (!string.IsNullOrEmpty(t.MappedDomain))
{
var baseUrl = TenantUtil.GetBaseDomain(t.HostedRegion);
if (baseUrl != null && t.MappedDomain.EndsWith("." + baseUrl, StringComparison.InvariantCultureIgnoreCase))
{
ValidateDomain(db, t.MappedDomain.Substring(0, t.MappedDomain.Length - baseUrl.Length - 1), t.TenantId, false);
}
else
{
ValidateDomain(db, t.MappedDomain, t.TenantId, false);
}
}
if (t.TenantId == Tenant.DEFAULT_TENANT)
{
var q = new SqlQuery("tenants_version")
.Select("id")
.Where(Exp.Eq("default_version", 1) | Exp.Eq("id", 0))
.OrderBy(1, false)
.SetMaxResults(1);
t.Version = db.ExecScalar<int>(q);
var i = new SqlInsert("tenants_tenants", true)
.InColumnValue("id", t.TenantId)
.InColumnValue("alias", t.TenantAlias.ToLowerInvariant())
.InColumnValue("mappeddomain", !string.IsNullOrEmpty(t.MappedDomain) ? t.MappedDomain.ToLowerInvariant() : null)
.InColumnValue("version", t.Version)
.InColumnValue("version_changed", t.VersionChanged)
.InColumnValue("name", t.Name ?? t.TenantAlias)
.InColumnValue("language", t.Language)
.InColumnValue("timezone", t.TimeZone.Id)
.InColumnValue("owner_id", t.OwnerId.ToString())
.InColumnValue("trusteddomains", t.GetTrustedDomains())
.InColumnValue("trusteddomainsenabled", (int)t.TrustedDomainsType)
.InColumnValue("creationdatetime", t.CreatedDateTime)
.InColumnValue("status", (int)t.Status)
.InColumnValue("statuschanged", t.StatusChangeDate)
.InColumnValue("payment_id", t.PaymentId)
.InColumnValue("last_modified", t.LastModified = DateTime.UtcNow)
.InColumnValue("industry", (int)t.Industry)
.Identity<int>(0, t.TenantId, true);
t.TenantId = db.ExecScalar<int>(i);
}
else
{
var u = new SqlUpdate("tenants_tenants")
.Set("alias", t.TenantAlias.ToLowerInvariant())
.Set("mappeddomain", !string.IsNullOrEmpty(t.MappedDomain) ? t.MappedDomain.ToLowerInvariant() : null)
.Set("version", t.Version)
.Set("version_changed", t.VersionChanged)
.Set("name", t.Name ?? t.TenantAlias)
.Set("language", t.Language)
.Set("timezone", t.TimeZone.Id)
.Set("owner_id", t.OwnerId.ToString())
.Set("trusteddomains", t.GetTrustedDomains())
.Set("trusteddomainsenabled", (int)t.TrustedDomainsType)
.Set("creationdatetime", t.CreatedDateTime)
.Set("status", (int)t.Status)
.Set("statuschanged", t.StatusChangeDate)
.Set("payment_id", t.PaymentId)
.Set("last_modified", t.LastModified = DateTime.UtcNow)
.Set("industry", (int)t.Industry)
.Where("id", t.TenantId);
db.ExecNonQuery(u);
}
if (string.IsNullOrEmpty(t.PartnerId))
{
var d = new SqlDelete("tenants_partners").Where("tenant_id", t.TenantId);
db.ExecNonQuery(d);
}
else
{
var i = new SqlInsert("tenants_partners", true)
.InColumnValue("tenant_id", t.TenantId)
.InColumnValue("partner_id", t.PartnerId);
db.ExecNonQuery(i);
}
});
//CalculateTenantDomain(t);
return t;
}