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


C# Models.User类代码示例

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


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

示例1: GetCourses

 public IEnumerable<Course> GetCourses(User owner)
 {
     using (var db = new CourseManagementDbConext())
     {
         return db.Courses.Where(i => i.Owner == owner.Username && i.Deleted == false);
     }
 }
开发者ID:supermuk,项目名称:iudico,代码行数:7,代码来源:MixedCourseStorage.cs

示例2: CalculateSpecializedResultTest

        public void CalculateSpecializedResultTest()
        {
            IUDICO.Common.Models.User usr = new IUDICO.Common.Models.User() { Username = "Bob" };
            IUDICO.Common.Models.Theme thm = new IUDICO.Common.Models.Theme() { Name = "Theme One" };
            IUDICO.Common.Models.Shared.Statistics.AttemptResult AR = new IUDICO.Common.Models.Shared.Statistics.AttemptResult(1, usr, thm, IUDICO.Common.Models.Shared.Statistics.CompletionStatus.Completed, IUDICO.Common.Models.Shared.Statistics.AttemptStatus.Completed, IUDICO.Common.Models.Shared.Statistics.SuccessStatus.Passed, DateTime.Now, 0.5f);

            ThemeResult themeRes = new ThemeResult(usr, thm);
            List<AttemptResult> ARL = new List<AttemptResult>();
            ARL.Add(AR);
            themeRes.AttemptResults = ARL;
            themeRes.GetThemeResultScore();

            CurriculumResult currRes = new CurriculumResult();
            currRes.ThemeResult.Add(themeRes);
            Curriculum curr = null;
            currRes.CalculateSumAndMax(usr, curr);

            SpecializedResult target = new SpecializedResult();
            target.CurriculumResult.Add(currRes);
            target.CalculateSpecializedResult(usr);

            double? ExpectedSum = 50.0;
            double? ExpectedMax = 100.0;
            double? ExpectedPercent = 50.0;
            char ExpextedECTS = 'F';

            Assert.AreEqual(ExpectedSum, target.Sum);
            Assert.AreEqual(ExpectedMax, target.Max);
            Assert.AreEqual(ExpectedPercent, target.Percent);
            Assert.AreEqual(ExpextedECTS, target.ECTS);
        }
开发者ID:supermuk,项目名称:iudico,代码行数:31,代码来源:SpecializedResultTest.cs

示例3: AddUserToGroup

        public void AddUserToGroup(Group group, User user)
        {
            var db = GetDbContext();

            var groupUser = new GroupUser {GroupRef = group.Id, UserRef = user.Id};

            db.GroupUsers.InsertOnSubmit(groupUser);
            db.SubmitChanges();
        }
开发者ID:supermuk,项目名称:iudico,代码行数:9,代码来源:DatabaseUserStorage.cs

示例4: ActivateUserSuccess

 public void ActivateUserSuccess()
 {
     User temp = new User { Username = "ippe", Email = "[email protected]", Password = "pass123" };
     _Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
     _Tests.Storage.CreateUser(temp);
     System.Guid gg = _Tests.Storage.GetUser(u => u.Username == "ippe").Id;
     _Tests.Storage.ActivateUser(gg);
     Assert.AreEqual(_Tests.Storage.GetUser(u => u.Username == "ippe").IsApproved, true);
 }
开发者ID:supermuk,项目名称:iudico,代码行数:9,代码来源:ActivateUser.cs

示例5: EditUser

 public void EditUser()
 {
     User temp = new User { Username = "iphe", Email = "[email protected]", Password = "pass123" };
     User expected = new User { Username = "ipvep", Email = "[email protected]", Password = "pass123", Id = temp.Id , OpenId = "openid" };
     _Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
     _Tests.Storage.CreateUser(temp);
     var model = new EditUserModel(expected);
     _Tests.Storage.EditUser(temp.Id, model);
     //Assert.AreEqual(expected, _Tests.Storage.GetUser(u => u.Username == "ipvep"));
 }
开发者ID:supermuk,项目名称:iudico,代码行数:10,代码来源:EditUsersAccount.cs

示例6: ChangePasswordSuccess

 public void ChangePasswordSuccess()
 {
     var model = new ChangePasswordModel {OldPassword = "123", ConfirmPassword = "123", NewPassword = "321"};
     User temp = new User { Username = "ipepp", Email = "[email protected]", Password = "123" };
     _Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
     _Tests.Storage.CreateUser(temp);
     _Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "ipepp"));
     _Tests.Storage.ChangePassword(model);
     Assert.AreEqual(_Tests.Storage.GetUser(u => u.Username == "ipepp").Password, _Tests.Storage.EncryptPassword("321"));
 }
开发者ID:supermuk,项目名称:iudico,代码行数:10,代码来源:ChangePassword.cs

示例7: DetailsModel

 public DetailsModel(User user)
 {
     Id = user.Id;
     Username = user.Username;
     Name = user.Name;
     OpenId = user.OpenId;
     Email = user.Email;
     Groups = user.Groups;
     Roles = user.Roles;
     UserID = user.UserID;
 }
开发者ID:supermuk,项目名称:iudico,代码行数:11,代码来源:Models.cs

示例8: AddUserToRole

        public void AddUserToRole()
        {
            User temp = new User { Username = "icpe", Email = "[email protected]", Password = "pass123" };
            _Tests.MockStorage.Setup(s => s.GetCurrentUser()).Returns(_Tests.Storage.GetUser(u => u.Username == "panza"));
            _Tests.Storage.CreateUser(temp);

            var role = Role.Teacher;
            _Tests.Storage.AddUserToRole(role, temp);
            List<Role> roles = new List<Role>();
            roles.Add(role);
            //Assert.AreEqual(1, _Tests.Storage.GetUser(u => u.Username == "icpe").UserRoles.Count);
        }
开发者ID:supermuk,项目名称:iudico,代码行数:12,代码来源:ChangeUsersRole.cs

示例9: IndexModel

 public IndexModel(ILmsService iLmsService)
 {
     IEnumerable<Curriculum> allowedCurriculums;
     User teacherUser;
     teacherUser = iLmsService.FindService<IUserService>().GetCurrentUser();
     allowedCurriculums = iLmsService.FindService<ICurriculumService>().GetCurriculumsWithThemesOwnedByUser(teacherUser);
     //
     if (allowedCurriculums != null & allowedCurriculums.Count() != 0)
         _AllowedCurriculums = allowedCurriculums;
     else
         _AllowedCurriculums = null;
     _TeacherUser = teacherUser;
 }
开发者ID:supermuk,项目名称:iudico,代码行数:13,代码来源:IndexModel.cs

示例10: Create

        public ActionResult Create()
        {
            var user = new User
                           {
                               /*RolesList =
                                   _Storage.GetRoles().AsQueryable().Select(
                                       r =>
                                       new SelectListItem
                                           {Text = IUDICO.UserManagement.Localization.getMessage(r.ToString()), Value = ((int) r).ToString(), Selected = false}
                                    )*/
                           };

            return View(user);
        }
开发者ID:supermuk,项目名称:iudico,代码行数:14,代码来源:UserController.cs

示例11: CalculateSpecializedResult

        public void CalculateSpecializedResult(User user)
        {
            _Sum = 0.0;
            _Max = 0.0;
            _Percent = 0.0;
            _User = user;

            foreach (CurriculumResult curr in _CurriculumResult)
            {
                _Sum += curr.Sum;
                _Max += curr.Max;
            }

            _Percent = _Sum / _Max * 100.0;
            _ECTS = Ects(_Percent);
        }
开发者ID:supermuk,项目名称:iudico,代码行数:16,代码来源:SpecializedResult.cs

示例12: GetResults

        public IEnumerable<AttemptResult> GetResults(User user, Theme theme)
        {
            var results = new List<AttemptResult>
                              {
                                  new AttemptResult(0, user, theme, CompletionStatus.Unknown, AttemptStatus.Suspended,
                                                    SuccessStatus.Unknown, DateTime.Now, 0.21f),
                                  new AttemptResult(1, user, theme, CompletionStatus.NotAttempted, AttemptStatus.Active,
                                                    SuccessStatus.Unknown, DateTime.Now, null),
                                  new AttemptResult(2, user, theme, CompletionStatus.Completed, AttemptStatus.Completed,
                                                    SuccessStatus.Passed, DateTime.Now, 0.98f),
                                  new AttemptResult(3, user, theme, CompletionStatus.Incomplete, AttemptStatus.Completed,
                                                    SuccessStatus.Failed, DateTime.Now, 0.04f)
                              };

            return results;
        }
开发者ID:supermuk,项目名称:iudico,代码行数:16,代码来源:FakeTestingService.cs

示例13: ThemeInfoModel

        private ThemeInfoModel() 
        {
            List<AttemptResult> testAttemptList = new List<AttemptResult>();
            List<User> testUserList = new List<User>();
            List<Theme> testThemeList = new List<Theme>();
            float? attemptScore;
            AttemptResult testAttempt;

            User testUser1 = new User();
            testUser1.Name = "user1";
            Theme testTheme1 = new Theme();
            testTheme1.Name = "theme1";
            User testUser2 = new User();
            testUser2.Name = "user2";
            Theme testTheme2 = new Theme();
            testTheme2.Name = "theme2";

            attemptScore = (float?)0.55;
            testAttempt = new AttemptResult(1, testUser1, testTheme1, new CompletionStatus(), new AttemptStatus(), new SuccessStatus(), DateTime.Now, attemptScore);
            testAttemptList.Add(testAttempt);
            
            attemptScore = (float?)0.65;
            testAttempt = new AttemptResult(1, testUser1, testTheme2, new CompletionStatus(), new AttemptStatus(), new SuccessStatus(), null, attemptScore);
            testAttemptList.Add(testAttempt);

            attemptScore = (float?)0.85;
            testAttempt = new AttemptResult(1, testUser2, testTheme1, new CompletionStatus(), new AttemptStatus(), new SuccessStatus(), DateTime.Now, attemptScore);
            testAttemptList.Add(testAttempt);

            attemptScore = (float?)0.95;
            testAttempt = new AttemptResult(1, testUser2, testTheme2, new CompletionStatus(), new AttemptStatus(), new SuccessStatus(), null, attemptScore);
            testAttemptList.Add(testAttempt);

            testUserList.Add(testUser1);
            testThemeList.Add(testTheme1);
            testUserList.Add(testUser2);
            testThemeList.Add(testTheme2);

            this._LastAttempts = testAttemptList;
            this.SelectGroupStudents = testUserList;
            this.SelectCurriculumThemes = testThemeList;
        }
开发者ID:supermuk,项目名称:iudico,代码行数:42,代码来源:ThemeInfoModel.cs

示例14: GetCurrentUser

        public User GetCurrentUser()
        {
            if (HttpContext.Current.User == null)
            {
                var user = new User {RoleId = (int) Role.None};

                return user;
            }

            var identity = HttpContext.Current.User.Identity;

            if (!identity.IsAuthenticated)
            {
                return null;
            }

            using (var db = new UserManagementDBContext())
            {
                return db.Users.Where(u => u.Username == identity.Name).FirstOrDefault();
            }
        }
开发者ID:supermuk,项目名称:iudico,代码行数:21,代码来源:DatabaseUserStorage.cs

示例15: CreateUser

        public MembershipCreateStatus CreateUser(string username, string password, string email, string openId, bool isApproved)
        {
            try
            {
                var user = new User
                {
                    Username = username,
                    Password = password,
                    Email = email,
                    IsApproved = isApproved
                };

                _UserStorage.CreateUser(user);

                return MembershipCreateStatus.Success;
            }
            catch (Exception)
            {
                return MembershipCreateStatus.ProviderError;
            }
        }
开发者ID:supermuk,项目名称:iudico,代码行数:21,代码来源:OpenIdMembershipProvider.cs


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