List <AccountAccountingInfo> GetIdent(List <AccountAccountingInfo> infos)
        {
            List <AccountAccountingInfo> result = new List <AccountAccountingInfo>();
            var listStr = infos.Select(n => n.Ident.ToString()).ToHashSet();

            foreach (var each in listStr)
            {
                AccountAccountingInfo res = new AccountAccountingInfo();
                int i = 0;
                foreach (var acc in infos.Where(x => x.Ident == each))
                {
                    if (i == 0)
                    {
                        res = acc;
                    }
                    else
                    {
                        res.Payments.AddRange(acc.Payments);
                        res.PendingPayments.AddRange(acc.PendingPayments);
                        res.MobilePayments.AddRange(acc.MobilePayments);
                    }
                    i++;
                }
                result.Add(res);
            }

            return(result);
        }
        private void picker_SelectedIndexChanged(object sender, EventArgs e)
        {
            // var identLength = Settings.Person.Accounts[Picker.SelectedIndex].Ident.Length;
            // if (identLength < 6)
            // {
            //     Picker.WidthRequest = identLength * 9;
            // }
            additionalList.ItemsSource = null;
            AccountAccountingInfo account = Accounts[Picker.SelectedIndex];

            additionalList.ItemsSource = setPays(account);
            Analytics.TrackEvent("Смена лс на " + account.Ident);
        }
        List <PaymentInfo> setPays(AccountAccountingInfo accountingInfo)
        {
            List <PaymentInfo>   paymentInfo = new List <PaymentInfo>(accountingInfo.Payments);
            List <PaymentInfo>   paymentUO   = new List <PaymentInfo>(accountingInfo.PendingPayments);
            List <MobilePayment> mobile      = new List <MobilePayment>(accountingInfo.MobilePayments);

            paymentInfo.AddRange(paymentUO);
            foreach (var each in mobile)
            {
                paymentInfo.Add(new PaymentInfo()
                {
                    Date   = each.Date.Split(' ')[0],
                    Ident  = each.Ident,
                    Period = "Мобильный",
                    Sum    = each.Sum
                });
            }

            HistoryPayComparable comparable = new HistoryPayComparable();

            paymentInfo.Sort(comparable);
            paymentInfo.Reverse();
            return(paymentInfo);
        }
Ejemplo n.º 4
0
        public CostPage(AccountAccountingInfo account, List <AccountAccountingInfo> accounts)
        {
            this.account = account;
            Accounts     = accounts;
            InitializeComponent();
            Analytics.TrackEvent("Оплата по ЛС " + account.Ident);

            var profile = new TapGestureRecognizer();

            profile.Tapped += async(s, e) =>
            {
                if (Navigation.NavigationStack.FirstOrDefault(x => x is ProfilePage) == null)
                {
                    await Navigation.PushAsync(new ProfilePage());
                }
            };
            IconViewProfile.GestureRecognizers.Add(profile);

            var techSend = new TapGestureRecognizer();

            techSend.Tapped += async(s, e) => { await Navigation.PushAsync(new AppPage()); };
            LabelTech.GestureRecognizers.Add(techSend);
            var pickLs = new TapGestureRecognizer();

            pickLs.Tapped += async(s, e) => {
                Device.BeginInvokeOnMainThread(() =>
                {
                    Picker.Focus();
                });
            };
            StackLayoutLs.GestureRecognizers.Add(pickLs);

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                int statusBarHeight = DependencyService.Get <IStatusBar>().GetHeight();
                Pancake.Padding = new Thickness(0, statusBarHeight, 0, 0);

                if (Xamarin.Essentials.DeviceDisplay.MainDisplayInfo.Width < 700)
                {
                    LabelHistory.FontSize = 10;
                    LabelSaldos.FontSize  = 10;
                }
                IconViewSaldos.Margin = new Thickness(0, 0, 5, 0);
                break;

            default:
                break;
            }

            switch (Device.RuntimePlatform)
            {
            case Device.iOS:
                //BackgroundColor = Color.White;
                // ImageTop.Margin = new Thickness(0, 0, 0, 0);
                // StackLayout.Margin = new Thickness(0, 33, 0, 0);
                // IconViewNameUk.Margin = new Thickness(0, 33, 0, 0);
                break;

            case Device.Android:
                double or = Math.Round(((double)App.ScreenWidth / (double)App.ScreenHeight), 2);
                if (Math.Abs(or - 0.5) < 0.02)
                {
                    // ScrollViewContainer.Margin = new Thickness(0, 0, 0, -120);
                    BackStackLayout.Margin = new Thickness(-5, 15, 0, 0);
                }

                break;

            default:
                break;
            }

            NavigationPage.SetHasNavigationBar(this, false);
            var backClick = new TapGestureRecognizer();

            backClick.Tapped += async(s, e) => {
                try
                {
                    _ = await Navigation.PopAsync();
                }
                catch { }
            };
            BackStackLayout.GestureRecognizers.Add(backClick);
            var openSaldos = new TapGestureRecognizer();

            openSaldos.Tapped += async(s, e) => { if (Navigation.NavigationStack.FirstOrDefault(x => x is SaldosPage) == null)
                                                  {
                                                      await Navigation.PushAsync(new SaldosPage(Accounts));
                                                  }
            };
            FrameBtnSaldos.GestureRecognizers.Add(openSaldos);
            var openHistory = new TapGestureRecognizer();

            openHistory.Tapped += async(s, e) => { if (Navigation.NavigationStack.FirstOrDefault(x => x is HistoryPayedPage) == null)
                                                   {
                                                       await Navigation.PushAsync(new HistoryPayedPage(Accounts));
                                                   }
            };
            FrameBtnHistory.GestureRecognizers.Add(openHistory);
            BindingContext = new AccountingInfoModel()
            {
                AllAcc = Accounts,
                hex    = (Color)Application.Current.Resources["MainColor"]
            };
            SetText();
        }