コード例 #1
0
        //Save data
        private void BtnApplyOnClick(object sender, EventArgs e)
        {
            try
            {
                UserDetails.SearchGender         = Gender;
                UserDetails.SearchCountry        = Location;
                UserDetails.SearchStatus         = Status;
                UserDetails.SearchVerified       = Verified;
                UserDetails.SearchProfilePicture = ProfilePicture;
                UserDetails.SearchFilterByAge    = SwitchState ? "on" : "off";
                UserDetails.SearchAgeFrom        = AgeMin.ToString();
                UserDetails.SearchAgeTo          = AgeMax.ToString();

                var dbDatabase        = new SqLiteDatabase();
                var newSettingsFilter = new DataTables.SearchFilterTb
                {
                    Gender         = Gender,
                    Country        = Location,
                    Status         = Status,
                    Verified       = Verified,
                    ProfilePicture = ProfilePicture,
                    FilterByAge    = SwitchState ? "on" : "off",
                    AgeFrom        = AgeMin.ToString(),
                    AgeTo          = AgeMax.ToString(),
                };
                dbDatabase.InsertOrUpdate_SearchFilter(newSettingsFilter);
                dbDatabase.Dispose();

                ContextSearch.UserTab.MainScrollEvent.IsLoading   = false;
                ContextSearch.PagesTab.MainScrollEvent.IsLoading  = false;
                ContextSearch.GroupsTab.MainScrollEvent.IsLoading = false;

                ContextSearch.Search(ContextSearch.SearchText);

                Dismiss();
            }
            catch (Exception exception)
            {
                Methods.DisplayReportResultTrack(exception);
            }
        }
コード例 #2
0
        //Save data
        private void BtnApplyOnClick(object sender, EventArgs e)
        {
            try
            {
                UserDetails.SearchGender         = Gender;
                UserDetails.SearchCountry        = Location;
                UserDetails.SearchStatus         = Status;
                UserDetails.SearchVerified       = Verified;
                UserDetails.SearchProfilePicture = ProfilePicture;
                UserDetails.SearchFilterByAge    = SwitchState ? "on" : "off";
                UserDetails.SearchAgeFrom        = AgeMin.ToString();
                UserDetails.SearchAgeTo          = AgeMax.ToString();

                var dbDatabase        = new SqLiteDatabase();
                var newSettingsFilter = new DataTables.SearchFilterTb
                {
                    Gender         = Gender,
                    Country        = Location,
                    Status         = Status,
                    Verified       = Verified,
                    ProfilePicture = ProfilePicture,
                    FilterByAge    = SwitchState ? "on" : "off",
                    AgeFrom        = AgeMin.ToString(),
                    AgeTo          = AgeMax.ToString(),
                };
                dbDatabase.InsertOrUpdate_SearchFilter(newSettingsFilter);
                dbDatabase.Dispose();

                ContextSearch.Search();

                Dismiss();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
コード例 #3
0
        private void GetFilter()
        {
            try
            {
                var dbDatabase = new SqLiteDatabase();
                var data       = dbDatabase.GetSearchFilterById();
                if (data != null)
                {
                    UserDetails.SearchGender         = Gender = data.Gender;
                    UserDetails.SearchCountry        = Location = data.Country;
                    UserDetails.SearchStatus         = Status = data.Status;
                    UserDetails.SearchVerified       = Verified = data.Verified;
                    UserDetails.SearchProfilePicture = ProfilePicture = data.ProfilePicture;
                    UserDetails.SearchFilterByAge    = data.FilterByAge;
                    UserDetails.SearchAgeFrom        = data.AgeFrom;
                    UserDetails.SearchAgeTo          = data.AgeTo;

                    SwitchState = data.FilterByAge == "on";
                    AgeMin      = int.Parse(data.AgeFrom);
                    AgeMax      = int.Parse(data.AgeTo);

                    TxtStatus.Text = Status switch
                    {
                        "all" => GetText(Resource.String.Lbl_All),
                        "off" => GetText(Resource.String.Lbl_Offline),
                        "on" => GetText(Resource.String.Lbl_Online),
                        _ => GetText(Resource.String.Lbl_All)
                    };

                    TxtVerified.Text = Verified switch
                    {
                        "all" => GetText(Resource.String.Lbl_All),
                        "off" => GetText(Resource.String.Lbl_UnVerified),
                        "on" => GetText(Resource.String.Lbl_Verified),
                        _ => GetText(Resource.String.Lbl_All)
                    };

                    TxtProfilePicture.Text = ProfilePicture switch
                    {
                        "all" => GetText(Resource.String.Lbl_All),
                        "yes" => GetText(Resource.String.Lbl_Yes),
                        "no" => GetText(Resource.String.Lbl_No),
                        _ => GetText(Resource.String.Lbl_All)
                    };

                    string[] countriesArray = Context.Resources.GetStringArray(Resource.Array.countriesArray);
                    if (Location == "all")
                    {
                        LocationPlace.Text = GetText(Resource.String.Lbl_All);
                    }
                    else
                    {
                        bool success = int.TryParse(Location, out var number);
                        if (success)
                        {
                            var check = countriesArray[number];
                            if (check != null)
                            {
                                LocationPlace.Text = check;
                            }
                        }
                        else
                        {
                            LocationPlace.Text = GetText(Resource.String.Lbl_All);
                        }
                    }

                    if (SwitchState)
                    {
                        AgeSwitch.Checked        = true;
                        SeekbarLayout.Visibility = ViewStates.Visible;
                        TxtAge.Text = GetString(Resource.String.Lbl_Age) + " " + AgeMin + " - " + AgeMax;
                    }
                    else
                    {
                        AgeSwitch.Checked        = false;
                        SeekbarLayout.Visibility = ViewStates.Invisible;
                        TxtAge.Text = GetString(Resource.String.Lbl_Age);
                    }

                    //////////////////////////// Gender //////////////////////////////
                    var check1 = GenderAdapter.GenderList.Where(a => a.GenderSelect).ToList();
                    if (check1.Count > 0)
                    {
                        foreach (var all in check1)
                        {
                            all.GenderSelect = false;
                        }
                    }

                    var check2 = GenderAdapter.GenderList.FirstOrDefault(a => a.GenderId == data.Gender);
                    if (check2 != null)
                    {
                        check2.GenderSelect = true;
                        Gender = check2.GenderId;
                    }

                    GenderAdapter.NotifyDataSetChanged();
                }
                else
                {
                    UserDetails.SearchGender         = "all";
                    UserDetails.SearchCountry        = "all";
                    UserDetails.SearchStatus         = "all";
                    UserDetails.SearchVerified       = "all";
                    UserDetails.SearchProfilePicture = "all";
                    UserDetails.SearchFilterByAge    = "off";
                    UserDetails.SearchAgeFrom        = "10";
                    UserDetails.SearchAgeTo          = "70";

                    Gender         = UserDetails.SearchGender;
                    Location       = UserDetails.SearchCountry;
                    Status         = UserDetails.SearchStatus;
                    Verified       = UserDetails.SearchVerified;
                    ProfilePicture = UserDetails.SearchProfilePicture;
                    SwitchState    = UserDetails.SearchFilterByAge == "on";
                    AgeMin         = int.Parse(UserDetails.SearchAgeFrom);
                    AgeMax         = int.Parse(UserDetails.SearchAgeTo);

                    var check = GenderAdapter.GenderList.FirstOrDefault(a => a.GenderId == "all");
                    if (check != null)
                    {
                        check.GenderSelect = true;
                        Gender             = check.GenderId;

                        GenderAdapter.NotifyDataSetChanged();
                    }

                    var newSettingsFilter = new DataTables.SearchFilterTb
                    {
                        Gender         = UserDetails.SearchGender,
                        Country        = UserDetails.SearchCountry,
                        Status         = UserDetails.SearchStatus,
                        Verified       = UserDetails.SearchVerified,
                        ProfilePicture = UserDetails.SearchProfilePicture,
                        FilterByAge    = UserDetails.SearchFilterByAge,
                        AgeFrom        = UserDetails.SearchAgeFrom,
                        AgeTo          = UserDetails.SearchAgeTo,
                    };
                    dbDatabase.InsertOrUpdate_SearchFilter(newSettingsFilter);
                }

                dbDatabase.Dispose();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
コード例 #4
0
        private void GetFilter()
        {
            try
            {
                var dbDatabase = new SqLiteDatabase();
                var data       = dbDatabase.GetSearchFilterById();
                if (data != null)
                {
                    UserDetails.SearchGender         = Gender = data.Gender;
                    UserDetails.SearchCountry        = Location = data.Country;
                    UserDetails.SearchStatus         = Status = data.Status;
                    UserDetails.SearchVerified       = Verified = data.Verified;
                    UserDetails.SearchProfilePicture = ProfilePicture = data.ProfilePicture;
                    UserDetails.SearchFilterByAge    = data.FilterByAge;
                    UserDetails.SearchAgeFrom        = data.AgeFrom;
                    UserDetails.SearchAgeTo          = data.AgeTo;

                    SwitchState = data.FilterByAge == "on";
                    AgeMin      = Convert.ToInt32(data.AgeFrom);
                    AgeMax      = Convert.ToInt32(data.AgeTo);

                    TxtStatus.Text = Status switch
                    {
                        "all" => GetText(Resource.String.Lbl_All),
                        "off" => GetText(Resource.String.Lbl_Offline),
                        "on" => GetText(Resource.String.Lbl_Online),
                        _ => GetText(Resource.String.Lbl_All)
                    };

                    TxtVerified.Text = Verified switch
                    {
                        "all" => GetText(Resource.String.Lbl_All),
                        "off" => GetText(Resource.String.Lbl_UnVerified),
                        "on" => GetText(Resource.String.Lbl_Verified),
                        _ => GetText(Resource.String.Lbl_All)
                    };

                    TxtProfilePicture.Text = ProfilePicture switch
                    {
                        "all" => GetText(Resource.String.Lbl_All),
                        "yes" => GetText(Resource.String.Lbl_Yes),
                        "no" => GetText(Resource.String.Lbl_No),
                        _ => GetText(Resource.String.Lbl_All)
                    };

                    var countriesArray = WoWonderTools.GetCountryList(Activity);
                    switch (Location)
                    {
                    case "all":
                        LocationPlace.Text = GetText(Resource.String.Lbl_All);
                        break;

                    default:
                    {
                        bool success = int.TryParse(Location, out var number);
                        switch (success)
                        {
                        case true:
                        {
                            var check = countriesArray.FirstOrDefault(a => a.Key == number.ToString()).Value;
                            LocationPlace.Text = string.IsNullOrEmpty(check) switch
                            {
                                false => check,
                                _ => LocationPlace.Text
                            };

                            break;
                        }

                        default:
                            LocationPlace.Text = GetText(Resource.String.Lbl_All);
                            break;
                        }

                        break;
                    }
                    }

                    switch (SwitchState)
                    {
                    case true:
                        AgeSwitch.Checked        = true;
                        SeekbarLayout.Visibility = ViewStates.Visible;
                        TxtAge.Text = GetString(Resource.String.Lbl_Age) + " " + AgeMin + " - " + AgeMax;
                        break;

                    default:
                        AgeSwitch.Checked        = false;
                        SeekbarLayout.Visibility = ViewStates.Invisible;
                        TxtAge.Text = GetString(Resource.String.Lbl_Age);
                        break;
                    }

                    //////////////////////////// Gender //////////////////////////////
                    var check1 = GenderAdapter.GenderList.Where(a => a.GenderSelect).ToList();
                    switch (check1.Count)
                    {
                    case > 0:
                    {
                        foreach (var all in check1)
                        {
                            all.GenderSelect = false;
                        }
                        break;
                    }
                    }

                    var check2 = GenderAdapter.GenderList.FirstOrDefault(a => a.GenderId == data.Gender);
                    if (check2 != null)
                    {
                        check2.GenderSelect = true;
                        Gender = check2.GenderId;
                    }

                    GenderAdapter.NotifyDataSetChanged();
                }
                else
                {
                    UserDetails.SearchGender         = "all";
                    UserDetails.SearchCountry        = "all";
                    UserDetails.SearchStatus         = "all";
                    UserDetails.SearchVerified       = "all";
                    UserDetails.SearchProfilePicture = "all";
                    UserDetails.SearchFilterByAge    = "off";
                    UserDetails.SearchAgeFrom        = "10";
                    UserDetails.SearchAgeTo          = "70";

                    Gender         = UserDetails.SearchGender;
                    Location       = UserDetails.SearchCountry;
                    Status         = UserDetails.SearchStatus;
                    Verified       = UserDetails.SearchVerified;
                    ProfilePicture = UserDetails.SearchProfilePicture;
                    SwitchState    = UserDetails.SearchFilterByAge == "on";
                    AgeMin         = Convert.ToInt32(UserDetails.SearchAgeFrom);
                    AgeMax         = Convert.ToInt32(UserDetails.SearchAgeTo);

                    var check = GenderAdapter.GenderList.FirstOrDefault(a => a.GenderId == "all");
                    if (check != null)
                    {
                        check.GenderSelect = true;
                        Gender             = check.GenderId;

                        GenderAdapter.NotifyDataSetChanged();
                    }

                    var newSettingsFilter = new DataTables.SearchFilterTb
                    {
                        Gender         = UserDetails.SearchGender,
                        Country        = UserDetails.SearchCountry,
                        Status         = UserDetails.SearchStatus,
                        Verified       = UserDetails.SearchVerified,
                        ProfilePicture = UserDetails.SearchProfilePicture,
                        FilterByAge    = UserDetails.SearchFilterByAge,
                        AgeFrom        = UserDetails.SearchAgeFrom,
                        AgeTo          = UserDetails.SearchAgeTo,
                    };
                    dbDatabase.InsertOrUpdate_SearchFilter(newSettingsFilter);
                }
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }