Example #1
0
 public static void PopulateUserRoleAuth(UserRoleAuth input, System.Data.IDataReader reader)
 {
     input.RecordId = input.UserRoleAuthId = Utilities.ToInt(reader[Medical.Apartment.Common.UserRoleAuth.ColumnNames.UserRoleAuthId]);
     input.UserId = Utilities.ToGuid(reader[Medical.Apartment.Common.UserRoleAuth.ColumnNames.UserId]);
     input.RoleId = Utilities.ToGuid(reader[Medical.Apartment.Common.UserRoleAuth.ColumnNames.RoleId]);
     input.WholeOrg = Utilities.ToNBool(reader[Medical.Apartment.Common.UserRoleAuth.ColumnNames.WholeOrg]);
     input.SiteId = Utilities.ToNInt(reader[Medical.Apartment.Common.UserRoleAuth.ColumnNames.SiteId]);            
     input.UserName = Utilities.ToString(reader[Medical.Apartment.Common.UserRoleAuth.ColumnNamesExtended.UserName]);            
     input.RoleName = Utilities.ToString(reader[Medical.Apartment.Common.UserRoleAuth.ColumnNamesExtended.RoleName]);
     input.Site = Utilities.ToString(reader[Medical.Apartment.Common.UserRoleAuth.ColumnNamesExtended.Site]);
 }
Example #2
0
        public static UserRoleAuth UserRoleAuth(System.Data.IDataReader reader)
        {
            UserRoleAuth result = null;

            if (null != reader && reader.Read())
            {
                result = new UserRoleAuth();
                PopulateUserRoleAuth(result, reader);
            }

            return result;
        }
Example #3
0
        void CreateAspUserCompleted(AspUser aspUser)
        {
            //if (!string.IsNullOrEmpty(aspUser.ErrorMessage))
            //{
            //    Globals.IsBusy = false;
            //    MessageBox.Show(aspUser.ErrorMessage);
            //    return;
            //}
            //_aspUsers.Add(aspUser);
            //SavedAspUser = aspUser;
            //if (SaveUserAccountComplete != null)
            //{
            //    SaveUserAccountComplete(this, null);
            //}
            //Dictionary<Guid, string> userItemSource = uiUsers.ItemsSource as Dictionary<Guid, string>;
            //userItemSource.Add(aspUser.UserId, aspUser.UserName);
            //userItemSource.OrderBy(i => i.Value);
            //uiUsers.ItemsSource = null;
            //uiUsers.ItemsSource = userItemSource;
            //uiUsers.SelectedValue = aspUser.UserId;
            //RebindUserAccountData();
            //Globals.IsBusy = false;
            //MessageBox.Show(Globals.UserMessages.RecordsSaved);

            if (!string.IsNullOrEmpty(aspUser.ErrorMessage))
            {
                Globals.IsBusy = false;
                MessageBox.Show(aspUser.ErrorMessage);
                return;
            }
            _aspUsers.Add(aspUser);
            SavedAspUser = aspUser;
            if (SaveUserAccountComplete != null)
            {
                SaveUserAccountComplete(this, null);
            }
            Dictionary<Guid, string> userItemSource = uiUsers.ItemsSource as Dictionary<Guid, string>;
            userItemSource.Add(aspUser.UserId, aspUser.UserName);
            userItemSource.OrderBy(i => i.Value);
            uiUsers.ItemsSource = null;
            uiUsers.ItemsSource = userItemSource;
            uiUsers.SelectedValue = aspUser.UserId;
            RebindUserAccountData();
            if (Globals.UserLogin.IsUserPortalAdministrator)
            {
                UserRoleAuth uraOrgAdmin = new UserRoleAuth();
                uraOrgAdmin.RoleId = SecurityHelper.OrganisationAdministratorRoleId;
                uraOrgAdmin.WholeOrg = true;
                uraOrgAdmin.UserId = aspUser.UserId;
                uraOrgAdmin.IsChanged = true;
                uraOrgAdmin.CreatedBy = uraOrgAdmin.UpdatedBy = Globals.UserLogin.UserName;

                UserRoleAuth uraSecurityAdmin = new UserRoleAuth();
                uraSecurityAdmin.RoleId = SecurityHelper.SecurityAdminRoleId;
                uraSecurityAdmin.WholeOrg = true;
                uraSecurityAdmin.UserId = aspUser.UserId;
                uraSecurityAdmin.IsChanged = true;
                uraSecurityAdmin.CreatedBy = uraSecurityAdmin.UpdatedBy = Globals.UserLogin.UserName;

                List<UserRoleAuth> saveList = new List<UserRoleAuth>();
                saveList.Add(uraOrgAdmin);
                saveList.Add(uraSecurityAdmin);
                DataServiceHelper.SaveUserRoleAuthAsync(saveList, SaveUserRoleAuthCompleted);
            }
            else
            {
                Globals.IsBusy = false;
                MessageBox.Show(Globals.UserMessages.RecordsSaved);
            }

        }