/// <summary> /// Method of getting data from SQL. /// Called from the method RedisOrSQLStorage. /// </summary> /// <param name="queryUserStorage">Query our request.</param> /// <param name="db">Connecting with Redis.</param> /// <param name="redisIsStarted">The flag to check launched Redis.</param> /// <param name="logging">Logging class object to create the log.</param> /// <param name="view">View class object to display the changes.</param> /// <param name="textboxs">An array of text fields to fill.</param> private static void GetDataFromSQL(IEnumerable<User> queryUserStorage, IDatabase db, bool redisIsStarted, Logging logging, View.View view, System.Windows.Controls.TextBox[] textboxs) { var user = queryUserStorage.ToList(); // Filling fields from SQL. view.ChangeTextIntoTextBox(textboxs, user[0]); // Caching in Redis. if (redisIsStarted) RedisSetData(db, user, logging); }
/// <summary> /// Method of getting data from Redis. /// Called from the method RedisOrSQLStorage. /// </summary> /// <param name="value">JSON-string.</param> /// <param name="view">View class object to display the changes.</param> /// <param name="textboxs">An array of text fields to fill.</param> private static void GetDataFromRedis(string value, View.View view, System.Windows.Controls.TextBox[] textboxs) { // Convert Json. value = value.Substring(value.IndexOf("[", StringComparison.Ordinal) + 1); value = value.Substring(0, value.LastIndexOf("]", StringComparison.Ordinal)); // Deserializing JSON-string. var u = JsonConvert.DeserializeObject<User>(value); // Filling in the fields of Redis. view.ChangeTextIntoTextBox(textboxs, u); }