Ejemplo n.º 1
0
        /// <summary>
        /// Updates a user
        /// </summary>
        /// <param name="usertId"></param>
        /// <param name="userEntity"></param>
        /// <returns></returns>
        public bool UpdateUser(Guid userId, BusinessEntities.hmisUserBase userEntity)
        {
            var success = false;

            if (userEntity != null)
            {
                using (var scope = new TransactionScope())
                {
                    var user = _unitOfWork.UserRepository.GetByID(userId);
                    if (user != null)
                    {
                        user.SID = userEntity.SID;
                        _unitOfWork.UserRepository.Update(user);
                        _unitOfWork.Save();
                        scope.Complete();
                        success = true;
                    }
                }
            }
            return(success);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a user in DBV
 /// </summary>
 /// <param name="userEntity"></param>
 /// <returns></returns>
 public Guid CreateUser(BusinessEntities.hmisUserBase userEntity)
 {
     using (var scope = new TransactionScope())
     {
         var userHMIS = new hmis_user_base
         {
             SID           = Guid.NewGuid(),
             user_name     = userEntity.user_name,
             password      = EncryptText("wgt_hmis", userEntity.password),
             first_name    = userEntity.first_name,
             last_name     = userEntity.last_name,
             createdby     = "Test Data",
             created_date  = DateTime.Now,
             modifiedby    = "Test Data",
             modified_date = DateTime.Now
         };
         _unitOfWork.UserRepository.Insert(userHMIS);
         _unitOfWork.Save();
         scope.Complete();
         return(userHMIS.SID);
     }
 }