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


C# UserType.ToString方法代码示例

本文整理汇总了C#中UserType.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# UserType.ToString方法的具体用法?C# UserType.ToString怎么用?C# UserType.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UserType的用法示例。


在下文中一共展示了UserType.ToString方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Add

        public bool Add(UserType userType, int userId, IEnumerable<EmailConfig> values)
        {
            ManagerLock.EnterReadLock();            // Read

            try {
                if (FindUser(userType, userId) != null)
                    return false;
            }
            finally{
                ManagerLock.ExitReadLock();         // EO Read
            }

            ManagerLock.EnterWriteLock();           // Write

            try {
                Configs.Element(userType.ToString())                                   // Não retorna null porque nunca é apagado e existe sempre
                       .Add(new XElement("user",
                                new XAttribute("id", userId),                          // Coloca atributo
                                values.Select(c => new XElement("value", (int)c))      // Coloca coleccao de values
                ));

                // Save persistent to file
                Configs.Save(FileName);
                return true;
            }

            finally{
                ManagerLock.ExitWriteLock();        // EO Write
            }
        }
开发者ID:goncalod,项目名称:csharp,代码行数:30,代码来源:EmailConfigMngr.cs

示例2: SignIn

 private void SignIn( bool isPersistent,string username,UserType type)
 {
     AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie);
     var identity = new ClaimsIdentity(new[] { new Claim(ClaimTypes.NameIdentifier, username), new Claim(ClaimTypes.Role,type.ToString()), new Claim(ClaimTypes.Name,username)}, DefaultAuthenticationTypes.ApplicationCookie, ClaimTypes.Name, ClaimTypes.Role);
         
     AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent}, identity);
 
 }
开发者ID:Milton761,项目名称:mLearningCoreEN,代码行数:8,代码来源:LoginController.cs

示例3: GetPasswordForUser

 public string GetPasswordForUser(UserType user)
 {
     SQLiteResult sqlResult = SQLiteController.Instance.Query(
         "SELECT password FROM Users WHERE (username = '" + user.ToString().ToLower() + "')");
     if (sqlResult.HasRows)
     {
         return sqlResult.Rows[0]["password"].ToString();
     }
     else { return string.Empty; }
 }
开发者ID:xiy,项目名称:suprmrkt,代码行数:10,代码来源:User.cs

示例4: PlayerEntity

        /// <summary>
        /// The user entity constructor
        /// </summary>
        /// <param name="userType">The type which the user is</param>
        /// <param name="userId">The Id of the user in question</param>
        public PlayerEntity(UserType userType, int userId)
        {
            // Set the partition and row keys to match the user type and id
            this.PartitionKey = userType.ToString();
            this.RowKey = userId.ToString();

            // Create the basic values
            TreasureChest = new Dictionary<int, DateTime>();
            Achievements = new Dictionary<string, DateTime>();
            CurrentSearchedTreasure = 1;
            CurrentRoute = 1;
        }
开发者ID:Japskua,项目名称:QRAdventures,代码行数:17,代码来源:PlayerEntity.cs

示例5: LoginOnServer

        public CostCentreLoginResponse LoginOnServer(string userName, string password, UserType userType)
        
        {
          var config = _configService.Load();
          string _url = config.WebServiceUrl + "api/Login/LoginGet?Username={0}&Password={1}&UserType={2}";

            string url = string.Format(_url, userName, _otherUtilities.MD5Hash(password), userType.ToString());
            _log.Info("Attempting logon on server --> " + url);
            Uri uri = new Uri(url, UriKind.Absolute);
            WebClient wc = new WebClient();

            
            string response = wc.DownloadString(uri);
            CostCentreLoginResponse _response = JsonConvert.DeserializeObject<CostCentreLoginResponse>(response, new IsoDateTimeConverter());
            if (_response.ErrorInfo != null && _response.ErrorInfo.Equals("Success"))
            {
                _log.InfoFormat("Remote login success. Saving CC {0} ", _response.CostCentreId);
                config.CostCentreId = _response.CostCentreId;
                _configService.Save(config);
            }

            return _response;
        }
开发者ID:asanyaga,项目名称:BuildTest,代码行数:23,代码来源:SetupApplication.cs

示例6: DoSuccessFullLogin

        private void DoSuccessFullLogin(AuthenticatedUserDTO authenticatedUser, UserType role, string redirectPath)
        {
            var defaultCulture = new CultureDTO {Id = Guid.NewGuid(), Name = "English"};
            With.Mocks(mockery)
                .Expecting(() =>
                    {
                        Expect.Call(authenticationService.AuthenticateUser(authenticationRequest)).Return(authenticatedUser);
                        Expect.Call(formsAuthentication.Encrypt(null)).IgnoreArguments();
                        Expect.Call(cultureService.GetDefaultCulture()).Return(defaultCulture);
                    })
                .Verify(() => controller.Login(authenticationRequest));

            Assert.IsTrue(Context.CurrentUser.Identity.IsAuthenticated);
            Assert.IsTrue(Context.CurrentUser.IsInRole(role.ToString()));
            Assert.AreEqual(defaultCulture, Context.Session["Culture"]);
            Assert.AreEqual(redirectPath, Response.RedirectedTo);
        }
开发者ID:pollingj,项目名称:Membrane-CMS,代码行数:17,代码来源:LoginControllerFixture.cs

示例7: GetMessage

 public static string GetMessage(UserType userType, string language)
 {
     return GetMessage(userType.ToString(), language);
 }
开发者ID:jovijovi,项目名称:kort,代码行数:4,代码来源:ErrorNumber.cs

示例8: ListDashboardItems

        public static List<string> ListDashboardItems(UserType utype)
        {
            //Put together list of dashboard items based on user type - There must be a minimum of 4 items returned in the list
            List<string> DashItems = new List<string>();
            DashItems.Add("My Services");
            DashItems.Add("Reports");
            DashItems.Add("Customers");
            DashItems.Add("Recent Activity");
            DashItems.Add("Overview");

            if (utype == UserType.AccountManager || utype == UserType.AccountOwner || utype == UserType.AccountAdmin)
            {
                DashItems.Add("Accounting Activity");
                DashItems.Add("Employees");
                DashItems.Add("Business Overview");
                DashItems.Add("Sales Overview");
            }
            if (utype == UserType.PSIOwner)
            {
                DashItems.Add("PSI Overview");
            }
            if (utype.ToString().Contains("PSI"))
            {
                DashItems.Add("PSI Support Tickets");
                DashItems.Add("PSI Support Follow Up");
            }

            return DashItems;
        }
开发者ID:dhuyvaert,项目名称:Sam_Solution,代码行数:29,代码来源:Users.cs

示例9: FindUser

 // Helper Methods
 private XElement FindUser(UserType userType, int userId)
 {
     return Configs.Element(userType.ToString())
                   .Elements("user")
                   .SingleOrDefault(x => (int)x.Attribute("id") == userId);
 }
开发者ID:goncalod,项目名称:csharp,代码行数:7,代码来源:EmailConfigMngr.cs

示例10: GetLogin

 public static Login GetLogin(UserType userType, int sectionedGrade)
 {
     string startupPath = System.IO.Directory.GetCurrentDirectory();
     string outPutDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().CodeBase);
     string xmlfilepath = Path.Combine(outPutDirectory, "Logins.xml");
     string xmlfile_path = new Uri(xmlfilepath).LocalPath;
     XElement loginXElement = XElement.Load(xmlfile_path).Elements("Login").Where(login => login.Element("UserType").Value == userType.ToString() && login.Element("SectionedGrades").Value.Contains(sectionedGrade.ToString())).FirstOrDefault<XElement>();
     return new Login(loginXElement);
 }
开发者ID:kirankumarb4u,项目名称:WinStoreCodedUI,代码行数:9,代码来源:Login.cs


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