• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# User类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: _Setup

 private void _Setup()
 {
     User user1 = new User("User1");
     User user2 = new User("User2");
     User user3 = new User("User3");
     _users = new List<User> {user1, user2, user3};
 }
开发者ID:Skookum,项目名称:Hero,代码行数:7,代码来源:UserControllerTests.cs


示例17: GetUser

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


示例18: AddUser

        /// <summary>
        /// Добавление юзера
        /// </summary>
        /// <param name="newU">новый юзер</param>
        /// <returns></returns>
        public bool AddUser(User newU)
        {
            using (var connection = new SqlConnection(ConnectionString()))
            {
                if (newU.Photo == null)
                {
                    var command = new SqlCommand();
                    command = new SqlCommand(
                    "INSERT INTO dbo.Users (Name, Birthdate, Age) " +
                    "VALUES (@Name, @Birthdate, @Age)", connection);
                    command.Parameters.AddWithValue("@Name", newU.Name);
                    command.Parameters.AddWithValue("@Birthdate", newU.Birthdate);
                    command.Parameters.AddWithValue("@Age", newU.Age);
                    connection.Open();
                    return command.ExecuteNonQuery() == 1;
                }
                else
                {
                    var command = new SqlCommand();
                    command = new SqlCommand(
                    "INSERT INTO dbo.Users (Name, Birthdate, Age, Photo) " +
                    "VALUES (@Name, @Birthdate, @Age, @Photo)", connection);
                    command.Parameters.AddWithValue("@Name", newU.Name);
                    command.Parameters.AddWithValue("@Birthdate", newU.Birthdate);
                    command.Parameters.AddWithValue("@Age", newU.Age);
                    command.Parameters.AddWithValue("@Photo", newU.Photo);

                    connection.Open();
                    return command.ExecuteNonQuery() == 1;
                }
            }
        }
开发者ID:TottoroChan,项目名称:test,代码行数:37,代码来源:DAL.cs


示例19: Radar

        public Radar(User owner)
            : base(owner.engine)
        {
            this.owner = owner;

            this.PopulateFunctions();
        }
开发者ID:GLAVAK,项目名称:AIGame,代码行数:7,代码来源:Radar.cs


示例20: bindFace

        private void bindFace( User user )
        {
            set( "profile", t2( new ProfileController().Main ) );
            set( "user.Face", user.PicMedium );

            set( "user.FriendCount", user.FriendCount );
            set( "user.FollowingCount", user.FollowingCount );
            set( "user.FollowersCount", user.FollowersCount );

            set( "user.FriendLink", t2( new Users.FriendController().FriendList ) );
            set( "user.FollowingLink", t2( new Users.FriendController().FollowingList ) );
            set( "user.FollowerLink", t2( new Users.FriendController().FollowerList ) );

            set( "user.AddFriendLink", t2( new FriendController().AddFriend, ctx.owner.Id ) );
            set( "user.AddFollowLink", t2( new FriendController().AddFollow, ctx.owner.Id ) );

            String lnkMsg = Link.To( new LinkController().NewMsg, ctx.owner.Id );

            set( "sendMsgLink", lnkMsg );

            String shareLink = Link.To( ctx.owner.obj, new wojilu.Web.Controller.ShareController().Add );
            shareLink = shareLink + string.Format( "?url={0}&title={1}&pic={2}",
                getFullUrl( toUser( user ) ), "" + user.Name + " �Ŀռ�", user.PicOriginal );

            set( "shareLink", shareLink );

            bind( "user", user );
        }
开发者ID:Boshin,项目名称:wojilu,代码行数:28,代码来源:MyFaceBinderController.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UserAccount类代码示例发布时间:2022-05-24
下一篇:
C# UseActionEnum类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap