/// <summary> /// The connection method to Storage4 (modal). /// Called from an event handler lstFriends_MouseDoubleClick. /// </summary> /// <param name="context">The context of the interaction with the database.</param> /// <param name="userId">User ID.</param> /// <param name="services">Services class object to check - whether our services work.</param> /// <param name="logging">Logging class object to create the log.</param> /// <param name="friend">User friend.</param> /// <param name="lstFriends">ListBox control where your friends list will be added.</param> /// <param name="frm">Instance a modal window.</param> public void ConnectToServer4(Storage4Context context, int userId, Services services, Logging logging, Friend friend, System.Windows.Controls.ListBox lstFriends, InfoWindow frm) { RedisOrSQLStorage4(context, userId, services, logging, frm); var queryFriendsStorage = context.Friends.Where(x => x.User_Id == userId); var friends = queryFriendsStorage.ToList(); foreach (var f in friends) { if (f.Friend_Id < 100000) { using (var storage1Context = new Storage1Context()) { frm.FriendsParam = friend.FindFriendsStorage1(storage1Context, f, frm); } } else if (f.Friend_Id > 100000 && f.Friend_Id < 200000) { using (var storage2Context = new Storage2Context()) { frm.FriendsParam = friend.FindFriendsStorage2(storage2Context, f, frm); } } else if (f.Friend_Id > 200000 && f.Friend_Id < 300000) { using (var storage3Context = new Storage3Context()) { frm.FriendsParam = friend.FindFriendsStorage3(storage3Context, f, frm); } } else if (f.Friend_Id > 300000 && f.Friend_Id < 400000) { frm.FriendsParam = friend.FindFriendsStorage4(context, f, frm); } else if (f.Friend_Id > 400000 && f.Friend_Id < 500000) { using (var storage5Context = new Storage5Context()) { frm.FriendsParam = friend.FindFriendsStorage5(storage5Context, f, frm); } } } }
/// <summary> /// The connection method to Storage5. /// Called from an event handler btnConnected_Click. /// </summary> /// <param name="context">The context of the interaction with the database.</param> /// <param name="userId">User ID.</param> /// <param name="listOfFriends">User's friends list.</param> /// <param name="services">Services class object to check - whether our services work.</param> /// <param name="logging">Logging class object to create the log.</param> /// <param name="friend">User friend.</param> /// <param name="view">View class object to display the changes.</param> /// <param name="textboxs">An array of text fields to fill.</param> /// <param name="lstFriends">ListBox control where your friends list will be added.</param> public void ConnectToServer5(Storage5Context context, int userId, List<int> listOfFriends, Services services, Logging logging, Friend friend, View.View view, System.Windows.Controls.TextBox[] textboxs, System.Windows.Controls.ListBox lstFriends) { RedisOrSQLStorage5(context, userId, services, logging, view, textboxs); var queryFriendsStorage = context.Friends.Where(x => x.User_Id == userId); var friends = queryFriendsStorage.ToList(); foreach (var f in friends) { if (f.Friend_Id < 100000) { using (var storage1Context = new Storage1Context()) { lstFriends.Items.Add(friend.FindFriendsStorage1(storage1Context, f, listOfFriends)); } } else if (f.Friend_Id > 100000 && f.Friend_Id < 200000) { using (var storage2Context = new Storage2Context()) { lstFriends.Items.Add(friend.FindFriendsStorage2(storage2Context, f, listOfFriends)); } } else if (f.Friend_Id > 200000 && f.Friend_Id < 300000) { using (var storage3Context = new Storage3Context()) { lstFriends.Items.Add(friend.FindFriendsStorage3(storage3Context, f, listOfFriends)); } } else if (f.Friend_Id > 300000 && f.Friend_Id < 400000) { using (var storage4Context = new Storage4Context()) { lstFriends.Items.Add(friend.FindFriendsStorage4(storage4Context, f, listOfFriends)); } } else if (f.Friend_Id > 400000 && f.Friend_Id < 500000) { lstFriends.Items.Add(friend.FindFriendsStorage5(context, f, listOfFriends)); } } }