public User getUser(string userName)
        {
            User serviceUser = new User();
            if (System.Threading.Monitor.TryEnter(obj3, 10000))
            {
                try
                {
                    serviceUser.FirstName = UserControl.getUser(userName).firstName;
                    serviceUser.LastName = UserControl.getUser(userName).lastName;
                    serviceUser.UserName = UserControl.getUser(userName).userName;
                    serviceUser.Password = UserControl.getUser(userName).password;
                    serviceUser.Role = UserControl.getUser(userName).role;

                }
                catch (NullReferenceException)
                {

                }
                finally
                {
                    System.Threading.Monitor.Exit(obj3);
                }
            }
            return serviceUser;
        }
        public void deleteUser(string userName)
        {
            User serviceUser = new User();

            if (System.Threading.Monitor.TryEnter(obj5, 10000))
            {
                try
                {
                    UserControl.deleteUser(userName);
                }
                finally
                {
                    System.Threading.Monitor.Exit(obj5);
                }
            }
        }
Exemplo n.º 3
0
        protected void ReceiverLogin_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string username = ReceiverLogin.UserName.ToString();
            string password = ReceiverLogin.Password.ToString();

            HealthCareWCFServices.User targetUser = userService.getUser(username);

            if (targetUser.Password == null)
            {
                ReceiverLogin.FailureText = "That username is not registereded.";
            }
            else
            {
                if (targetUser.Password.Equals(password) != true)
                {
                    ReceiverLogin.FailureText = "Password is not correct.";
                }
                else
                {
                    FormsAuthentication.RedirectFromLoginPage(ReceiverLogin.UserName, ReceiverLogin.RememberMeSet);
                }
            }
        }
        public List<User> getUsers()
        {
            List<User> users = new List<User>();

            if (System.Threading.Monitor.TryEnter(obj4, 10000))
            {
                try
                {

                    List<HealthCareModel.Object_Models.User> returnList = UserControl.getUsers();

                    if (returnList.Count != 0)
                    {
                        foreach (HealthCareModel.Object_Models.User userHost in returnList)
                        {
                            User serviceUser = new User();

                            serviceUser.FirstName = userHost.firstName;
                            serviceUser.LastName = userHost.lastName;
                            serviceUser.UserName = userHost.userName;
                            serviceUser.Password = userHost.password;
                            serviceUser.Role = userHost.role;

                            users.Add(serviceUser);
                        }
                    }
                }
                catch (NullReferenceException)
                {
                }
                finally
                {
                    System.Threading.Monitor.Exit(obj4);
                }
            }

            return users;
        }
        //  public void incrementAlarmCount(int alarmId) { } - no practical implementation yet
        public List<User> getTaskUsers(string taskName)
        {
            List<User> srvTaskUsers = new List<User>();

            if (System.Threading.Monitor.TryEnter(obj6, 10000))
            {
                try
                {
                    List<HealthCareModel.Object_Models.User> returnList = ExtendedControl.getTaskUsers(taskName);

                    if (returnList.Count != 0)
                    {
                        foreach (HealthCareModel.Object_Models.User userHost in returnList)
                        {
                            User srvUser = new User();

                            srvUser.FirstName = userHost.firstName;
                            srvUser.LastName = userHost.lastName;
                            srvUser.UserName = userHost.userName;
                            srvUser.Role = userHost.role;

                            srvTaskUsers.Add(srvUser);
                        }
                    }
                }
                catch (NullReferenceException)
                {
                }
                finally
                {
                    System.Threading.Monitor.Exit(obj6);
                }
            }

            return srvTaskUsers;
        }
        public List<User> getAllarmAttendants(string alarmName)
        {
            List<User> alarmAttendants = new List<User>();

            if (System.Threading.Monitor.TryEnter(obj3, 10000))
            {
                try
                {

                    List<HealthCareModel.Object_Models.User> returnList = ExtendedControl.getAllarmAttendants(alarmName);

                    if (returnList.Count != 0)
                    {
                        foreach (HealthCareModel.Object_Models.User attendantHome in returnList)
                        {
                            User srvUser = new User();

                            srvUser.FirstName = attendantHome.firstName;
                            srvUser.LastName = attendantHome.lastName;
                            srvUser.UserName = attendantHome.userName;
                            srvUser.Role = attendantHome.role;

                            alarmAttendants.Add(srvUser);
                        }
                    }
                }
                catch (NullReferenceException)
                {
                }
                finally
                {
                    System.Threading.Monitor.Exit(obj3);
                }
            }

            return alarmAttendants;
        }