本文整理汇总了C#中Data.IsEndUser方法的典型用法代码示例。如果您正苦于以下问题:C# Data.IsEndUser方法的具体用法?C# Data.IsEndUser怎么用?C# Data.IsEndUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.IsEndUser方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HasAccess
public Boolean HasAccess(Data.Model.User currentUser, Data.Model.User currentUserCreated)
{
bool hasAccess = true;
if (currentUser != null)
{
if (RequiresSuperAdminRole && (!currentUser.IsSuperAdmin() && !currentUser.IsCommercial()))
{
hasAccess = false;
}
if (RequiresAdviserConfigRole && !currentUser.CanConfigAdviser())
{
hasAccess = false;
}
if (RequiresClientConfigRole && !currentUser.CanConfigClient())
{
hasAccess = false;
}
if (RequiresFirmConfigRole && !currentUser.CanConfigFirm())
{
hasAccess = false;
}
if ((RequiresReassignConfigRole && !currentUser.IsEndUser() && !currentUser.CanReassignClientProspects()) || (RequiresReassignConfigRole && currentUser.IsEndUser() && currentUserCreated != null && !currentUserCreated.CanReassignClientProspects()))
{
hasAccess = false;
}
if ((RequiresAggregatorLicense && !currentUser.IsEndUser() && !currentUser.HasAggregatorLicense()) || (RequiresAggregatorLicense && currentUser.IsEndUser() && currentUserCreated != null && !currentUserCreated.HasAggregatorLicense()))
{
hasAccess = false;
}
else if (RequiresReportLABLicense
&& (!currentUser.HasReportLicense() && !currentUser.HasLABLicense() && !currentUser.IsEndUser()))
{
hasAccess = false;
}
}
return hasAccess;
}
示例2: SendResetPasswordEmail
public static Boolean SendResetPasswordEmail(Data.Model.User user, out String message)
{
try
{
//string siteUrl = Upsilab.Business.Utility.UrlHelper.GetSiteUrl();
string siteUrl = string.Empty;
String from = ConfigurationManager.ResetPasswordEmailFrom;
if (user.IsEndUser())
{
siteUrl = string.Format("{0}/Client", Upsilab.Business.Utility.UrlHelper.GetHost());
Data.Model.CustomerProspect customer = CustomerProspectBL.GetCustomerProspectByIdUser(user.idUser);
from = customer.User1.UserEmail;
}
else if (user.IsSuperAdmin())
{
siteUrl = string.Format("{0}/Admin", Upsilab.Business.Utility.UrlHelper.GetHost());
}
else
{
siteUrl = string.Format("{0}/User", Upsilab.Business.Utility.UrlHelper.GetHost());
}
string token = HttpServerUtility.UrlTokenEncode(new System.Text.ASCIIEncoding().GetBytes((UserBL.CreateSecureToken(user))));
string urlResetPwd = string.Format("{0}/User/ResetPassword?token={1}", siteUrl, token);
var template = EmailManager.GetEmailTemplateContentByName(EmailManager.ResetPassword);
string subject = LanguageContentBL.Translate("mailResetPassword");//Réinitialisation de votre mot de passe sur www.upsideo.fr
string emailMessage = string.Format(template, urlResetPwd);
UserAuthentication userAuth = new UserAuthentication()
{
UserAuthToken = token,
IsValid = true,
DateCreated = DateTime.Now,
idUser = user.idUser
};
UserAuthentificationBL.CreateUserAuthentication(userAuth);
EmailManager.SendEmail(from, user.UserEmail, String.Empty, subject, emailMessage);
//Log mail
EmailLogBL.TypeDestinataire typeDestinaire = EmailLogBL.TypeDestinataire.Admin;
if (user.IsEndUser())
typeDestinaire = EmailLogBL.TypeDestinataire.Client;
else if (user.IsAdmin())
typeDestinaire = EmailLogBL.TypeDestinataire.Admin;
else if (user.IsAdviser())
typeDestinaire = EmailLogBL.TypeDestinataire.Adviser;
EmailLogBL.Log(null, from, user.idUser, user.UserEmail, typeDestinaire, System.Reflection.MethodBase.GetCurrentMethod().Name);
message = LanguageContentBL.Translate("messageResetPassword");//L'email de réinitialisation de mot de passe a été envoyé avec succès !
return true;
}
catch (Exception ex)
{
message = ex.Message;
return false;
}
}