示例#1
0
        private async void checkedListBox_TypeAbon_SelectedIndexChanged(object sender, EventArgs e)
        {
            var checkedIndexes = checkedListBox_TypeAbon.CheckedIndices;

            IEnumerable <Person> r1 = new List <Person>();
            IEnumerable <Person> r2 = new List <Person>();
            IEnumerable <Person> r3 = new List <Person>();

            if ((checkedIndexes.Count != 3) && (checkedIndexes.Count != 0))
            {
                if ((MyCheckedListBox.IsChecked(checkedListBox_TypeAbon, 0)))
                {
                    r1 = _personsAll.Where(x => x.Value?.AbonementCurent?.AbonementName == AbonementByDays.NameAbonement).Select(x => x.Value);
                }
                if (MyCheckedListBox.IsChecked(checkedListBox_TypeAbon, 1))
                {
                    r2 = _personsAll.Where(x => x.Value?.AbonementCurent?.AbonementName == ClubCardA.NameAbonement).Select(x => x.Value);
                }
                if (MyCheckedListBox.IsChecked(checkedListBox_TypeAbon, 2))
                {
                    r3 = _personsAll.Where(x => x.Value?.AbonementCurent?.AbonementName == SingleVisit.NameAbonement).Select(x => x.Value);
                }
                _reqAbonType = r1.Union(r2).Union(r3);
            }
            else
            {
                _reqAbonType = _personsAll.Values; //  Если не нужна выборка по этому признаку
            }

            MyCheckedListBox.ClearSelection(checkedListBox_TypeAbon);
            var result = await GetUpdatedRequestsAsync();

            ShowPersons(result);
        }
示例#2
0
        private void checkedListBox_Gender_SelectedIndexChanged(object sender, EventArgs e)
        {
            var checkedIndexes = checkedListBox_Gender.CheckedIndices;

            IEnumerable <Person> r1 = new List <Person>();
            IEnumerable <Person> r2 = new List <Person>();

            if ((checkedIndexes.Count != 2) && (checkedIndexes.Count != 0))
            {
                // Мужчины
                if ((MyCheckedListBox.IsChecked(checkedListBox_Gender, 0)))
                {
                    r1 = _personsAll.Where(x => x.Value.GenderType == Gender.Мужской).Select(x => x.Value);
                }
                // Женщины
                if (MyCheckedListBox.IsChecked(checkedListBox_Gender, 1))
                {
                    r2 = _personsAll.Where(x => (x.Value.GenderType == Gender.Женский)).Select(x => x.Value);
                }
                _reqGender = r1.Union(r2);
            }
            else
            {
                _reqGender = _personsAll.Values; //  Если не нужна выборка по этому признаку
            }

            MyCheckedListBox.ClearSelection(checkedListBox_Gender);
            var result = GetUpdatedRequestsAsync();

            ShowPersons(result.Result);
        }
示例#3
0
        private async void checkedListBox_Age_SelectedIndexChanged(object sender, EventArgs e)
        {
            var checkedIndexes = checkedListBox_Age.CheckedIndices;

            IEnumerable <Person> r1 = new List <Person>();
            IEnumerable <Person> r2 = new List <Person>();
            IEnumerable <Person> r3 = new List <Person>();

            if ((checkedIndexes.Count != 3) && (checkedIndexes.Count != 0))
            {
                // До 30
                if (MyCheckedListBox.IsChecked(checkedListBox_Age, 0))
                {
                    var data = DateTime.Now.AddYears(-30); // Дата проверки для 30 летних
                    r1 = _personsAll.Where(x => x.Value?.BirthDate.Date.CompareTo(data) >= 0).Select(x => x.Value);
                }

                // 30 - 40
                if (MyCheckedListBox.IsChecked(checkedListBox_Age, 1))
                {
                    var dataFrom = DateTime.Now.AddYears(-40);
                    var dataTo   = DateTime.Now.AddYears(-30);
                    r2 = _personsAll.Where(x => (x.Value?.BirthDate.Date.CompareTo(dataFrom) >= 0 &&
                                                 x.Value?.BirthDate.Date.CompareTo(dataTo) <= 0)).Select(x => x.Value);
                }

                // От 40
                if (MyCheckedListBox.IsChecked(checkedListBox_Age, 2))
                {
                    var data = DateTime.Now.AddYears(-40);
                    r3 = _personsAll.Where(x => x.Value?.BirthDate.Date.CompareTo(data) <= 0).Select(x => x.Value);
                }
                _reqAge = r1.Union(r2).Union(r3);
            }
            else
            {
                _reqAge = _personsAll.Values; //  Если не нужна выборка по этому признаку
            }

            MyCheckedListBox.ClearSelection(checkedListBox_Age);
            var result = await GetUpdatedRequestsAsync();

            ShowPersons(result);
        }
示例#4
0
        private async void checkedListBox_Activation_SelectedIndexChanged(object sender, EventArgs e)
        {
            var checkedIndexes = checkedListBox_Activation.CheckedIndices;

            // Сортировка по этому признаку не важна. Содержит 2 поля(Оплачено, Не оплачено)
            if ((checkedIndexes.Count == 2) || (checkedIndexes.Count == 0))
            {
                _reqActivation = _personsAll.Values;
            }
            else
            {
                var activation = MyCheckedListBox.IsChecked(checkedListBox_Activation, 0);
                _reqActivation = _personsAll.Where(x => x.Value?.AbonementCurent?.IsActivated == activation).Select(x => x.Value);
            }

            MyCheckedListBox.ClearSelection(checkedListBox_Activation);
            var result = await GetUpdatedRequestsAsync();

            ShowPersons(result);
        }
示例#5
0
        private async void checkedListBox_TimeTren_SelectedIndexChanged(object sender, EventArgs e)
        {
            var checkedIndexes = checkedListBox_TimeTren.CheckedIndices;

            // Сортировка по этому признаку не важна. Содержит 2 поля(Оплачено, Не оплачено)
            if ((checkedIndexes.Count == 2) || (checkedIndexes.Count == 0))
            {
                _reqTimeTren = _personsAll.Values;
            }
            else
            {
                var timeTren = (MyCheckedListBox.IsChecked(checkedListBox_TimeTren, 0)) ? TimeForTr.Утро : TimeForTr.Весь_День;
                _reqTimeTren = _personsAll.Where(x => x.Value?.AbonementCurent?.TimeTraining == timeTren).Select(x => x.Value);
            }

            MyCheckedListBox.ClearSelection(checkedListBox_TimeTren);
            var result = await GetUpdatedRequestsAsync();

            ShowPersons(result);
        }
示例#6
0
        private async void checkedListBox_Pay_SelectedIndexChanged(object sender, EventArgs e)
        {
            var checkedIndexes = checkedListBox_Pay.CheckedIndices;

            // Сортировка по этому признаку не важна. Содержит 2 поля(Оплачено, Не оплачено)
            if ((checkedIndexes.Count == 2) || (checkedIndexes.Count == 0))
            {
                _reqPay = _personsAll.Values;
            }
            else
            {
                var payment = (MyCheckedListBox.IsChecked(checkedListBox_Pay, 0)) ? Pay.Не_Оплачено : Pay.Оплачено;
                _reqPay = _personsAll.Where(x => x.Value?.AbonementCurent?.PayStatus == payment).Select(x => x.Value);
            }

            MyCheckedListBox.ClearSelection(checkedListBox_Pay);
            var result = await GetUpdatedRequestsAsync();

            ShowPersons(result);
        }