当前位置: 首页>>代码示例>>C#>>正文


C# Data.IsEndUser方法代码示例

本文整理汇总了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;
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:49,代码来源:Authentication.cs

示例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;
            }
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:63,代码来源:UserBL_.cs


注:本文中的Data.IsEndUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。