Exemple #1
0
 public UserBDO GetUserBDO(int userId)
 {
     UserBDO userBDO = null;
     UserTypeBDO utype = null;
     using (var DCEnt = new DCFIEntities())
     {
         User user = (from u in DCEnt.Users
                      where u.UserId == userId
                      select u).FirstOrDefault();
         if (user != null)
         {
             utype = new UserTypeBDO()
             {
                 UserTypeCode = user.UserTypeCode
             };
             userBDO = new UserBDO()
             {
                 UserId = user.UserId,
                 UserName = user.UserName,
                 Password = user.Password,
                 LastName = user.LastName,
                 FirstName = user.UserName,
                 MiddleName = user.MiddleName,
                 UserType = utype
             };
         }
     }
     return userBDO;
 }
Exemple #2
0
 public UserBDO GetUserBDO(int userId)
 {
     UserBDO userBDO = null;
     UserTypeBDO utype = null;
     try { 
     using (var DCEnt = new DCFIEntities())
     {
         User user = (from u in DCEnt.Users
                      where u.UserId == userId
                      select u).FirstOrDefault();
         if (user != null)
         {
             utype = new UserTypeBDO()
             {
                 UserTypeCode = user.UserTypeCode
             };
             userBDO = new UserBDO()
             {
                 UserId = user.UserId,
                 UserName = user.UserName,
                 Password = user.Password,
                 LastName = user.LastName,
                 FirstName = user.UserName,
                 MiddleName = user.MiddleName,
                 UserType = utype
             };
         }
     }
     }
     catch (DbEntityValidationException dbEx)
     {
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 Trace.TraceInformation("Property: {0} Error: {1}",
                                         validationError.PropertyName,
                                         validationError.ErrorMessage);
             }
         }
     }
     return userBDO;
 }
Exemple #3
0
 private void ConvertUserTypeToUserTypeBDO(UserType u, UserTypeBDO userTypeBDO) {
     userTypeBDO.UserTypeCode = u.UserTypeCode;
     userTypeBDO.UsersType = u.UserType1;
         
 }
Exemple #4
0
        public List<UserTypeBDO> GetAllUserTypes()
        {
            List<UserType> userTypeList = new List<UserType>();
            using (var DCEnt = new DCFIEntities())
            {
                var allUserTypes = (DCEnt.UserTypes);
                userTypeList = allUserTypes.ToList<UserType>();
            }

            List<UserTypeBDO> userTypeBDOList = new List<UserTypeBDO>();
            foreach (UserType u in userTypeList)
            {
                UserTypeBDO userTypeBDO = new UserTypeBDO();
                ConvertUserTypeToUserTypeBDO(u, userTypeBDO);
                userTypeBDOList.Add(userTypeBDO);
            }
            return userTypeBDOList;
        }
Exemple #5
0
        private void ConvertUserToUserBDO(User user, UserBDO userBDO) {
            UserTypeBDO ut = new UserTypeBDO();
            ut.UserTypeCode = user.UserTypeCode;

            userBDO.UserId = user.UserId;
            userBDO.FirstName = user.FirstName;
            userBDO.LastName = user.LastName;
            userBDO.MiddleName = user.MiddleName;
            userBDO.UserName = user.UserName;
            userBDO.Password = user.Password;
            userBDO.Deactivated = user.Deactivated;
            userBDO.UserType = ut;

        }
Exemple #6
0
 public void TranslateUserTypeBDOToUserTypeDTO(UserTypeBDO userTypeBDO, UserType userType)
 {
     userType.UsersType = userTypeBDO.UsersType;
     userType.UserTypeCode = userTypeBDO.UserTypeCode;
 }
Exemple #7
0
 public void TranslateUserDTOToUserBDO(User user, UserBDO userBDO)
 {
     UserTypeBDO ut = new UserTypeBDO();
     ut.UserTypeCode = user.UserTypeCode;
     userBDO.UserId = user.UserId;
     userBDO.FirstName = user.FirstName;
     userBDO.LastName = user.LastName;
     userBDO.MiddleName = user.MiddleName;
     userBDO.UserName = user.UserName;
     userBDO.Password = user.Password;
     userBDO.UserType = ut;
 }
Exemple #8
0
        public List<UserTypeBDO> GetAllUserTypes()
        {
            List<UserType> userTypeList = new List<UserType>();
            List<UserTypeBDO> userTypeBDOList = new List<UserTypeBDO>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                var allUserTypes = (DCEnt.UserTypes);
                userTypeList = allUserTypes.ToList<UserType>();
            }

          
            foreach (UserType u in userTypeList)
            {
                UserTypeBDO userTypeBDO = new UserTypeBDO();
                ConvertUserTypeToUserTypeBDO(u, userTypeBDO);
                userTypeBDOList.Add(userTypeBDO);
            }
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                                validationError.PropertyName,
                                                validationError.ErrorMessage);
                    }
                }
            }
            return userTypeBDOList;
        }