コード例 #1
0
        private static UserLite CreateUserLite(TpUser tpUser)
        {
            var userType = tpUser.Type == 1 ? UserType.User : UserType.Requester;

            return(new UserLite
            {
                Id = tpUser.UserID,
                Email = tpUser.Email,
                UserType = userType,
                IsActive = tpUser.IsActive,
                DeleteDate = tpUser.DeleteDate,
                FirstName = tpUser.FirstName,
                LastName = tpUser.LastName,
                Login = tpUser.Login,
                CompanyId = tpUser.CompanyID
            });
        }
        private void CreateUser(string login, bool isActive, DateTime?deletedDate)
        {
            var user = new TpUser
            {
                Login      = login,
                Email      = string.Format("{0}@targetprocess.com", login),
                FirstName  = "FirstName",
                LastName   = "LastName",
                SecretWord = "abc",
                Type       = 1,
                IsActive   = isActive,
                DeleteDate = deletedDate
            };

            Context.TpUsers.InsertOnSubmit(user);
            Context.SubmitChanges();

            Context.ProjectMembers.InsertOnSubmit(new ProjectMember
            {
                ProjectID = Context.Projects.First().ProjectID,
                UserID    = user.UserID
            });
            Context.SubmitChanges();
        }
コード例 #3
0
 private static MappingLookup Create(TpUser tpUser)
 {
     return(new MappingLookup {
         Id = tpUser.UserID, Name = tpUser.Login
     });
 }
コード例 #4
0
 protected override bool IsUserTypeCorrect(TpUser user)
 {
     return(user.Type == 1);
 }
コード例 #5
0
        private static string GetEmployeeNameById(IEnumerable <TpUser> users, string id)
        {
            TpUser user = GetUserById(users, id);

            return(user.LastName + ", " + user.FirstName);
        }
コード例 #6
0
        private bool CheckUserField(string fieldValue, Func <TpUser, string> getUserFieldValueToCompare, TpUser x)
        {
            var fieldValueToCompare = getUserFieldValueToCompare(x) ??
                                      string.Empty;

            return(fieldValueToCompare.ToLower() == fieldValue.ToLower() &&
                   x.DeleteDate == null &&
                   IsUserTypeCorrect(x));
        }
コード例 #7
0
 protected virtual bool IsUserTypeCorrect(TpUser user)
 {
     return(true);
 }