Esempio n. 1
0
        public async Task RunAsync(IRestContext context)
        {
            ICustomSettingsApi settingsApi = context.Factory.CreateUserCustomSettingsApi();

            // Setting some preferences
            UserPreferences preferences = new UserPreferences
            {
                flag = true,
                array = new[] { "a", "b", "c" },
                entity = new UserPreferences.Entity { rank = 4, role = "user" }
            };

            if (await settingsApi.SetCustomSettingAsync("preferences", preferences))
            {
                Console.WriteLine("Created custom settings: preferences");
            }

            // Retrieving custom settings names
            IEnumerable<string> names = await settingsApi.GetCustomSettingsAsync();
            string flatList = string.Join(", ", names);
            Console.WriteLine("Retrieved available setting names: [{0}]", flatList);

            // Retrieving preferences back
            UserPreferences instance = await settingsApi.GetCustomSettingAsync<UserPreferences>("preferences");
            Console.WriteLine("Retrieved preferences back:");
            Console.WriteLine("\tpreferences.flag={0}, preferences.entity.rank={1}", instance.flag, instance.entity.rank);
        }
        public ColorWindow()
        {
            InitializeComponent();
            var userPrefs = new UserPreferences();
            color1.SelectedColor = CommonFunction.ConvertoMediaColor(userPrefs.Color1);
            color2.SelectedColor = CommonFunction.ConvertoMediaColor(userPrefs.Color2);
            bgColor1.SelectedColor = CommonFunction.ConvertoMediaColor(userPrefs.BgColor1);
            bgColor2.SelectedColor = CommonFunction.ConvertoMediaColor(userPrefs.BgColor2);
            SelectedFont.Text = userPrefs.CurrentFont;
            SelectedFontSize.Text = userPrefs.CurrentSize.ToString();
            if (!string.IsNullOrEmpty(userPrefs.BibileLocation))
            {
                //data\\" + bible + ".xml
                string location = userPrefs.BibileLocation.Replace("data\\", "").Replace(".xml","");
                currentBible = location;
                rcboBible.Text = location;

            }
            var screens = Screen.AllScreens;
            foreach (var screen in screens)
            {
                rcboMonitor.Items.Add(new RadComboBoxItem() {Content = screen.DeviceName});
            }
            if (userPrefs.ProjectorScreen > screens.Count())
                rcboMonitor.SelectedIndex = screens.Count() - 1;
            else
            {
                rcboMonitor.SelectedIndex = userPrefs.ProjectorScreen >= 0 ? userPrefs.ProjectorScreen : screens.Count() - 1;
            }
        }
        public ClientPatcher(UserPreferences theUserPrefs)
        {
            InitializeComponent();

            myUserPrefs = theUserPrefs;
            this.Loaded += new RoutedEventHandler(ClientPatcher_Loaded);
        }
Esempio n. 4
0
 public User()
 {
     Profile = new UserProfile();
     Preferences = new UserPreferences();
     Roles = new List<string>();
     AuthAccounts = new List<AuthAccount>();
 }
        public ServerList(UserPreferences theUserPrefs)
        {
            InitializeComponent();

            myUserPrefs = theUserPrefs;

            this.Loaded += new RoutedEventHandler(ServerList_Loaded);
        }
        public Languages(UserPreferences parentPrefs)
        {
            InitializeComponent();
            lstVariables = App.Current.Resources["TextVariables"] as List<TextVariables>;
            this.Loaded += new RoutedEventHandler(Languages_Loaded);

            myPrefs = parentPrefs;
        }
Esempio n. 7
0
 public MainWindow()
 {
     this.InitializeComponent();
     var userPrefs = new UserPreferences();
     this.Height = userPrefs.WindowHeight;
     this.Width = userPrefs.WindowWidth;
     this.Top = userPrefs.WindowTop;
     this.Left = userPrefs.WindowLeft;
     this.WindowState = userPrefs.WindowState;
 }
Esempio n. 8
0
 public OBDInterface()
 {
     m_commLog = new OBDCommLog();
     m_commLog.Delete();
     setDevice(1);
     m_listAllParameters = new ArrayList();
     m_listSupportedParameters = new ArrayList();
     m_userpreferences = LoadUserPreferences();
     m_settings = LoadCommSettings();
     m_listVehicleProfiles = LoadVehicleProfiles();
 }
 public MainWindowViewModel()
 {
     // Instantiate our item sources.
     Bibles = new ObservableCollection<Bible>();
     Chapters = new ObservableCollection<Chapter>();
     AvailableChapter = new ObservableCollection<Chapter>();
     AvailableVerses = new ObservableCollection<Verse>();
     Videos = new ObservableCollection<Video>();
     var userPrefs = new UserPreferences();
     SetBible(userPrefs.BibileLocation);
     SetVideos("Images");
 }
 public override void Compose(Yupi.Protocol.ISender session, UserPreferences preferences)
 {
     using (ServerMessage message = Pool.GetMessageBuffer(Id))
     {
         message.AppendInteger(preferences.NewnaviX);
         message.AppendInteger(preferences.NewnaviY);
         message.AppendInteger(preferences.NavigatorWidth);
         message.AppendInteger(preferences.NavigatorHeight);
         message.AppendBool(false);
         message.AppendInteger(1);
         session.Send(message);
     }
 }
 protected override void FormatLes(Rooster.Les l, StringBuilder sb, UserPreferences preferences)
 {
     if (sb == null) throw new ArgumentException("You must provide a StringBuilder object!", nameof(sb));
     if (l.HasLokalen && l.HasKlassen)
         sb.Append($"{l.StartTime.ToString(TIMEFORMAT)} - {l.EndTime.ToString(TIMEFORMAT)} {l.Omschrijving} ({l.GetLokalen()} - {l.GetKlassen()})");
     else if (l.HasLokalen || l.HasKlassen)
     {
         var klasOrLokaalDisplay = (!l.HasKlassen ? l.GetLokalen() : l.GetKlassen());
         sb.Append($"{l.StartTime.ToString(TIMEFORMAT)} - {l.EndTime.ToString(TIMEFORMAT)} {l.Omschrijving} ({klasOrLokaalDisplay})");
     }
     else
         sb.Append($"{l.StartTime.ToString(TIMEFORMAT)} - {l.EndTime.ToString(TIMEFORMAT)} {l.Omschrijving}");
 }
Esempio n. 12
0
        private void buttonPrepareCafe_Click(object sender, EventArgs e)
        {
            UserPreferences userPreferences = new UserPreferences();

            userPreferences.NumBadge      = this.textNumBadge.Text;
            userPreferences.TypeBoisson   = this.comboBoxTypeBoisson.SelectedItem.ToString();
            userPreferences.QuantiteSucre = int.Parse(this.labelVolumeSucre.Text);
            userPreferences.UseMug        = this.checkBoxUserMug.Checked;

            this.serviceClient.SetUserPreferences(userPreferences);

            this.pictureBoxCafe.Visible = true;
        }
Esempio n. 13
0
        public static List <Ride> GetRidesByUserPreferences(UserPreferences userPreferences)
        {
            var outputRides = new List <Ride>();

            var userId        = userPreferences.UserId;
            var validGroupIds = GroupData.GetAllGroups().Where(g => g.Members.Select(m => m.Id).Contains(userId)).Select(g => g.Id).ToList();

            var activeRides = Rides.Where(r => r.IsActive);

            var startMatchedRides = new List <Ride>();
            var endMatchedRides   = new List <Ride>();

            foreach (var ride in activeRides)
            {
                if (validGroupIds.Contains(ride.SharedGroupId))
                {
                    if (ride.StartTime >= userPreferences.StartTime.AddMinutes(-userPreferences.MaxDeviationInMinutes) && ride.StartTime <= userPreferences.StartTime.AddMinutes(userPreferences.MaxDeviationInMinutes))
                    {
                        if (ride.ProbabaleEndTime >= userPreferences.EndTime.AddMinutes(-userPreferences.MaxDeviationInMinutes) && ride.ProbabaleEndTime <= userPreferences.EndTime.AddMinutes(userPreferences.MaxDeviationInMinutes))
                        {
                            var userStartLocation = new GeoCoordinate(userPreferences.StartLocation.Latitude, userPreferences.StartLocation.Longitude);
                            var userEndLocation   = new GeoCoordinate(userPreferences.Destination.Latitude, userPreferences.Destination.Longitude);

                            foreach (var waypoint in ride.RideRoute.WayPoints)
                            {
                                var waypointLocation = new GeoCoordinate(waypoint.Latitude, waypoint.Longitude);
                                var dist             = userStartLocation.GetDistanceTo(waypointLocation);
                                if (dist < userPreferences.MaxWalkDistanceInMeters)
                                {
                                    startMatchedRides.Add(ride);
                                    break;
                                }
                            }

                            foreach (var waypoint in ride.RideRoute.WayPoints)
                            {
                                var waypointLocation = new GeoCoordinate(waypoint.Latitude, waypoint.Longitude);
                                if (userEndLocation.GetDistanceTo(waypointLocation) < userPreferences.MaxWalkDistanceInMeters)
                                {
                                    endMatchedRides.Add(ride);
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            outputRides = startMatchedRides.Intersect(endMatchedRides).ToList();
            return(outputRides);
        }
        public bool GetUserPreferences(ref UserPreferences pref, ref string result)
        {
            string query = string.Empty;

            query += "SELECT imviaemail::VARCHAR,visible::VARCHAR,email FROM ";
            query += "usersettings WHERE ";
            query += "useruuid = :Id";

            OSDArray data = new OSDArray();

            try
            {
                using (NpgsqlConnection dbcon = new NpgsqlConnection(ConnectionString))
                {
                    dbcon.Open();
                    using (NpgsqlCommand cmd = new NpgsqlCommand(query, dbcon))
                    {
                        cmd.Parameters.Add(m_database.CreateParameter("Id", pref.UserId));

                        using (NpgsqlDataReader reader = cmd.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                reader.Read();
                                bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
                                bool.TryParse((string)reader["visible"], out pref.Visible);
                                pref.EMail = (string)reader["email"];
                            }
                            else
                            {
                                using (NpgsqlCommand put = new NpgsqlCommand(query, dbcon))
                                {
                                    put.Parameters.Add(m_database.CreateParameter("Id", pref.UserId));
                                    query  = "INSERT INTO usersettings VALUES ";
                                    query += "(:Id,'false','false', '')";

                                    put.ExecuteNonQuery();
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                m_log.Error("[PROFILES_DATA]: GetUserPreferences exception ", e);
                result = e.Message;
            }

            return(true);
        }
Esempio n. 15
0
        static void Main(string[] args)
        {
            //Ejemplo de constructor estático
            //Cuando ejecuto esta línea, se llama sólo al constructor estático y puedo acceder a las propiedades estáticas que éste inicializa
            System.Console.WriteLine("The background color is {0}", UserPreferences.BackgroundColor.Name);

            //Cuando creo una instancia usando el constructor no estático, se invoca ese constructor, y, en caso de que esta sea la primera carga de la clase
            //se llama antes al constructor estático
            UserPreferences ThisUserPreferences = new UserPreferences();

            //En este punto ya las propiedades estáticas están inicializadas
            ThisUserPreferences.PrintColor();


            //En este ejemplo veo que es lo mismo usar la propiedad estática Instance
            //que asignar una variable de tipo adecuado a la propiedad instance. Ambas referencias apuntan al mismo objeto
            System.Console.WriteLine("En la linea que sigue hago una declaración");
            SingletonClass unSingleton;

            System.Console.WriteLine("En la linea que sigue asigno instance a la variable declarada más arriba");
            unSingleton = SingletonClass.Instance;
            System.Console.WriteLine("Hecha la asignación");
            unSingleton.DoSomethingAlready();
            SingletonClass.Instance.DoSomethingAlready();


            //Ahora viene el código para los WeakEvents
            //Uso los mismos nombres que usé antes para poder comparar más fácilmente

            var deAutos = new CarDealer("deAutos.com");
            var carlos  = new Subscriber("Ricky Fort");

            NewCarWeakEventManager.AddListener(deAutos, carlos);
            //Antes era: deAutos.NewCarEvent += carlos.NewCarEventListener;


            //En la sig. línea no se invoca al evento directamente,
            //Se invoca un método que genera el evento. Esto quedó como antes
            deAutos.NewCar("Toyota Celica");

            var roberto = new Subscriber("Roberto Planta");

            NewCarWeakEventManager.AddListener(deAutos, roberto);
            //Antes era: deAutos.NewCarEvent += roberto.NewCarEventListener;
            deAutos.NewCar("Lumina");

            //Ahora quito un suscriptor
            NewCarWeakEventManager.RemoveListener(deAutos, roberto);
            //Antes era: deAutos.NewCarEvent -= roberto.NewCarEventListener;
            deAutos.NewCar("Rolls Royce");
        }
Esempio n. 16
0
        public ActionResult Recent()
        {
            var model = new PageIndexModel();

            model.Recent      = true;
            model.Pages       = Pages.LoadStubs(-1, null, 100);
            model.Permissions = Permissions.Load(User);
            string userID = User.GetUserID();

            model.Pages.ZoneFilter    = UserPreferences.Get <int>(userID, "PageIndexZone");
            model.Pages.PrimaryFilter = UserPreferences.Get <bool>(userID, "PageIndexPrimary");
            model.Pages.MineFilter    = UserPreferences.Get <bool>(userID, "PageIndexMine");
            return(View("Index", model));
        }
Esempio n. 17
0
        /// <summary>
        /// Check for available updates.
        /// </summary>
        private void OnUpdateCheckDoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            var prefs     = UserPreferences.Preferences;
            var lastCheck = DateTime.FromBinary(prefs.LastUpdateCheck);

            if (DateTime.Now.Subtract(lastCheck).TotalMinutes > 15)
            {
                var checker = new UpdateChecker();
                checker.UpdateAvailable += this.Synchronize <PropertyEventArgs <Version> >((s, x) => UpdateAvailable(checker, x.Value));
                checker.Check();
                prefs.LastUpdateCheck = DateTime.Now.ToBinary();
                UserPreferences.SaveNow();
            }
        }
Esempio n. 18
0
        public UserPreferencesPageViewModel(UserPreferencesService userPreferencesService, DatabaseService databaseService)
        {
            _userPreferencesService = userPreferencesService;

            ClearDatabase = new Command(databaseService.DropDatabase);

            SavePreferences = new Command(
                () => { _userPreferencesService.Update(UserPreferences.ToModel()); }
                );

            Task.Run(
                () => { UserPreferences = UserPreferencesViewModel.FromModel(_userPreferencesService.Load()); }
                );
        }
Esempio n. 19
0
        public void VetaExportRequest_FilenameUnSuccessful(
            Guid projectUid, FilterResult filter, string fileName,
            CoordType coordType, OutputTypes outputType, string[] machineNames)
        {
            var userPreferences = new UserPreferences();
            var request         = new  CompactionVetaExportRequest(
                projectUid, filter, fileName,
                coordType, outputType, userPreferences, machineNames, null, null);

            var validate = new ValidFilenameAttribute(256);
            var result   = validate.IsValid(request.FileName);

            Assert.False(result);
        }
Esempio n. 20
0
        public IActionResult GetMyRoomees([FromRoute][Required] int roomId, [FromHeader][Required] string token)
        {
            if (!Authentication.IsTokenValid(token))
            {
                return(Problem("token is not valid"));
            }

            List <int> roomUserIds = new List <int>();
            List <Dictionary <string, string> > roomUserPreferences = new List <Dictionary <string, string> >();

            using (SqlConnection conn = new SqlConnection(Startup.ConnectionString)) {
                conn.Open();

                SqlCommand command = new SqlCommand(@"SELECT * FROM [RoomAssignment] WHERE (RoomId = @roomId) AND (StatusId = @statusId);", conn);
                command.Parameters.AddWithValue("@roomId", roomId);
                command.Parameters.AddWithValue("@statusId", 1);

                using (SqlDataReader reader = command.ExecuteReader()) {
                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            roomUserIds.Add(reader.GetInt32(1));
                        }
                    }
                    else
                    {
                        return(Problem("No roomees found"));
                    }
                }
            }

            foreach (int userId in roomUserIds)
            {
                UserPreferences user = UserPreferences.FromUserId(userId);

                if (user == null)
                {
                    return(Problem("problem fetching roomees"));
                }
                Dictionary <string, string> userAndPrefs = new Dictionary <string, string>();

                userAndPrefs.Add("userId", userId.ToString());
                userAndPrefs.Add("userStatus", UserPreferences.FromUserId(userId).UserStatus);

                roomUserPreferences.Add(userAndPrefs);
            }

            return(Ok(JsonConvert.SerializeObject(roomUserPreferences, Formatting.Indented)));
        }
Esempio n. 21
0
        public override async Task Initialize(bool forceItemSelection)
        {
            PermissionGranted = await permissionsChecker.CalendarPermissionGranted;

            if (!PermissionGranted)
            {
                UserPreferences.SetEnabledCalendars();
            }

            await base.Initialize(forceItemSelection);

            calendarListVisible = PermissionGranted && SelectedCalendarIds.Any();
            calendarListVisibleSubject.OnNext(calendarListVisible);
        }
Esempio n. 22
0
        public void Test_SetAllergeyRestrictions()
        {
            // Arrange
            string          expected = "Nuts";
            BasePreference  BP       = new BasePreference("Japanese", "Sushi", "SitIn");
            UserPreferences UP       = new UserPreferences(BP, "", "None");

            // Act
            UP.AllergyRestriction = "Nuts";
            string actual = UP.AllergyRestriction;

            // Assert
            Assert.AreEqual(expected, actual);
        }
        /// <summary>
        /// Create and return a new <see cref="UserPreferences"/>, configured
        /// with the properties available in this builder instance
        /// </summary>
        /// <returns>
        /// A new <see cref="UserPreferences"/> for use in unit tests
        /// </returns>
        public UserPreferences CreateUserPreferences()
        {
            if (SortOptions == null)
            {
                SortOptions = new List <ISortOption>();
            }

            var preferences = new UserPreferences(
                StoredSettingsRepositoryMock.Object,
                SortOptions,
                UserPreferencesModelRepositoryMock.Object);

            return(preferences);
        }
        public Task <SaveUserPreferencesMessage.Response> SaveUserPreferences(
            string userId,
            UserPreferencesModel userPreferencesModel,
            CancellationToken cancellationToken)
        {
            var userPreferences = new UserPreferences
            {
                EmailNotifications = userPreferencesModel.EmailNotifications,
                PushNotifications  = userPreferencesModel.PushNotifications,
                DependentDepartmentsPendingActions = userPreferencesModel.DependentDepartmentsPendingActions
            };

            return(this.userPreferencesActor.Ask <SaveUserPreferencesMessage.Response>(new SaveUserPreferencesMessage(userId, userPreferences)));
        }
 public TrayViewModel(BestVpnServerConnector connector, EventFacade eventFacade, IUserContext userManager, UserPreferences userPreferences, ExpiredMembershipObserver expiredMembershipObserver, P2PTrafficStatusObserver p2pTrafficStatusObserver, IApplication application, IMessageBoxService messageBoxService)
 {
     this._connector       = connector;
     this._eventFacade     = eventFacade;
     this._userManager     = userManager;
     this._userPreferences = userPreferences;
     p2pTrafficStatusObserver.P2PTrafficRerouted            += new EventHandler(this.OnP2PTrafficRerouted);
     expiredMembershipObserver.ForegroundNotificationNeeded += new EventHandler(this.OnForegroundNotificationNeeded);
     this._application       = application;
     this._messageBoxService = messageBoxService;
     this._application.ForegoundStatusChanged += new EventHandler <DataEventArgs <bool> >(this.OnForegroundStatusChanged);
     this._userManager.add_UserChanged(new EventHandler <UserEventArgs>(this.OnUserChanged));
     this._connector.GeoServerConnectionStatusChanged += new ConnectionEventHandler <GeographicalServer>(this.OnVpnStatusChanged);
 }
Esempio n. 26
0
        public bool GetUserPreferences(ref UserPreferences pref, ref string result)
        {
            const string query = "SELECT imviaemail,visible,email FROM usersettings WHERE useruuid = ?Id";

            try
            {
                using (MySqlConnection dbcon = new MySqlConnection(ConnectionString))
                {
                    dbcon.Open();
                    using (MySqlCommand cmd = new MySqlCommand(query, dbcon))
                    {
                        cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());
                        using (MySqlDataReader reader = cmd.ExecuteReader())
                        {
                            if (reader.HasRows)
                            {
                                reader.Read();
                                bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
                                bool.TryParse((string)reader["visible"], out pref.Visible);
                                pref.EMail = (string)reader["email"];
                            }
                            else
                            {
                                dbcon.Close();
                                dbcon.Open();

                                const string queryB = "INSERT INTO usersettings VALUES (?uuid,'false','false', ?Email)";

                                using (MySqlCommand put = new MySqlCommand(queryB, dbcon))
                                {
                                    put.Parameters.AddWithValue("?Email", pref.EMail);
                                    put.Parameters.AddWithValue("?uuid", pref.UserId.ToString());

                                    put.ExecuteNonQuery();
                                }
                            }
                        }
                    }
                    dbcon.Close();
                }
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("[PROFILES_DATA]" +
                                  ": Get preferences exception {0}", e.Message);
                result = e.Message;
                return(false);
            }
            return(true);
        }
 public ServerSidePanelViewModel(VpnConnector vpnConnector, BestUserServerProvider bestServerProvider, VpnConnectionSpeedTracker speedTracker, UserPreferences userPreferences, IUserContext userContext, EventFacade eventFacade)
 {
     this._vpnConnector       = vpnConnector;
     this._bestServerProvider = bestServerProvider;
     this._userPreferences    = userPreferences;
     this._userContext        = userContext;
     this._eventFacade        = eventFacade;
     this._bestServerProvider.add_ServersChanged(new EventHandler(this.OnServersChanged));
     this._vpnConnector.GeoServerConnectionStatusChanged += new ConnectionEventHandler <GeographicalServer>(this.OnServerConnectionStatusChanged);
     this._userPreferences.add_DistanceUnitsChanged(new EventHandler <DistanceUnitsChangedEventArgs>(this.OnDistanceUnitsChanged));
     this._userContext.add_UserChanged(new EventHandler <UserEventArgs>(this.OnUserChanged));
     this._userContext.add_FavouritesChanged(new EventHandler <FavouriteServersChangedEventArgs>(this.OnFavouritesChanged));
     speedTracker.SpeedChanged = (EventHandler <VpnConnectionSpeedChangeEventArgs>)Delegate.Combine(speedTracker.SpeedChanged, new EventHandler <VpnConnectionSpeedChangeEventArgs>(this.OnVpnSpeedChanged));
 }
Esempio n. 28
0
        public void ShouldGetCustomSettingAsync()
        {
            // Arrange
            ICustomSettingsApi settingsApi = CreateSettingsApi();

            // Act
            UserPreferences setting = settingsApi.GetCustomSettingAsync <UserPreferences>("preferences").Result;

            // Assert
            setting.flag.ShouldBe(true);
            setting.array.Length.ShouldBe(3);
            setting.entity.rank.ShouldBe(4);
            setting.entity.role.ShouldBe("user");
        }
Esempio n. 29
0
        public bool GetUserPreferences(ref UserPreferences pref, ref string result)
        {
            IDataReader reader = null;
            string      query  = string.Empty;

            query += "SELECT imviaemail,visible,email FROM ";
            query += "usersettings WHERE ";
            query += "useruuid = :Id";

            OSDArray data = new OSDArray();

            try
            {
                using (SqliteCommand cmd = (SqliteCommand)m_connection.CreateCommand())
                {
                    cmd.CommandText = query;
                    cmd.Parameters.AddWithValue("?Id", pref.UserId.ToString());

                    using (reader = cmd.ExecuteReader(CommandBehavior.SingleRow))
                    {
                        if (reader.Read())
                        {
                            bool.TryParse((string)reader["imviaemail"], out pref.IMViaEmail);
                            bool.TryParse((string)reader["visible"], out pref.Visible);
                            pref.EMail = (string)reader["email"];
                        }
                        else
                        {
                            query  = "INSERT INTO usersettings VALUES ";
                            query += "(:Id,'false','false', :Email)";

                            using (SqliteCommand put = (SqliteCommand)m_connection.CreateCommand())
                            {
                                put.Parameters.AddWithValue(":Id", pref.UserId.ToString());
                                put.Parameters.AddWithValue(":Email", pref.EMail);
                                put.ExecuteNonQuery();
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                m_log.DebugFormat("[PROFILES_DATA]" +
                                  ": Get preferences exception {0}", e.Message);
                result = e.Message;
                return(false);
            }
            return(true);
        }
Esempio n. 30
0
        public void Test_SetDietaryRestrictions()
        {
            // Arrange
            string          expected = "Kosher";
            BasePreference  BP       = new BasePreference("American", "Roast Pork", "SitIn");
            UserPreferences UP       = new UserPreferences(BP, "None", "");

            // Act
            UP.DietRestriction = "Kosher";
            string actual = UP.DietRestriction;

            // Assert
            Assert.AreEqual(expected, actual);
        }
        public IActionResult CheckUserPrefs()
        {
            string id = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            try
            {
                _context.UserPreferences.Where(x => x.CurrentUserId == id).First();
            }
            catch
            {
                return(RedirectToAction("UserPreferences", "User"));
            }

            UserPreferences prefFound = _context.UserPreferences.Where(x => x.CurrentUserId == id).First();


            if (prefFound != null && DateTime.Now <= prefFound.StartYear && prefFound.EndYear > prefFound.StartYear)
            {
                //get the number of items in the users bucketlist
                int count = _context.UserParks.Where(x => x.CurrentUserId == id).Where(y => y.ParkVisited == false).Count();
                List <UserParks> userParks = _context.UserParks.Where(x => x.CurrentUserId == id).Where(y => y.ParkVisited == false).ToList();

                //Create a list of dateTimes to assign to parks bucket list based on start and end year entered by user
                int daysApart = (prefFound.EndYear - prefFound.StartYear).Days;
                /*List<DateTime>*/
                var             dates     = CreateDatetimes(prefFound.StartYear, prefFound.EndYear, 14);
                List <DateTime> dateTimes = CreateDatetimes(prefFound.StartYear, prefFound.EndYear, 14);

                if (EnoughDates(dates.Count, count) == true)
                {
                    ParksSummaryWithUserPrefs newSummary = new ParksSummaryWithUserPrefs();
                    newSummary.listOfDateTimes = dateTimes;
                    newSummary.preferences     = prefFound;
                    newSummary.bucketListCount = count;
                    newSummary.bucketedParks   = userParks;
                    return(View("UserParkVisitSummary", newSummary));
                }
                else
                {
                    ViewBag.deleteSomeParks = $"Please delete {count - dates.Count} from your bucket list to meet this goal, or Click the link to Update Your Park Visiting Preferences:";
                    return(RedirectToAction("DisplayBucketList", "ParksDb"));
                }
            }

            else
            {
                TempData["usersPreferences"] = prefFound;
                return(RedirectToAction("UserPreferences", "User"));
            }
        }
Esempio n. 32
0
        protected virtual void _(Events.RowSelected <UserPreferences> e)
        {
            if (e.Row == null)
            {
                return;
            }

            UserPreferences userPreferencesRow = e.Row as UserPreferences;
            PXCache         cache = e.Cache;

            FSxUserPreferences fsxUserPreferencesRow = cache.GetExtension <FSxUserPreferences>(userPreferencesRow);

            EnableDisableLocationTracking(cache, userPreferencesRow, fsxUserPreferencesRow);
        }
Esempio n. 33
0
        public async override Task Initialize()
        {
            PermissionGranted = await permissionsService.CalendarPermissionGranted;

            if (!PermissionGranted)
            {
                UserPreferences.SetEnabledCalendars();
            }

            await base.Initialize();

            calendarListVisible = PermissionGranted && SelectedCalendarIds.Any();
            calendarListVisibleSubject.OnNext(calendarListVisible);
        }
Esempio n. 34
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Request.IsAuthenticated)
        {
            presentation.Visible        = false;
            AuthenticationError.Visible = true;
        }
        else
        {
            UserPreferences userPreferences = new UserPreferences();
            if (userPreferences.getUsersVakType(User.Identity.Name) == "Visual")  ///check his VAKType
            {
                Response.Redirect("~/VisualPresentation.aspx");
            }
            else if (userPreferences.getUsersVakType(User.Identity.Name) == "Auditory")
            {
                Response.Redirect("~/AuditoryPresentation.aspx");
            }
            else if (userPreferences.getUsersVakType(User.Identity.Name) == "Kinesthetic")
            {
                //Response.Redirect("~/KinestheticPresentation.aspx");
                //String videocode1 = "<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/TnH6Ust1zuI?autoplay=1\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>";

                //Live youtube video! If it doesn't work, live link might have changed.
                String videocode1 = "<iframe width=\"400\" height=\"100\" src=\"https://www.youtube.com/embed/hHW1oY26kxQ?autoplay=1\" frameborder=\"0\" allow=\"accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>";
                VideoLiteral.Text = videocode1;

                if (!Page.IsPostBack)
                {
                    //populate notes
                    SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString);
                    con.Open();
                    SqlCommand cmd = con.CreateCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "SELECT * FROM KinestheticNotes WHERE UserName=@username";
                    cmd.Parameters.Add("@username", SqlDbType.NVarChar, 256).Value = User.Identity.Name;
                    cmd.Prepare();
                    SqlDataReader rd = cmd.ExecuteReader();
                    if (rd.HasRows)
                    {
                        rd.Read();
                        Notes.Text = rd[2].ToString();
                        rd.Close();
                        con.Close();
                    }
                }
            }
        }
    }
 public Bitmap GetImageForRooster(Rooster rooster, UserPreferences preferences)
 { 
     var daysAndHours = GetAmountOfDaysAndHours(rooster, preferences);
     daysAndHours.FirstDateTime = daysAndHours.FirstDateTime.AddHours(-daysAndHours.FirstDateTime.Hour).AddMinutes(-daysAndHours.FirstDateTime.Minute);
     if (daysAndHours == null) //geen resultaten
         return null;
     var days = daysAndHours.CountDays;
     var hours = daysAndHours.CountHours;
     var bitmap = new Bitmap(days * DAYWIDTH + HEADERSIZE, hours * HOURHEIGHT + HEADERSIZE);
     using(var g = Graphics.FromImage(bitmap))
     {
         g.FillRectangle(Brushes.White, 0, 0, bitmap.Width, bitmap.Height);
         var orangePen = Pens.DarkOrange;
         //var unEvenBackground = Brushes.LightGray;
         for (var i = 0; i < hours; i++)
         {
             if(i % 2 == 0)
                 g.FillRectangle(Brushes.LightGray, 0, HEADERSIZE + i * HOURHEIGHT, bitmap.Width, HOURHEIGHT);
             int offset = HEADERSIZE + i * HOURHEIGHT;
             g.DrawLine(orangePen, 0, offset, bitmap.Width, offset);
             g.DrawString($"{daysAndHours.FirstHour + i}:00{Environment.NewLine}-{Environment.NewLine}{daysAndHours.FirstHour + i + 1}:00", FONT, Brushes.Black, new RectangleF(0, HEADERSIZE + i * HOURHEIGHT, HEADERSIZE, HOURHEIGHT), FORMAT);
         }
         for (var i = 0; i < days; i++)
         {
             int offset = HEADERSIZE + i * DAYWIDTH;
             g.DrawLine(orangePen, offset, 0, offset, bitmap.Height);
             g.DrawString(daysAndHours.FirstDateTime.AddDays(i).ToString("ddd d MMM"), FONT, Brushes.Black, new RectangleF(HEADERSIZE + i * DAYWIDTH, 0, DAYWIDTH, HEADERSIZE), FORMAT);
         }
         StringBuilder sb = new StringBuilder();
         foreach(var les in rooster.Lessen)
         {
             if (!preferences.IsLesIgnored(les))
             {
                 var roosterRectangle = new Rectangle(
                     x: (HEADERSIZE + (les.StartTime - daysAndHours.FirstDateTime).Days * DAYWIDTH) + ROOSTERPADDING / 2,
                     y: HEADERSIZE + (les.StartTime.Hour - daysAndHours.FirstHour) * HOURHEIGHT + (les.StartTime.Minute * HOURHEIGHT / 60) + ROOSTERPADDING / 2,
                     width: DAYWIDTH - ROOSTERPADDING,
                     height: (les.EndTime - les.StartTime).Hours * HOURHEIGHT - ROOSTERPADDING
                 );
                 g.FillRectangle(Brushes.Orange, roosterRectangle);
                 g.DrawRectangle(orangePen, roosterRectangle);
                 sb.Clear();
                 GetLesContents(les, sb);
                 g.DrawString(sb.ToString(), FONT, Brushes.Black, new RectangleF(roosterRectangle.X, roosterRectangle.Y, roosterRectangle.Width, roosterRectangle.Height), FORMAT);
             }
         }
     }
     return bitmap;
 }
    protected void btnsave_Click(object sender, EventArgs e)
    {//Logging Start
        string id = string.Format("Id: {0} Uri: {1}", Guid.NewGuid(), HttpContext.Current.Request.Url);

        using (Utils utility = new Utils())
        {
            utility.MethodStart(id, System.Reflection.MethodBase.GetCurrentMethod());
        }

        try
        {
            string load = "";
            if (rbt1.Checked)
            {
                load = "VISITS=ALL";
            }
            else if (rbt2.Checked)
            {
                load = "VISITS=MINIMUM_DATE";
            }


            //load = load + ",SHOW_ONLY_LAST="+ ddl_list.SelectedItem.Value.ToString();
            string userid    = ((Bill_Sys_UserObject)Session["USER_OBJECT"]).SZ_USER_ID;
            string companyid = ((Bill_Sys_BillingCompanyObject)Session["BILLING_COMPANY_OBJECT"]).SZ_COMPANY_ID;
            string pagename  = "UnbilledVisits";

            UserPreferences obj = new UserPreferences();
            obj.save_Delivery_report(pagename, userid, companyid, load);
            lblMessage.Visible = true;
            lblMessage.Text    = "Your preferences were changed successfully";
        }
        catch (Exception ex)
        {
            Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            using (Utils utility = new Utils())
            {
                utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
            }
            string str2 = "Error Request=" + id + ".Please share with Technical support.";
            base.Response.Redirect("../Bill_Sys_ErrorPage.aspx?ErrMsg=" + str2);
        }
        //Method End

        using (Utils utility = new Utils())
        {
            utility.MethodEnd(id, System.Reflection.MethodBase.GetCurrentMethod());
        }
    }
        public IActionResult UserPreferences()
        {
            string id = User.FindFirst(ClaimTypes.NameIdentifier).Value;

            try
            {
                UserPreferences prefFound = _context.UserPreferences.Where(x => x.CurrentUserId == id).First();
                return(RedirectToAction("UseCurrentPreferences"));
            }
            catch
            {
                ViewBag.messageforPrefs = "PLEASE ENTER YOUR VISITING PREFERENCES BELOW:";
                return(View("UserPreferences"));
            }
        }
Esempio n. 38
0
 private void SetSharedPrefs()
 {
     if (rememberPass.Checked)
     {
         UserPreferences.SetString("MySharedPrefs", "rememberPass", "true");
         UserPreferences.SetString("MySharedPrefs", "userName", userName.Text);
         UserPreferences.SetString("MySharedPrefs", "password", password.Text);
     }
     else
     {
         UserPreferences.DeleteString("MySharedPrefs", "rememberPass");
         UserPreferences.DeleteString("MySharedPrefs", "userName");
         UserPreferences.DeleteString("MySharedPrefs", "password");
     }
 }
Esempio n. 39
0
 public UserPreferences LoadUserPreferences()
 {
     try
     {
         XmlSerializer serializer = new XmlSerializer(typeof(UserPreferences));
         FileStream    file       = new FileStream("preferences.dat", FileMode.Open);
         m_userpreferences = (UserPreferences)serializer.Deserialize((Stream)file);
         file.Close();
     }
     catch
     {
         m_userpreferences = new UserPreferences();
     }
     return(m_userpreferences);
 }
        public OperationResultVo <UserPreferencesViewModel> GetById(Guid currentUserId, Guid id)
        {
            try
            {
                UserPreferences model = userPreferencesDomainService.GetById(id);

                UserPreferencesViewModel vm = mapper.Map <UserPreferencesViewModel>(model);

                return(new OperationResultVo <UserPreferencesViewModel>(vm));
            }
            catch (Exception ex)
            {
                return(new OperationResultVo <UserPreferencesViewModel>(ex.Message));
            }
        }
 public BalloonSettingsViewModel(
     IEventAggregator events,
     Func <HearthStatsDbContext> dbContext,
     UserPreferences userPreferences,
     BalloonSettings balloonSettings, IDeckManager deckManager)
 {
     this.events          = events;
     this.dbContext       = dbContext;
     this.userPreferences = userPreferences;
     this.balloonSettings = balloonSettings;
     this.deckManager     = deckManager;
     this.DisplayName     = "Tray icon settings:";
     this.Order           = 1;
     events.Subscribe(this);
 }
 protected virtual void FormatLes(Rooster.Les l, StringBuilder sb, UserPreferences preferences)
 {
     if (sb == null) throw new ArgumentException("You must provide a StringBuilder object!", nameof(sb));
     if(l.HasLokalen && l.HasDocenten)
     {
         string docentDisplay = preferences.ShowFullDocentNamen ? l.GetDocentenByNaam() : l.GetDocentenByCode();
         sb.Append($"{l.StartTime.ToString(TIMEFORMAT)} - {l.EndTime.ToString(TIMEFORMAT)} {l.Omschrijving} ({l.GetLokalen()} - {docentDisplay})");
     }
     else if (l.HasLokalen || l.HasDocenten)
     {
         string lokaalOrDocentDisplay = (!l.HasDocenten ? (l.GetLokalen()) : preferences.ShowFullDocentNamen ? l.GetDocentenByNaam() : l.GetDocentenByCode());
         sb.Append($"{l.StartTime.ToString(TIMEFORMAT)} - {l.EndTime.ToString(TIMEFORMAT)} {l.Omschrijving} ({lokaalOrDocentDisplay})");
     }
     else
         sb.Append($"{l.StartTime.ToString(TIMEFORMAT)} - {l.EndTime.ToString(TIMEFORMAT)} {l.Omschrijving}");
 }
Esempio n. 43
0
        public async Task SetUserPreferencesAsync(UserPreferences prefs)
        {
            UserPreferences current = await GetUserPreferencesAsync();

            if (current == null)
            {                
                await database.InsertAsync(prefs);
            }
            else
            {
                String query = "update UserPreferences set UserID='" + prefs.UserID + "' ";
                query += ", AccessToken='" + prefs.AccessToken + "' ";
                query += ", ProviderName='" + prefs.ProviderName + "' ";
                query += ", ProviderUri='" + prefs.ProviderUri + "' ";
                query += ", ConversationLimit='" + prefs.ConversationLimit + "' ";
                query += ", ActiveCategories='" + prefs.ActiveCategories + "'";                                    
                await database.QueryAsync<UserPreferences>(query);
            }        
        }
Esempio n. 44
0
 public OBD2Interface()
 {
     m_obd2Comm = new OBD2Comm();
     m_commLog = new CommLog();
     m_obd2Comm.OnReceived += new OBD2Comm.__Delegate_OnReceived(On_OBD2_Received);
     m_userpreferences = LoadUserPreferences();
     m_settings = LoadCommSettings();
     m_listVehicleProfiles = LoadVehicleProfiles();
     m_strElmTimeout = OBD2.Int2HexString(GetActiveProfile().ElmTimeout / 4);
     m_arrayListPID = new ArrayList();
     m_arrayListDTC = new ArrayList();
     bool[] flagArray1 = new bool[256];
     flagArray1.Initialize();
     m_bService01PIDSupport = flagArray1;
     int index1 = 0;
     do
     {
         m_bService01PIDSupport[index1] = false;
         ++index1;
     }
     while (index1 < 256);
     bool[] flagArray2 = new bool[256];
     flagArray2.Initialize();
     m_bService02PIDSupport = flagArray2;
     int index2 = 0;
     do
     {
         m_bService02PIDSupport[index2] = false;
         ++index2;
     }
     while (index2 < 256);
     bool[] flagArray3 = new bool[8];
     flagArray3.Initialize();
     m_bO2Locations = flagArray3;
     int index3 = 0;
     do
     {
         m_bO2Locations[index3] = false;
         ++index3;
     }
     while (index3 < 8);
 }
Esempio n. 45
0
        public Main()
        {
            InitializeComponent();
            var userPrefs = new UserPreferences();
            GridLengthConverter myGridLengthConverter = new GridLengthConverter();
            GridLength gl1 = (GridLength)myGridLengthConverter.ConvertFromString(userPrefs.WindowLeftColumn.ToString());
            this.columnLeft.Width = gl1;

            gl1 = (GridLength)myGridLengthConverter.ConvertFromString(userPrefs.WindowRightColumn.ToString());
            this.columnRight.Width = gl1;

            this.F1.AddHandler(Favorites.TargetSetClick, new RoutedEventHandler(this.TargetSetClickHandler));
            this.F1.AddHandler(Favorites.FavoriteClick, new RoutedEventHandler(this.FavoriteClickEventHandler));
            this.T1.AddHandler(TreeExplorer.PopulateEverything, new RoutedEventHandler(this.PopulateEverythingHandler));
            this.T1.AddHandler(TreeExplorer.TargetDoubleClick, new RoutedEventHandler(this.TargetDoubleClickHandler));
            this.T1.AddHandler(TreeExplorer.TargetClick, new RoutedEventHandler(this.TargetClickHandler));
            this.T1.AddHandler(TreeExplorer.StartExplore, new RoutedEventHandler(this.StartExploreHandler));
            this.T1.AddHandler(TreeExplorer.FinishedExplore, new RoutedEventHandler(this.FinishedExploreHandler));
            this.T1.AddHandler(TreeExplorer.FailedExplore, new RoutedEventHandler(this.FailedExploreHandler));
        }
 public string FormatRooster(Rooster rooster, UserPreferences preferences)
 {
     StringBuilder sb = new StringBuilder();
     DateTime prevDate = new DateTime();
     bool first = true;
     foreach (Rooster.Les l in rooster.Lessen)
     {
         if (preferences.IsLesIgnored(l)) continue;
         if (l.StartTime.DayOfYear != prevDate.DayOfYear)
         {
             if (!first)
                 sb.AppendLine();
             else
                 first = false;
             sb.AppendLine(l.StartTime.ToString("dddd d MMMM"));
             prevDate = l.StartTime;
         }
         FormatLes(l, sb, preferences);
         sb.AppendLine();
     }
     return sb.ToString();
 }
        public ClientLauncher(UserPreferences myUserPreferences)
        {
            InitializeComponent();

            _ServerInfo = myUserPreferences.DefaultServerInformation;
            theUserPreferences = myUserPreferences;

            //does this exe even exist yet?
            if (!File.Exists(SWGANHPAth + _ServerInfo.SafeFolderName + "\\swganh.exe"))
            {
                PatchProgress myPatchProgress = new PatchProgress(_ServerInfo, myUserPreferences);
                myPatchProgress.Loaded += new RoutedEventHandler(myPatchProgress_Loaded);
                myPatchProgress.OnError += new EventHandler<ErrorMessageEventArgs>(myPatchProgress_OnError);
                myPatchProgress.PatchComplete += new EventHandler<Patcher.PatchFunctionCompleteEventArgs>(myPatchProgress_PatchComplete);
                grdRightPanel.Children.Clear();
                grdRightPanel.Children.Add(myPatchProgress);
                btnLaunchClient.IsEnabled = false;

            }
            else
            {
                //read the first article
                RefreshNewsDelegate del = new RefreshNewsDelegate(RefreshNewsAsych);

                AsyncCallback callback = new AsyncCallback(XMLHasFinished);
                del.BeginInvoke(_ServerInfo.RSSFeedUrl, callback, null);
            }

            lblServerName.Text = _ServerInfo.ServerName;
            lblServerBuild.Text = "999";
            lblServerPopulation.Text = _ServerInfo.Population.ToString();

            //do we have any credentials for this server?
            if (myUserPreferences.ServerCredentials.Any(sc => sc.ServerId == _ServerInfo.ServerId))
            {
                cboUsername.ItemsSource = myUserPreferences.ServerCredentials.Where(sc => sc.ServerId == _ServerInfo.ServerId);
                cboUsername.SelectedIndex = 0;
            }
        }
 protected DaysAndHoursForRooster GetAmountOfDaysAndHours(Rooster rooster, UserPreferences preferences)
 {
     DaysAndHoursForRooster result = null;
     foreach(var les in rooster.Lessen)
     {
         if (!preferences.IsLesIgnored(les))
         {
             if (result == null) result = new DaysAndHoursForRooster();
             var day = GetDayOfYearWithYear(les.StartTime);
             if (day < result.FirstDay)
             {
                 result.FirstDay = day;
                 result.FirstDateTime = les.StartTime;
             }
             if (day > result.LastDay)
                 result.LastDay = day;
             if (les.StartTime.Hour < result.FirstHour)
                 result.FirstHour = les.StartTime.Hour;
             if (les.EndTime.Hour > result.LastHour)
                 result.LastHour = les.EndTime.Hour;
         }
     }
     return result;
 }
 public string FormatLes(Rooster.Les l, UserPreferences preferences)
 {
     StringBuilder sb = new StringBuilder();
     FormatLes(l, sb, preferences);
     return sb.ToString();
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        Session["EmailImgText"] = "none";
        Session["ProfileEdit"] = "false";

        // Get the profile ID from the query string
        _personId = GetPersonFromQueryString();

        if (!IsPostBack)
        {
            if (_personId > 0)
            {

                personProfileList = new Connects.Profiles.Service.ServiceImplementation.ProfileService().GetPersonFromPersonId(_personId);

                personProfile = personProfileList.Person[0];

                if (personProfile != null)
                {
                    // check to see if profile is hidden
                    _isVisibleProfile = personProfile.Visible;

                    this.EditUserId = Profile.UserId;

                    // Handle situation where it's the logged-in user viewing their own page
                    ProcessSelfProxyAndHidden();

                    //Save Search History
                    if (Profile.UserId != 0)
                        SaveUserSearchHistory(_personId);

                    hypBack.NavigateUrl = (string)Session["BackPage"];
                    if ((string)Request["From"] == "SE")
                    {
                        hypBack.Visible = true;
                    }

                    // Set the page titles
                    Page.Title = personProfile.Name.FirstName + " " + personProfile.Name.LastName + " | " + Page.Title;
                    ltProfileName.Text = personProfile.Name.FullName;

                    // Profiles OpenSocial Extension by UCSF
                    OpenSocialHelper os = SetOpenSocialHelper(Profile.UserId, _personId, Page);
                    os.SetPubsubData(OpenSocialHelper.JSON_PERSONID_CHANNEL, OpenSocialHelper.BuildJSONPersonIds(_personId, personProfile.Name.FullName));
                    // PMID
                    UserPreferences userPreference = new UserPreferences();
                    userPreference = _userBL.GetUserPreferences(_personId);
                    if (userPreference.Publications.Equals("Y"))
                    {
                        os.SetPubsubData(OpenSocialHelper.JSON_PMID_CHANNEL, OpenSocialHelper.BuildJSONPubMedIds(personProfile));
                    }
                    os.RemovePubsubGadgetsWithoutData();
                    GenerateOpensocialJavascipt();
                    pnlOpenSocialGadgets.Visible = OpenSocial().IsVisible();

                    // record that their profile was viewed
                    OpenSocialHelper.PostActivity(_personId, "profile was viewed");
                }

            }
        }

        InitializeUserControlEvents();
    }
    private void ReadOnlySection(int personId)
    {
        try
        {

            #region Basic Information

                ucProfileBaseInfo.PersonId = _personId;

            #endregion

            #region Awards&Honors

            //RptrReadAwardsHonors.DataSource = _userBL.GetUserAwardsHonors(personId);

            RptrReadAwardsHonors.DataSource = personProfile.AwardList.Award;
            RptrReadAwardsHonors.DataBind();

            if (RptrReadAwardsHonors.Items.Count.Equals(0))
            {
                pnlReadoOnlyAwardsHonors.Visible = false;
            }
            #endregion

            #region Narrative

            lblReadOnlyNarrative.Text = Server.HtmlEncode(_userBL.GetUserNarratives(personId)).Replace("\n", "<br />");
            if (lblReadOnlyNarrative.Text.Length == 0)
            {
                pnlReadOnlyNarrative.Visible = false;
            }

            #endregion

            #region Publications

            if (personProfile.PublicationList != null)
            {
                rptPublications.DataSource = personProfile.PublicationList;
                rptPublications.DataBind();

                if (rptPublications.Items.Count.Equals(0))
                {
                    pnlReadOnlyPublications.Visible = false;
                }
            }

            #endregion

            #region Prepare to display ProfileUser

            UserPreferences userPreference = new UserPreferences();
            userPreference = _userBL.GetUserPreferences(personId);
            //IF "Y" then Show
            //IF "N" then Hide
            #region Hide/Show Photo

            if (userPreference.Photo.Equals("Y"))
            {
                imgReadPhoto.ImageUrl = _userBL.GetUserPhotoURL(personId);
            }
            else
            {
                //Hide Photo
                imgReadPhoto.Visible = false;
            }

            #endregion

            #region Hide/Show Awards & Honors

            if (userPreference.AwardsHonors.Equals("N"))
            {
                pnlReadoOnlyAwardsHonors.Visible = false;
            }

            #endregion

            #region Hide/Show Narrative

            if (userPreference.Narrative.Equals("N"))
            {
                pnlReadOnlyNarrative.Visible = false;
            }
            #endregion

            #region Hide/Show Publications

            if (userPreference.Publications.Equals("N"))
            {
                pnlReadOnlyPublications.Visible = false;
            }

            #endregion

            #endregion

            #region Right Side Controls

            ProfileRightSide1.ProfileId = _personId;

            #endregion

            this.txtProfileProblem.Text = _userBL.GetProfileSupportHtml(_personId, true);

        }
        catch (Exception Ex)
        {
            throw (Ex);
        }
    }
Esempio n. 52
0
 public PackagedUserProfile(string language)
 {
     this.language = language;
     userProblems = new LiteracyProfile(language);
     preferences = new UserPreferences();
 }
    private void GetUserPreferences(int personId)
    {
        try
        {
            UserPreferences userPreference = new UserPreferences();
            userPreference = _userBL.GetUserPreferences(personId);

            //If the user does not have a profile, then they need to be redirected back to the search screen.
            if (!userPreference.ProfileExists)
            {
                Response.Redirect("~/Search.aspx");
            }

            //IF "Y" then Show
            //IF "N" then Hide
            #region Hide/Show Photo
            if (userPreference.Photo.Equals("N"))
            {
                btnHidePhoto.Visible = false;
                lblHidePhoto.Visible = true;
                btnShowPhoto.Visible = true;
                lblShowPhoto.Visible = false;
                lblHiddenPhoto.Visible = true;
                lblVisiblePhoto.Visible = false;
            }
            else if (userPreference.Photo.Equals("Y"))
            {
                btnShowPhoto.Visible = false;
                lblShowPhoto.Visible = true;
                btnHidePhoto.Visible = true;
                lblHidePhoto.Visible = false;
                lblHiddenPhoto.Visible = false;
                lblVisiblePhoto.Visible = true;
            }
            #endregion

            #region Hide/Show Awards & Honors
            if (userPreference.AwardsHonors.Equals("N"))
            {
                btnHideAwards.Visible = false;
                lblHideAwards.Visible = true;
                btnShowAwards.Visible = true;
                lblShowAwards.Visible = false;
                lblHiddenAward.Visible = true;
                lblVisibleAward.Visible = false;
            }
            else if (userPreference.AwardsHonors.Equals("Y"))
            {
                btnShowAwards.Visible = false;
                lblShowAwards.Visible = true;
                btnHideAwards.Visible = true;
                lblHideAwards.Visible = false;
                lblHiddenAward.Visible = false;
                lblVisibleAward.Visible = true;
            }
            #endregion

            #region Hide/Show Narrative
            if (userPreference.Narrative.Equals("N"))
            {
                btnHideNarrative.Visible = false;
                lblHideNarrative.Visible = true;
                btnShowNarrative.Visible = true;
                lblShowNarrative.Visible = false;
                lblHiddenNarrative.Visible = true;
                lblVisibleNarrative.Visible = false;
            }
            else if (userPreference.Narrative.Equals("Y"))
            {
                btnShowNarrative.Visible = false;
                lblShowNarrative.Visible = true;
                btnHideNarrative.Visible = true;
                lblHideNarrative.Visible = false;
                lblHiddenNarrative.Visible = false;
                lblVisibleNarrative.Visible = true;
            }
            #endregion

            #region Hide/Show Publications
            if (userPreference.Publications.Equals("N"))
            {
                btnHidePublication.Visible = false;
                lblHidePublication.Visible = true;
                btnShowPublication.Visible = true;
                lblShowPublication.Visible = false;
                lblHiddenPublication.Visible = true;
                lblVisiblePublication.Visible = false;
            }
            else if (userPreference.Publications.Equals("Y"))
            {
                btnShowPublication.Visible = false;
                lblShowPublication.Visible = true;
                btnHidePublication.Visible = true;
                lblHidePublication.Visible = false;
                lblHiddenPublication.Visible = false;
                lblVisiblePublication.Visible = true;
            }
            #endregion

        }
        catch (Exception Ex)
        {
            throw (Ex);
        }
    }
Esempio n. 54
0
 void Awake()
 {
     instance = this;
 }
Esempio n. 55
0
 void OnDestroy()
 {
     instance = null;
 }
Esempio n. 56
0
 public PackagedUserProfile(LiteracyProfile u, UserPreferences p, LanguageCode l)
 {
     userProblems = u; preferences = p; language = l.ToString();
 }
Esempio n. 57
0
 private void UserDisplay(User u, UserPreferences preferences, StringBuilder sb, int i)
 {
     if (i > 1)
         for (var j = 0; j < 2; j++)
             sb.AppendLine();
     sb.Append($"{i}) {u.First_Name ?? string.Empty} {u.Last_Name ?? string.Empty}");
     if (u.Username != null)
         sb.Append($" (@{u.Username})");
     sb.AppendLine();
     if (preferences.LastUpdate.Ticks == 0)
         sb.Append("Last seen: Unknown");
     else
     {
         var date = DateTime.Now - preferences.LastUpdate ;
         sb.Append($"Last seen: {date.Days}d{date.Hours}h{date.Minutes}m{date.Seconds}s");
     }
 }
 public PatchProgress(ServerInfo siServerInfo, UserPreferences theUserPrefernces)
 {
     InitializeComponent();
     theServerInfo = siServerInfo;
     myUserPreferences = theUserPrefernces;
 }
Esempio n. 59
0
 public UserPreferencesForm(UserPreferences prefs)
 {
     InitializeComponent();
     m_userpreferences = prefs;
 }
Esempio n. 60
0
 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     var userPrefs = new UserPreferences
                     {
                         WindowHeight = this.ActualHeight,
                         WindowWidth = this.ActualWidth,
                         WindowTop = this.Top,
                         WindowLeft = this.Left,
                         WindowState = this.WindowState,
                         WindowLeftColumn = Convert.ToDouble(this.Explorer.columnLeft.Width.ToString()),
                         WindowRightColumn =
                             Convert.ToDouble(this.Explorer.columnRight.Width.ToString())
                     };
     userPrefs.Save();
 }