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


C# User类代码示例

本文整理汇总了C#中User的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: VMQuickContact

 public VMQuickContact(User user)
 {
     FirstName = user.FirstName;
     LastName = user.LastName;
     Email = user.Email;
     UserId = user.Id;
 }
开发者ID:Jeremy29229,项目名称:Portfolio-Unleashed,代码行数:7,代码来源:VMQuickContact.cs

示例2: PutUser

        public IHttpActionResult PutUser(int id, User user)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != user.carsite_id)
            {
                return BadRequest();
            }

            db.Entry(user).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
开发者ID:derekchisholm,项目名称:CarsiteWebAPI,代码行数:32,代码来源:UsersController.cs

示例3: CalculateBadges

 public void CalculateBadges(User user, List<BadgeType> badgeTypes)
 {
     foreach (var badgeType in badgeTypes)
     {
         this.badgeStrategyFactory.GetBadgeStrategy(badgeType).CalculateBadges(user, badgeType);
     }
 }
开发者ID:luis-mc,项目名称:Buildionaire,代码行数:7,代码来源:BadgeService.cs

示例4: Update

        public User Update(User user)
        {
            this.users.Update(user);
            this.users.SaveChanges();

            return user;
        }
开发者ID:danisio,项目名称:MVC-Project,代码行数:7,代码来源:UserService.cs

示例5: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Permission.Check("user.read", true)) return;

        if (!Page.IsPostBack)
        {
            using (MooDB db = new MooDB())
            {
                int userAID = int.Parse(Request["userA"]);
                int userBID = int.Parse(Request["userB"]);
                userA = (from u in db.Users
                         where u.ID == userAID
                         select u).SingleOrDefault<User>();
                userB = (from u in db.Users
                         where u.ID == userBID
                         select u).SingleOrDefault<User>();
                if (userA == null || userB == null)
                {
                    PageUtil.Redirect(Resources.Moo.FoundNothing, "~/");
                    return;
                }

                BindDatas(db);

                Page.DataBind();
            }
        }
    }
开发者ID:MooDevTeam,项目名称:MooOJ,代码行数:28,代码来源:Compare.aspx.cs

示例6: GetUserDomainModel

 public User GetUserDomainModel(UserViewModel userViewModel)
 {
     var user = new User();
     user.Name = userViewModel.Name;
     user.Password = userViewModel.Password;
     return user;
 }
开发者ID:Shinyshade,项目名称:DocumentStorage,代码行数:7,代码来源:Mapper.cs

示例7: PassOne

 public PassOne(User user)
 {
     InitializeComponent();
     //UserManager.CreateUser("Peter", "Varner-Howland", "pvarnerhowland", "testPass321");
     //var user = UserManager.Authenticate("pvarnerhowland", "testPass321");
     _myApp = new PassOneApp(this, user);
 }
开发者ID:phowland1,项目名称:PassOne,代码行数:7,代码来源:PassOne.cs

示例8: When

 public void When(UserAttachedToRegistration e)
 {
     if (null == FirstUser)
     {
         FirstUser = new User(e.UserId, e.UserDisplay, e.Token);
     }
 }
开发者ID:mojamcpds,项目名称:lokad-cqrs-1,代码行数:7,代码来源:RegistrationState.cs

示例9: CheckRole

 public int CheckRole(User user)
 {
     var pass = encrypt(user.Password);
         var m = db.Users.Where(x => x.UserName == user.UserName && x.Password == pass && x.IdRole == 1).SingleOrDefault();
         var n = db.Users.Where(x => x.UserName.Equals(user.UserName) && x.Password != user.Password && x.IdRole == 1).SingleOrDefault();
         if (m!=null && m.LoginFail <= 3)
         {
             var p = decrypt(m.Password);
             FormsAuthentication.SetAuthCookie(m.UserName.ToString(), false);
             return 1;
         }
         else if (n != null && n.LoginFail < 3)
         {
             n.LoginFail++;
             db.SaveChanges();
             return 0;
         }
         else if (m != null && m.LoginFail >= 3)
         {
             return 2;
         }
         else if (n != null && n.LoginFail >= 3)
         {
             return 3;
         }
         return 0;
 }
开发者ID:ZenHiro,项目名称:BaiGiang,代码行数:27,代码来源:BookRepository.cs

示例10: HistoryWindow

        public HistoryWindow()
        {
            InitializeComponent();

            historial = new Historiales();

            medic = new Medic();
            user = new User();
            history = new History();

            medics = medic.GetAll();
            users = user.GetAll();
            histories = history.GetAll();

            foreach (Usuarios user in users)
            {
                comboUsers.Items.Add(user.nombre + " " + user.apellidos);
            }

            foreach (Medicos medic in medics)
            {
                comboMedics.Items.Add(medic.nombre + " " + medic.apellidos);
            }

            historialGrid.ItemsSource = histories.ToArray();
        }
开发者ID:Maldercito,项目名称:adat,代码行数:26,代码来源:1453974230$HistoryWindow.xaml.cs

示例11: Purchase

 public Purchase(int puchaseId, Cart cart, User user, DateTime date)
 {
     this.PurchaseID = puchaseId;
     this.articles = cart;
     this.User = user;
     this.Date = date;
 }
开发者ID:fhoner,项目名称:Kasse,代码行数:7,代码来源:Purchase.cs

示例12: matches_credentials_negative

        public void matches_credentials_negative()
        {
            var user1 = new User
            {
                UserName = "jeremy",
                Password = theHash.CreateHash("something")
            };

            var user2 = new User
            {
                UserName = "josh",
                Password = theHash.CreateHash("else")
            };

            theRepository.Update(user1);
            theRepository.Update(user2);


            theMembership.MatchesCredentials(new LoginRequest
            {
                UserName = "jeremy",
                Password = "something"
            }).ShouldBeTrue();

            theMembership.MatchesCredentials(new LoginRequest
            {
                UserName = "josh",
                Password = "else"
            }).ShouldBeTrue();
        }
开发者ID:RobertTheGrey,项目名称:FubuMVC.Authentication,代码行数:30,代码来源:MembershipRepositoryTester.cs

示例13: AddUser

        /// <summary>
        /// Adds a user to the system, and sets the <see cref="User.IsActivated"/> to true.
        /// </summary>
        /// <param name="email">The email or username.</param>
        /// <param name="password">The password.</param>
        /// <param name="isAdmin">if set to <c>true</c> the user is added as an admin.</param>
        /// <param name="isEditor">if set to <c>true</c> the user is added as an editor.</param>
        /// <returns>
        /// true if the user was added; false if the user already exists.
        /// </returns>
        /// <exception cref="SecurityException">An NHibernate (database) error occurred while adding the new user.</exception>
        public override bool AddUser(string email, string username, string password, bool isAdmin, bool isEditor)
        {
            try
            {
                User user = Users.FirstOrDefault(u => u.Email == email || u.Username == username);
                if (user == null)
                {
                    user = new User();
                    user.Email = email;
                    user.Username = username;
                    user.SetPassword(password);
                    user.IsAdmin = isAdmin;
                    user.IsEditor = isEditor;
                    user.IsActivated = true;
                    NHibernateRepository.Current.SaveOrUpdate<User>(user);

                    return true;
                }
                else
                {
                    return false;
                }
            }
            catch (HibernateException ex)
            {
                throw new SecurityException(ex, "An error occurred while adding the new user {0}", email);
            }
        }
开发者ID:Yodadude,项目名称:Roadkill,代码行数:39,代码来源:SqlUserManager.cs

示例14: AddUser

        public void AddUser(FormCollection collection, User user)
        {
            UserBLL ub = new UserBLL();
             String message=ub.AddNewUser(collection,user);

             Index();
        }
开发者ID:lightwavebusiness,项目名称:AMS,代码行数:7,代码来源:UserController.cs

示例15: ToViewModel

 public static UserModel ToViewModel(this User a, User viewer, bool isOfficerAsking)
 {
     int privacyLevel = (viewer == null) ? 0 : viewer.PrivacyLevel;
     return new UserModel
     {
         Alias = a.Alias ?? a.Name,
         UserId = a.ID,
         Bio = a.Bio,
         BirthDate = (((a.PrivacyLevel < 2) || (privacyLevel < 2)) || !a.Birthdate.HasValue) ? null : (((a.PrivacyLevel < 3) || (privacyLevel < 3)) ? a.Birthdate.Value.ToString("MMMM dd") : a.Birthdate.Value.ToString("MMMM dd, yyyy")),
         Furcode = a.FurCode,
         InterestTags = a.Interests,
         Messenger1Id = (privacyLevel == 0) ? null : a.Messenger1ID,
         Messenger1Type = (privacyLevel == 0) ? null : a.Messenger1Type,
         Messenger2Id = (privacyLevel == 0) ? null : a.Messenger2ID,
         Messenger2Type = (privacyLevel == 0) ? null : a.Messenger2Type,
         Messenger3Id = (privacyLevel == 0) ? null : a.Messenger3ID,
         Messenger3Type = (privacyLevel == 0) ? null : a.Messenger3Type,
         Messenger4Id = (privacyLevel == 0) ? null : a.Messenger4ID,
         Messenger4Type = (privacyLevel == 0) ? null : a.Messenger4Type,
         Orientation = (privacyLevel == 0) ? null : (((string.Compare(a.Sex, "Female") == 0) && (string.CompareOrdinal(a.Orientation, "Gay") == 0)) ? "Lesbian" : a.Orientation),
         PrivacyLevel = a.PrivacyLevel,
         RelationshipStatus = (privacyLevel == 0) ? null : a.RelationshipStatus,
         Sex = a.Sex,
         Species = a.Species,
         SpeciesDetails = a.SpeciesDetails,
         Username = a.Name
     };
 }
开发者ID:okfurs,项目名称:okfurs.com,代码行数:28,代码来源:ProfileModelUtility.cs


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