コード例 #1
0
        public PaymentPage(FieldTimesPageViewModel model, Field field)
        {
            InitializeComponent();

            if (model.match != null)
            {
                mainField = field;
                mainFieldTimesPageViewModel = model;
                lblCityAndTown.Text         = field.City + "/" + field.District;
                lblDate.Text          = model.dayStr + " " + model.date.Year.ToString();
                lblFieldName.Text     = field.FieldName;
                lblPriceFromCard.Text = model.match.RandomLine3 + " TL";
                lblPayOnField.Text    = (Convert.ToInt32(model.match.RandomLine4) - Convert.ToInt32(model.match.RandomLine3)).ToString() + " TL";
                //lblTotalPrice.Text = model.match.RandomLine4 + " TL";
                lblTime.Text = model.TimeStr;
                NavigationPage mainP = App.Current.MainPage as NavigationPage;
                mainP.BarBackgroundColor = Color.FromHex("#2dbefc");
                mainP.BarTextColor       = Color.White;
            }
            for (int i = 2020; i < 2033; i++)
            {
                years.Add(i.ToString());
            }
            cardExpDateMonth.ItemsSource = months;
            cardExpDateYear.ItemsSource  = years;
        }
コード例 #2
0
        private async void FillAgainDateChanged()
        {
            if (currentFieldZone.TimeMethod == "exact")
            {
                for (int i = 0; i < 24; i++)
                {
                    viewModels.Add(new FieldTimesPageViewModel()
                    {
                        date       = currentDay,
                        isEnabled  = false,
                        match      = null,
                        TimeInt    = i * 100,
                        isSelected = false,
                    });
                }
            }
            else if (currentFieldZone.TimeMethod == "half")
            {
                for (int i = 0; i < 24; i++)
                {
                    viewModels.Add(new FieldTimesPageViewModel()
                    {
                        date      = currentDay,
                        isEnabled = false,
                        match     = null,
                        TimeInt   = i * 100 + 30,
                    });
                }
            }

            foreach (Match match in matches)
            {
                if (match.MatchOwnerId == 1 && match.FieldZoneId == currentFieldZone.Id)
                {
                    FieldTimesPageViewModel model = viewModels.Where(x => x.TimeInt == match.StartOn && x.date.Day == match.Day && x.date.Month == match.Month && x.date.Year == match.Year).FirstOrDefault();
                    if (model != null)
                    {
                        model.isEnabled = true;
                        model.match     = match;
                        if (model.date == DateTime.Now.Date && model.TimeInt / 100 <= DateTime.Now.Hour + 1)
                        {
                            model.isEnabled = false;
                        }
                    }
                }
            }
            colMatches.ItemsSource = viewModels;
        }
コード例 #3
0
 private void ColMatches_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (colMatches.SelectedItem != null)
     {
         FieldTimesPageViewModel selected = e.CurrentSelection[0] as FieldTimesPageViewModel;
         foreach (FieldTimesPageViewModel model in viewModels)
         {
             model.isSelected = false;
         }
         selected.isSelected     = true;
         colMatches.SelectedItem = null;
         colMatches.ItemsSource  = null;
         colMatches.ItemsSource  = viewModels;
         lblKapora.Text          = selected.match.RandomLine3;
         //lblTotal.Text = matches[1].RandomLine4;
         lblTotal.Text         = (Convert.ToInt32(selected.match.RandomLine4) - Convert.ToInt32(selected.match.RandomLine3)).ToString();
         selectedModel         = selected;
         btnContinue.IsEnabled = true;
     }
 }
コード例 #4
0
        private async void Fill()
        {
            await Navigation.PushPopupAsync(new Base1PopupPage("Yükleniyor..."));

            matches = await service.getFieldMathces(mainField);

            //lblFieldName.Text = mainField.FieldName;
            if (matches.Count > 0)
            {
                lblKapora.Text = matches[0].RandomLine3;
                //lblTotal.Text = matches[1].RandomLine4;
                lblTotal.Text = (Convert.ToInt32(matches[1].RandomLine4) - Convert.ToInt32(matches[0].RandomLine3)).ToString();
            }
            if (currentFieldZone.TimeMethod == "exact")
            {
                for (int i = 0; i < 24; i++)
                {
                    viewModels.Add(new FieldTimesPageViewModel()
                    {
                        date       = currentDay,
                        isEnabled  = false,
                        match      = null,
                        TimeInt    = i * 100,
                        isSelected = false,
                    });
                }
            }
            else if (currentFieldZone.TimeMethod == "half")
            {
                for (int i = 0; i < 24; i++)
                {
                    viewModels.Add(new FieldTimesPageViewModel()
                    {
                        date      = currentDay,
                        isEnabled = false,
                        match     = null,
                        TimeInt   = i * 100 + 30,
                    });
                }
            }

            foreach (Match match in matches)
            {
                if (match.MatchOwnerId == 1 && match.FieldZoneId == currentFieldZone.Id)
                {
                    FieldTimesPageViewModel model = viewModels.Where(x => x.TimeInt == match.StartOn && x.date.Day == match.Day && x.date.Month == match.Month && x.date.Year == match.Year).FirstOrDefault();
                    if (model != null)
                    {
                        model.isEnabled = true;
                        model.match     = match;
                        if (model.date == DateTime.Now.Date && model.TimeInt / 100 <= DateTime.Now.Hour + 1)
                        {
                            model.isEnabled = false;
                        }
                    }
                }
            }
            //colMatches.ItemsSource = viewModels;

            colMatches.ItemsSource = viewModels;
            //colMatches.BindingContext = viewModels;
            await Navigation.PopPopupAsync();
        }