Exemple #1
0
 void LoadFilter(SellerTransactionInfo info)
 {
     transactions.From   = info.From;
     transactions.To     = info.To;
     transactions.Amount = _amount;
     transactions.Offset = 0;
 }
Exemple #2
0
        //ObservableCollection<SellerInfo> Sellers { get; set; } = new ObservableCollection<SellerInfo>();

        #region Конструктор
        public FilterPage(SellerTransactionInfo _filter)
        {
            filter = _filter;
            InitializeComponent();
            dateFromPicker.Date    = filter.From;
            dateToPicker.Date      = filter.To;
            personButton.IsVisible = MobileStaticVariables.UserInfo.UserType == UserTypes.Admin;
            foreach (var item in MobileStaticVariables.UserInfo.Stuff)
            {
                var frame = new Frame()
                {
                    Style = (Style)App.Current.Resources["UsualFrameStyle"]
                };
                var stackHorizontal = new StackLayout()
                {
                    Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand
                };
                var stackVertical = new StackLayout()
                {
                    HorizontalOptions = LayoutOptions.FillAndExpand
                };
                var oper_nam = new Label()
                {
                    Text = item.Name, Style = (Style)App.Current.Resources["UsualLabelStyle"], StyleId = item.MobileManagerKey.ToString()
                };
                stackVertical.Children.Add(oper_nam);
                var oper_pos = new Label()
                {
                    Text = item.Position, Style = (Style)App.Current.Resources["SubLabelStyle"]
                };
                stackVertical.Children.Add(oper_pos);
                stackHorizontal.Children.Add(stackVertical);
                var checkbox = new Checkbox()
                {
                    HorizontalOptions = LayoutOptions.EndAndExpand, IsEnabled = false, Color = (Color)App.Current.Resources["MainColor"], ScaleCheckbox = 2.0
                };
                checkbox.IsChecked = filter.SellerList.Contains(int.Parse(oper_nam.StyleId));
                stackHorizontal.Children.Add(checkbox);
                frame.Content = stackHorizontal;
                var tap = new TapGestureRecognizer();
                tap.Tapped += (s, e) =>
                {
                    if (filter.SellerList.Contains(int.Parse(oper_nam.StyleId)))
                    {
                        checkbox.IsChecked = false;
                        filter.SellerList.Remove(int.Parse(oper_nam.StyleId));
                    }
                    else
                    {
                        checkbox.IsChecked = true;
                        filter.SellerList.Add(int.Parse(oper_nam.StyleId));
                    }
                };
                frame.GestureRecognizers.Add(tap);
                listSellers.Children.Add(frame);
            }
        }
 void LoadFilter(SellerTransactionInfo info)
 {
     transactions.From   = info.From;
     transactions.To     = info.To;
     transactions.Amount = _amount;
     transactions.Offset = 0;
     transactions.TransactionStatuses = info.TransactionStatuses;
     transactions.SellerList          = info.SellerList;
 }
Exemple #4
0
        void LoadTransactions(int offset)
        {
            try
            {
                isLoading = true;
                string transactionsInfo = "";
                transactions.Amount    = _amount;
                transactions.DeviceKey = MobileStaticVariables.UserInfo.MobileDeviceKey;
                transactions.Offset    = offset;
                transactionsInfo       = MobileStaticVariables.WebUtils.SendCardRequest("TransactionsSeller", Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(transactions))));

                Logger.WriteLine("transactionsInfo : " + transactionsInfo);
                if (transactionsInfo == "")
                {
                    throw new Exception("Pustaya stroka");
                }
                transactions = JsonConvert.DeserializeObject <SellerTransactionInfo>(transactionsInfo);
                if (transactions.ResultState == RequestResult.Results.Success)
                {
                    if (offset == 0 && transactions.Transactions.Count == 0)
                    {
                        Device.BeginInvokeOnMainThread(() =>
                        {
                            HideList();
                        });
                    }
                }
                else
                {
                    Device.BeginInvokeOnMainThread(async() =>
                    {
                        if (IsVisible)
                        {
                            await DisplayAlert("Внимание", transactions.TranslateResult(transactions.ResultState), "Продолжить");
                            HideList();
                        }
                    });
                }

                Device.BeginInvokeOnMainThread(() =>
                {
                    foreach (var item in transactions.Transactions)
                    {
                        var transactionCellView = new CellModel(item);
                        var group = Transactions.FirstOrDefault(x => (x.ComleteDate.Year == item.CompleteDatetime.Year) && (x.ComleteDate.DayOfYear == item.CompleteDatetime.DayOfYear));
                        if (group != null)
                        {
                            group.Add(transactionCellView);
                        }
                        else
                        {
                            var isFirstGroup = Transactions.Count == 0;
                            group            = new DateGroup(item.CompleteDatetime, _upFrame, isFirstGroup);
                            group.Add(transactionCellView);
                            Transactions.Add(group);
                        }
                    }
                    needToLoad = transactions.Transactions.Count == _amount;
                    if (IsVisible)
                    {
                        listTransaction.ItemsSource = null;
                        listTransaction.ItemsSource = Transactions;
                    }
                });
            }
            catch (Exception ex)
            {
                Logger.WriteError(ex);
                Device.BeginInvokeOnMainThread(() =>
                {
                    if (IsVisible)
                    {
                        HideList();
                        noConnectionLayout.IsVisible = true;
                        Device.StartTimer(new TimeSpan(0, 0, 1), WaitInternetConnection);
                    }
                });
            }
            finally
            {
                Device.BeginInvokeOnMainThread(() =>
                {
                    EndLoading();
                });
                isLoading = false;
            }
        }