Beispiel #1
0
        public static (UserTO, string) GetUser(string username, string password)
        {
            try
            {
                // Connect to the Configurate Database
                using (IDbConnection connection = new SqlConnection(NetworkInfomation.ConnectionString("ConfigurateDB")))
                {
                    UserTO result = null;

                    try
                    {
                        // Run SQL query
                        result = connection.Query <UserTO>($"SELECT * FROM Users WHERE username = '******'").ToList()[0];
                    }
                    catch
                    {
                        // Return an error if SQL query fails
                        return(null, $"The username { username } does not exist. Please try again.");
                    }

                    // Check if password is correct, return an error if it is not
                    if (result.Userpsw != password)
                    {
                        return(null, "Wrong password. Please try again.");
                    }

                    // Return successfull result
                    return(result, "All good.");
                }
            }
            catch
            {
                return(null, "Couldn't connect to database. Please try again.");
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (calendarSelectDate.SelectedDate == null || calendarSelectDate.SelectedDate.Year == 1)
                {
                    calendarSelectDate.SelectedDate = DateTime.Today;
                    _selectedDate = DateTime.Today;
                }
                else
                {
                    _selectedDate = calendarSelectDate.SelectedDate;
                }

                _dao = new SchedulingDao();
                UserTO user = _dao.connectAndLogin(_siteCode, _accessCode, _verifyCode);
                //_dao.connect("901");
                //_dao.login("1programmer", "programmer1", "");
                HospitalLocationTO clinic          = _dao.getClinicSchedulingDetails("12");
                PatientTO          selectedPatient = _dao.selectPatient(_patient);
                _ssn = selectedPatient.ssn;
                labelPatientName.Text = selectedPatient.name;
                _dao.disconnect();
                // just do this once at launch
                _slots = SchedulingUtils.getItemsFromAvailabilityString
                             (clinic.clinicDisplayStartTime, Convert.ToInt32(clinic.appointmentLength), Convert.ToInt32(clinic.displayIncrements), clinic.availability);
                Session.Add("SLOTS", _slots);
                populateDropdown(_slots);
            }

            _slots = Session["SLOTS"] as IList <TimeSlot>;
        }
Beispiel #3
0
        ///<summary>Lista todos os usuários
        ///<returns>Retorna uma lista com todos os usuários cadastrados</returns>
        ///</summary>
        public List <UserTO> GetAll()
        {
            string sql = "Select Id, Email, Name, Telephone FROM [User] ORDER BY Name";

            using (var conn = new SqlConnection(StringConnection))
            {
                var           cmd     = new SqlCommand(sql, conn);
                List <UserTO> lstUser = new List <UserTO>();
                UserTO        user    = null;

                try
                {
                    conn.Open();
                    using (var reader = cmd.ExecuteReader(CommandBehavior.CloseConnection))
                    {
                        while (reader.Read())
                        {
                            user = new UserTO
                            {
                                Id        = (long)reader["Id"],
                                Email     = reader["Email"].ToString(),
                                Name      = reader["Name"].ToString(),
                                Telephone = reader["Telephone"].ToString()
                            };
                            lstUser.Add(user);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                return(lstUser);
            }
        }
Beispiel #4
0
        public UserTO userLookup(string duz)
        {
            UserTO result = new UserTO();
            string msg    = MdwsUtils.isAuthorizedConnection(mySession);

            if (String.IsNullOrEmpty(duz))
            {
                result.fault = new FaultTO("Missing DUZ param");
            }
            else if (msg != "OK")
            {
                result.fault = new FaultTO(msg);
            }
            if (result.fault != null)
            {
                return(result);
            }
            try
            {
                AbstractConnection cxn  = mySession.ConnectionSet.BaseConnection;
                UserApi            api  = new UserApi();
                User[]             user = api.userLookup(cxn, new System.Collections.Generic.KeyValuePair <string, string>("DUZ", duz));
                result = new UserTO(user[0]);
            }
            catch (Exception exc)
            {
                result.fault = new FaultTO(exc);
            }
            return(result);
        }
Beispiel #5
0
        ///<summary>Cadastra os dados de um usuário
        ///<param name="pUser">Objeto contendo os dados do usuário a ser cadastrado</param>
        ///</summary>
        public void Save(UserTO pUser)
        {
            using (var conn = new SqlConnection(StringConnection))
            {
                string     sql = "INSERT INTO [User] (Email, Name, Telephone) VALUES (@Email, @Name, @Telephone)";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@Email", pUser.Email);
                cmd.Parameters.AddWithValue("@Name", pUser.Name);

                if (!string.IsNullOrWhiteSpace(pUser.Telephone))
                {
                    cmd.Parameters.AddWithValue("@Telephone", pUser.Telephone);
                }

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Beispiel #6
0
        public static User ToDomain(this UserTO userTo)
        {
            try
            {
                var session    = userTo.Sessions?.Select(x => x.ToDomain()).ToList();
                var UserDomain = new User
                {
                    Id          = userTo.Id,
                    Name        = userTo.Name,
                    Email       = userTo.Email,
                    Company     = userTo.Company,
                    IsActivated = userTo.IsActivated,
                    Role        = userTo.Role,
                    Sessions    = session
                };

                UserDomain.IsValid();

                return(UserDomain);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #7
0
        protected void LoginClick(object sender, EventArgs e)
        {
            string accessCode = textBoxAccessCode.Text;
            string verifyCode = textBoxVerifyCode.Text;

            try
            {
                _mySession.VistaDao.connect(_mySession.SelectedSite);
                UserTO user = _mySession.VistaDao.login(accessCode, verifyCode);
                if (user.fault != null) // invalid login
                {
                    labelMessage.Text = user.fault.message;
                }
                else
                {
                    _mySession.VistaDao.disconnect(); // Why are we disconnecting?? We're done with the connection until we need more data. We can visit for subsequent calls
                    _mySession.User      = user;
                    Session["MySession"] = _mySession;
                    Response.Redirect("PatientSelection.aspx", true);
                }
            }
            catch (System.Threading.ThreadAbortException)
            {
                // ugh... MS... this exception is thrown by the Response.Redirect function - we just catch it and continue normally
            }
            catch (Exception exc)
            {
                labelMessage.Text = exc.Message;
            }
        }
        public void testConnectAndLogin()
        {
            RegionArray siteTable    = _dao.getSites();
            SiteTO      selectedSite = null; // placeholder

            // we already know our site code but, just for completeness, showing walking through the region array here
            // the VA organizes itself logically and geographically by regions and sites. "regions" is  roughly what
            // we term internally as VISNs. There are 23 VISNs in VA - Ann Arbor is in VISN 11. Since MDWS uses this organization
            // for other things, we modified the terminology slightly
            // This first foreach loop goes through all the regions in the site table - in our test environment we only have one region
            foreach (RegionTO region in siteTable.regions)
            {
                if (region.sites != null && region.sites.sites != null && region.sites.sites.Length > 0)
                {
                    foreach (SiteTO site in region.sites.sites)
                    {
                        if (site.sitecode == "100") // we chose a really difficult way of finding our site!
                        {
                            selectedSite = site;
                            break;
                        }
                    }
                }
                if (selectedSite != null)
                {
                    break;
                }
            }
            UserTO user = _dao.connectAndLogin(selectedSite.sitecode, _accessCode, _verifyCode);

            Assert.IsNull(user.fault);
        }
Beispiel #9
0
        public void GetUserBySession_NoUserSession()
        {
            var options = new DbContextOptionsBuilder <RegistrationContext>()
                          .UseInMemoryDatabase(databaseName: MethodBase.GetCurrentMethod().Name)
                          .Options;

            using var RSCxt = new RegistrationContext(options);
            IRSUserRepository    userRepository    = new UserRepository(RSCxt);
            IRSCourseRepository  courseRepository  = new CourseRepository(RSCxt);
            IRSSessionRepository sessionRepository = new SessionRepository(RSCxt);

            var Teacher = new UserTO()
            {
                Name  = "Max",
                Email = "*****@*****.**",
                Role  = UserRole.Teacher
            };
            var Jack = new UserTO()
            {
                Name  = "Jack Jack",
                Email = "*****@*****.**",
                Role  = UserRole.Attendee
            };
            var John = new UserTO()
            {
                Name  = "John",
                Email = "*****@*****.**",
                Role  = UserRole.Attendee
            };

            var AddedUser0 = userRepository.Add(Teacher);
            var AddedUser1 = userRepository.Add(Jack);
            var AddedUser2 = userRepository.Add(John);

            RSCxt.SaveChanges();

            var SQLCourse = new CourseTO()
            {
                Name = "SQL"
            };

            var AddedCourse = courseRepository.Add(SQLCourse);

            RSCxt.SaveChanges();

            var SQLSession = new SessionTO()
            {
                Attendees = new List <UserTO>()
                {
                },
                Course  = AddedCourse,
                Teacher = null
            };

            var AddedSession = sessionRepository.Add(SQLSession);

            RSCxt.SaveChanges();

            Assert.ThrowsException <NullReferenceException>(() => userRepository.GetUsersBySession(AddedSession));
        }
Beispiel #10
0
        ///<summary>Valida a regra de negócio de campos obrigatórios
        ///<param name="pUser">Objeto contendo os dados do usuário a ser cadastrado</param>
        ///<returns>key = booleano que informa se o objeto é valido ou não, value = string com a mensagem de retorno</returns>
        ///</summary>
        private KeyValuePair <bool, string> ValidateUser(UserTO pUser)
        {
            bool   isValid   = true;
            string strReturn = string.Empty;

            if (string.IsNullOrWhiteSpace(pUser.Name))
            {
                strReturn += !string.IsNullOrWhiteSpace(strReturn) ? Environment.NewLine : string.Empty;
                strReturn += "O campo 'Nome' é de preenchimento obrigatório";
                isValid    = false;
            }
            else if (!pUser.Name.Trim().Contains(" "))
            {
                strReturn += !string.IsNullOrWhiteSpace(strReturn) ? Environment.NewLine : string.Empty;
                strReturn += "O campo 'Nome' deve ser preenchido com o nome completo";
                isValid    = false;
            }


            if (string.IsNullOrWhiteSpace(pUser.Email))
            {
                strReturn += !string.IsNullOrWhiteSpace(strReturn) ? Environment.NewLine : string.Empty;
                strReturn += "O campo 'Email' é de preenchimento obrigatório";
                isValid    = false;
            }

            return(new KeyValuePair <bool, string>(isValid, strReturn));
        }
Beispiel #11
0
        ///<summary>Cadastra os dados de um usuário
        ///<param name="pUser">Objeto contendo os dados do usuário a ser cadastrado</param>
        ///<returns>key = booleano que informa se a função executou com sucesso ou não, value = string com a mensagem de retorno</returns>
        ///</summary>
        public KeyValuePair <bool, string> Save(UserTO pUser)
        {
            string strReturn  = string.Empty;
            bool   boolReturn = false;

            var validate = ValidateUser(pUser);

            if (validate.Key)
            {
                try
                {
                    UserDAL userDAL = new UserDAL();
                    userDAL.Save(pUser);
                    strReturn  = "Usuário cadastrado com sucesso!";
                    boolReturn = true;
                }
                catch (Exception ex)
                {
                    strReturn  = string.Format("Erro ao cadastrar o usuário! ({0})", ex.Message);
                    boolReturn = false;
                }
            }
            else
            {
                strReturn  = validate.Value;
                boolReturn = false;
            }

            return(new KeyValuePair <bool, string>(boolReturn, strReturn));
        }
Beispiel #12
0
        ///<summary>Obtém um usuário pelo ID
        ///<param name="id">Id do registro que obtido.</param>
        ///<returns>Retorna um usuário pelo id. key = booleano que informa se a função executou com sucesso ou não,
        ///value.key = string com a mensagem de retorno, value.value dados do usuário</returns>
        ///</summary>
        public KeyValuePair <bool, KeyValuePair <string, UserTO> > GetById(long pId)
        {
            string strReturn  = string.Empty;
            bool   boolReturn = false;
            UserTO user       = null;

            if (pId > 0)
            {
                try
                {
                    UserDAL userDAL = new UserDAL();
                    user       = userDAL.GetById(pId);
                    strReturn  = "OK";
                    boolReturn = true;
                }
                catch (Exception ex)
                {
                    strReturn  = string.Format("Erro ao obter a lista de usuários! ({0})", ex.Message);
                    boolReturn = false;
                }
            }
            else
            {
                strReturn  = "Id não informado";
                boolReturn = false;
            }

            return(new KeyValuePair <bool, KeyValuePair <string, UserTO> >(boolReturn,
                                                                           new KeyValuePair <string, UserTO>(strReturn, user)));
        }
Beispiel #13
0
        public void UserRepositoryNotInsertInDB_WhenInvalid()
        {
            var options = new DbContextOptionsBuilder <RegistrationContext>()
                          .UseInMemoryDatabase(databaseName: MethodBase.GetCurrentMethod().Name)
                          .Options;

            using (var RSCxt = new RegistrationContext(options))
            {
                //Arrange
                IRSUserRepository userRepository = new UserRepository(RSCxt);

                var Teacher = new UserTO()
                {
                    Name  = "Max",
                    Email = "*****@*****.**",
                    Role  = UserRole.Teacher
                };

                var Michou = new UserTO()
                {
                    Id    = -420,
                    Name  = "Michou Miraisin",
                    Email = "*****@*****.**",
                    Role  = UserRole.Attendee
                };

                var AddedTeacher  = userRepository.Add(Teacher);
                var AddedAttendee = userRepository.Add(Michou);
                RSCxt.SaveChanges();
                //Assert

                Assert.AreEqual(1, userRepository.GetAll().Count());
            }
        }
Beispiel #14
0
        ///<summary>Atualiza os dados de um usuário
        ///<param name="pUser">Objeto contendo os dados do usuário a ser atualizado</param>
        ///</summary>
        public void Update(UserTO pUser)
        {
            using (var conn = new SqlConnection(StringConnection))
            {
                string     sql = "UPDATE [User] SET Email = @Email, Name = @Name, Telephone = @Telephone WHERE Id = @Id";
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@Id", pUser.Id);
                cmd.Parameters.AddWithValue("@Email", pUser.Email);
                cmd.Parameters.AddWithValue("@Name", pUser.Name);

                if (!string.IsNullOrWhiteSpace(pUser.Telephone))
                {
                    cmd.Parameters.AddWithValue("@Telephone", pUser.Telephone);
                }

                try
                {
                    conn.Open();
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
Beispiel #15
0
        public void UserRepositoryInsertInDB_WhenValid()
        {
            var options = new DbContextOptionsBuilder <RegistrationContext>()
                          .UseInMemoryDatabase(databaseName: MethodBase.GetCurrentMethod().Name)
                          .Options;

            using (var RSCxt = new RegistrationContext(options))
            {
                //Arrange
                var userToUse = new UserTO()
                {
                    //Id = 0,
                    Name        = "Thomas Lion",
                    Role        = UserRole.Assistant,
                    Email       = "*****@*****.**",
                    Company     = "Business Formation",
                    IsActivated = true,
                };

                var userRepository = new UserRepository(RSCxt);
                //Act
                userRepository.Add(userToUse);
                RSCxt.SaveChanges();
                //Assert
                Assert.AreEqual(1, userRepository.GetAll().Count());
                //var userToAssert = userRepository.GetById(1);
            }
        }
Beispiel #16
0
        /*
         *
         * public AssistantRole(IMSUnitOfWork iMSUnitOfWork) : base(iMSUnitOfWork)
         * {
         *  this.iMSUnitOfWork = iMSUnitOfWork ?? throw new System.ArgumentNullException(nameof(iMSUnitOfWork));
         * }
         *
         * */
        public bool AddUser(UserTO userTO)
        {
            if (userTO is null)
            {
                throw new LoggedException(new ArgumentNullException(nameof(userTO)));
            }

            if (userTO.ID != 0)
            {
                throw new Exception("Existing user");
            }

            userTO.Name.IsNullOrWhiteSpace("Missing User Name.");

            try
            {
                userTO.ToDomain();
                iRSUnitOfWork.UserRepository.Add(userTO);

                return(true);
            }
            catch (Exception)
            {
                throw;
            }
        }
Beispiel #17
0
        public bool UpdateUser(UserTO user)
        {
            var sql    = @"update User 
            set Password = @Password,
            Phone = @Phone,
            Email = @Email,
            Description = @Description
            where UserId = @UserId
            ";
            var result = DbManager.NewConnection().Execute(sql,
                                                           new
            {
                Password    = user.Password,
                Phone       = user.Phone,
                Email       = user.Email,
                Description = user.Description,
                UserId      = user.UserId
            });

            if (result > 0)
            {
                return(true);
            }
            return(false);
        }
        public async Task <IActionResult> Subscription(SubscriptionViewModel subscriptionVM)
        {
            if (!ModelState.IsValid)
            {
                return(View(subscriptionVM));
            }

            var user = new UserTO
            {
                Email     = subscriptionVM.Email,
                FirstName = subscriptionVM.FirstName,
                LastName  = subscriptionVM.LastName,
                UserName  = subscriptionVM.Email
            };

            var result = await _userManager.CreateAsync(user, subscriptionVM.Password);

            if (result.Succeeded)
            {
                var resultRole = await _userManager.AddToRoleAsync(user, subscriptionVM.RoleSelected);

                if (resultRole.Succeeded)
                {
                    await _userManager.AddClaimAsync(user, new Claim("Age", subscriptionVM.Age.ToString()));

                    return(RedirectToAction("Index", "home"));
                }
            }
            foreach (var item in result.Errors)
            {
                ModelState.AddModelError(item.Code, item.Description);
            }
            return(View(subscriptionVM));
        }
        public void testConnectAndLogin()
        {
            UserTO result = _dao.connectAndLogin("901", "1programmer", "programmer1");

            Assert.IsNotNull(result);
            Assert.IsNull(result.fault);
        }
Beispiel #20
0
        internal void addHomeData(Patient patient)
        {
            if (patient == null)
            {
                return;
            }
            try
            {
                Site       site = mySession.SiteTable.getSite(patient.CmorSiteId);
                DataSource src  = site.getDataSourceByModality("HIS");

                MySession  newMySession = new MySession(mySession.FacadeName);
                AccountLib accountLib   = new AccountLib(newMySession);
                UserTO     visitUser    = accountLib.visitAndAuthorize(mySession.MdwsConfiguration.AllConfigs[ConfigFileConstants.BSE_CONFIG_SECTION][MdwsConfigConstants.SERVICE_ACCOUNT_PASSWORD],
                                                                       patient.CmorSiteId, mySession.ConnectionSet.BaseConnection.DataSource.SiteId.Id, mySession.User.Name.LastNameFirst,
                                                                       mySession.User.Uid, mySession.User.SSN.toString(), "OR CPRS GUI CHART");

                PatientApi patientApi = new PatientApi();
                patient.LocalPid = patientApi.getLocalPid(newMySession.ConnectionSet.BaseConnection, patient.MpiPid);
                patientApi.addHomeDate(newMySession.ConnectionSet.BaseConnection, patient);
                newMySession.ConnectionSet.BaseConnection.disconnect();
            }
            catch (Exception)
            {
                // just pass back patient unchanged
            }
        }
Beispiel #21
0
        public bool Remove(UserTO entity)
        {
            if (entity is null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            return(Remove(entity.UserId));
        }
        [ExpectedException(typeof(ApplicationException), ExpectedMessage = "No patients returned for that search...")] // exception is thrown by DAO
        public void testMatchSsnKnownNonExistent()
        {
            _vistaDao.connect("901");
            UserTO user = _vistaDao.login("04VEHU", "VEHU04");

            IList <PatientTO> result = _vistaDao.match("123456789");

            Assert.Fail("Previous call should have thrown exception");
        }
        public void AddUser_ThrowException_WhenUserIDisDiferentOfZero() // Exist
        {
            var assistant = new Assistant();
            var userToAdd = new UserTO {
                ID = 1, Name = "User", IsActivated = true, Company = "Company 01", Role = UserRole.Assistant, Email = "*****@*****.**"
            };

            Assert.ThrowsException <Exception>(() => assistant.AddUser(userToAdd));
        }
        public void Should_Have_One_UserSessions()
        {
            #region TOInitialization

            UserTO student = new UserTO()
            {
                Id    = 1,
                Name  = "Jacky Fringant",
                Email = "*****@*****.**",
                Role  = UserRole.Attendee,
            };

            UserTO teacher = new UserTO()
            {
                Id    = 2,
                Name  = "Johnny Begood",
                Email = "*****@*****.**",
                Role  = UserRole.Teacher
            };

            CourseTO sql = new CourseTO()
            {
                Id   = 1,
                Name = "SQL"
            };

            SessionTO sessionTO = new SessionTO()
            {
                Id          = 1,
                Teacher     = teacher,
                Course      = sql,
                SessionDays = new List <SessionDayTO>()
                {
                    new SessionDayTO()
                    {
                        Id = 1, Date = new DateTime(2020, 2, 3), PresenceType = SessionPresenceType.MorningAfternoon
                    },
                    new SessionDayTO()
                    {
                        Id = 2, Date = new DateTime(2020, 2, 4), PresenceType = SessionPresenceType.MorningAfternoon
                    },
                    new SessionDayTO()
                    {
                        Id = 3, Date = new DateTime(2020, 2, 5), PresenceType = SessionPresenceType.MorningAfternoon
                    }
                },

                Attendees = new List <UserTO>()
                {
                    student,
                }
            };

            #endregion TOInitialization

            SessionEF sessionConverted = sessionTO.ToEF();
        }
 public static UserEF ToEF(this UserTO user)
 {
     return(new UserEF
     {
         FirstName = user.FirstName,
         LastName = user.LastName,
         //Questions = user.Questions?.Select(x => x.ToEF()).ToList()
     });
 }
        public void Should_Throw_Exception_When_Course_IsArchived()
        {
            var options = new DbContextOptionsBuilder <RegistrationContext>()
                          .UseInMemoryDatabase(databaseName: MethodBase.GetCurrentMethod().Name)
                          .Options;

            using (var context = new RegistrationContext(options))
            {
                IRSUserRepository    userRepository    = new UserRepository(context);
                IRSSessionRepository sessionRepository = new SessionRepository(context);
                IRSCourseRepository  courseRepository  = new CourseRepository(context);

                var Teacher = new UserTO()
                {
                    //Id = 420,
                    Name  = "Christian",
                    Email = "*****@*****.**",
                    Role  = UserRole.Teacher
                };

                var Michou = new UserTO()
                {
                    //Id = 45,
                    Name  = "Michou Miraisin",
                    Email = "*****@*****.**",
                    Role  = UserRole.Attendee
                };

                var AddedTeacher  = userRepository.Add(Teacher);
                var AddedAttendee = userRepository.Add(Michou);
                context.SaveChanges();

                var SQLCourse = new CourseTO()
                {
                    //Id = 28,
                    Name       = "SQL",
                    IsArchived = true
                };

                var AddedCourse = courseRepository.Add(SQLCourse);
                context.SaveChanges();

                var SQLSession = new SessionTO()
                {
                    //Id = 1,
                    Attendees = new List <UserTO>()
                    {
                        AddedAttendee
                    },
                    Course  = AddedCourse,
                    Teacher = AddedTeacher,
                };

                Assert.ThrowsException <ArgumentException>(() => sessionRepository.Add(SQLSession));
            }
        }
Beispiel #27
0
 public UserTO getUser(string sitecode, string DUZ)
 {
     if (sitecode == "")
     {
         UserTO result = new UserTO();
         result.fault = new FaultTO("Missing sitecode");
         return(result);
     }
     return(getUser(mySession.ConnectionSet.getConnection(sitecode), DUZ));
 }
Beispiel #28
0
        public IEnumerable <SessionTO> GetByUser(UserTO user)
        {
            if (user.Role == UserRole.Assistant)
            {
                throw new ArgumentException("Assistant can not subscribe to sessions");
            }

            return(GetAll().Where(x => (x.Attendees.Any(y => y.Id == user.Id)) ||
                                  (x.Teacher.Id == user.Id)));
        }
Beispiel #29
0
        public void AddUser_ThrowException_WhenUserIDisDiferentThanZero()
        {
            var assistant = new Assistant((new Mock <IRSUnitOfWork>()).Object);
            var userToAdd = new UserTO {
                ID = 1, Name = "User", IsActivated = true, Company = "Company1", Role = UserRole.Assistant, Email = "*****@*****.**"
            };

            //Assert
            Assert.ThrowsException <Exception>(() => assistant.AddUser(userToAdd));
        }
Beispiel #30
0
        public UserTO login(string accessCode, string verifyCode)
        {
            UserTO result = _svc.login(accessCode, verifyCode, "OR CPRS GUI CHART");

            if (result.fault != null)
            {
                throw new ApplicationException(result.fault.message);
            }
            return(result);
        }