public DefineCostPopupPage(CalendarPageViewModel model) { FieldZone zone = App.Current.Properties["currentFieldZone"] as FieldZone; mainModel = model; InitializeComponent(); lblDate1.Text = model.dayStr; if (model.match == null) { entryKapora.Text = "0"; entryPrice.Text = zone.PaymentModel1FullCost.ToString(); } else { if (model.match.RandomLine3 != null) { entryKapora.Text = model.match.RandomLine3; } else { entryKapora.Text = "0"; } entryPrice.Text = model.match.RandomLine4; } }
public async Task <string> SetOpenToClose(int year, int month, int day, int time) { FieldZone currentFz = Application.Current.Properties["currentFieldZone"] as FieldZone; int fieldZoneId = currentFz.Id; string response = "Hata"; if (App.Current.Properties.ContainsKey("loggedField")) { var input = $"https://www.harbisaha.com/api/Field/TimeMakeUnAvailable?year=" + year + "&month=" + month + "&day=" + day + "&time=" + time + "&fieldZoneId=" + fieldZoneId; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); response = JsonConvert.DeserializeObject <string>((result)); } else // düzenlenecek. { var input = $"https://www.harbisaha.com/api/Field/TimeMakeUnAvailable?year=" + year + "&month=" + month + "&day=" + day + "&time=" + time + "&fieldZoneId=" + fieldZoneId; //var client = await GetClient(); var client = await GetFirstClient(); var result = await client.GetStringAsync(input); response = JsonConvert.DeserializeObject <string>((result)); } try { return(response); } catch (Exception) { return(null); } }
public async Task <Match> SetCloseFromRented(int day, int month, int year, int time) { Match responseMatch = new Match(); FieldZone fieldZone = App.Current.Properties["currentFieldZone"] as FieldZone; try { if (App.Current.Properties.ContainsKey("loggedField")) { var input = $"https://www.harbisaha.com/api/Field/SetCloseFromRented?fieldZoneId=" + fieldZone.Id + "&day=" + day + "&month=" + month + "&year=" + year + "&time=" + time; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); responseMatch = JsonConvert.DeserializeObject <Match>((result)); } else // düzenlenecek. { var input = $"https://www.harbisaha.com/api/Field/SetCloseFromRented?fieldZoneId=" + fieldZone.Id + "&day=" + day + "&month=" + month + "&year=" + year + "&time=" + time; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); responseMatch = JsonConvert.DeserializeObject <Match>((result)); } return(responseMatch); } catch (Exception) { return(null); } }
public CalendarPage() { InitializeComponent(); currentField = Application.Current.Properties["loggedField"] as Field; fieldZones = currentField.FieldZones; foreach (FieldZone fz in fieldZones) { fieldZoneNames.Add(fz.FieldZoneName); } pickerFieldZone.ItemsSource = fieldZoneNames; currentFieldZone = Application.Current.Properties["currentFieldZone"] as FieldZone; fieldZoneId = currentFieldZone.Id; pickerFieldZone.SelectedItem = currentFieldZone.FieldZoneName; control.MakeVisible(ActivityLayout, activity); datePicker1.Date = DateTime.Today; datePicker1.Format = " dddd dd/MM"; datePicker1.MinimumDate = DateTime.Today; datePicker1.MaximumDate = DateTime.Today.AddDays(21); if (datePicker1.Date == today) { //btnPrev.IsEnabled = false; } //btnPrev.IsEnabled = false; Fill(); }
private void PickerFieldZone_SelectedIndexChanged(object sender, EventArgs e) { if (isChanged) { colSunday.ItemsSource = null; colMonday.ItemsSource = null; colTuesday.ItemsSource = null; colWednesday.ItemsSource = null; colThursday.ItemsSource = null; colFriday.ItemsSource = null; colSaturday.ItemsSource = null; viewModelsCrs.Clear(); viewModelsCts.Clear(); viewModelsPrs.Clear(); viewModelsCum.Clear(); viewModelsPzt.Clear(); viewModelsPzr.Clear(); viewModelsSali.Clear(); lblAlertFriday.Text = ""; lblAlertMonday.Text = ""; lblAlertSunday.Text = ""; lblAlertTuesday.Text = ""; lblAlertThursday.Text = ""; lblAlertSaturday.Text = ""; lblAlertWednesday.Text = ""; string selectedItem = pickerFieldZone.SelectedItem as string; FieldZone selected = fieldZones.Where(x => x.FieldZoneName == selectedItem).FirstOrDefault(); App.Current.Properties["currentFieldZone"] = selected; Fill(); } }
public void AddZone(FieldZone _zone) { if (ZoneList == null) { ZoneList = new List <FieldZone>(); } ZoneList.Add(_zone); }
private FieldZone GetZone(Zone _zone) { FieldZone zone = null; foreach (FieldZone z in zones) { if (z.Zone == _zone) { zone = z; } } return(zone); }
private FieldZone GetZone(Zone _zone, MatchZonesContainer _container) { FieldZone zone = null; foreach (FieldZone z in _container.ZoneList) { if (z.Zone == _zone) { zone = z; } } return(zone); }
protected void SetDesiredState(GameTickPacket gameTickPacket) { if (DesiredState != null) { State = DesiredState.Value; DesiredState = null; return; } if (State != BotState.Kickoff) { if (ShouldChangeToKickoff()) { SendQuickChatFromAgent(false, QuickChatSelection.Information_IGotIt); State = BotState.Kickoff; return; } if (ShouldChangeToChasing() && State != BotState.Chasing) { SendQuickChatFromAgent(false, QuickChatSelection.Information_IGotIt); TurnAroud(); State = BotState.Chasing; } else if (ShouldChangeToDefending() && State != BotState.Defending) { SendQuickChatFromAgent(false, QuickChatSelection.Information_Defending); State = BotState.Defending; return; } else if (ShouldChangeToWaitingForCenter() && State != BotState.WaitingForCenter) { SendQuickChatFromAgent(false, QuickChatSelection.Information_InPosition); var enemyGoalZone = Field.Zones.First(z => z.IsMySide == false && z.HasGoal); var targetZoneId = enemyGoalZone.Id > 6 ? enemyGoalZone.Id - 3 : enemyGoalZone.Id + 3; TargetZone = Field.Zones.First(z => z.Id == targetZoneId); TurnTarget = TargetZone.Rec.Center(); TurnAroud(); State = BotState.Chasing; } } else { if (Ball.Location != null && (Ball.Location.X != 0 || Ball.Location.Y != 0)) { SendQuickChatFromAgent(false, QuickChatSelection.Information_IGotIt); State = BotState.Chasing; } } }
public async Task <List <Match> > GetYearlyMatches(int year) { Field currentField = App.Current.Properties["loggedField"] as Field; List <FieldZone> fieldZones = new List <FieldZone>(); fieldZones = currentField.FieldZones; int fz1Id = 0, fz2Id = 0, fz3Id = 0, fz4Id = 0, fz5Id = 0, countFz; countFz = fieldZones.Count; if (countFz > 0) { fz1Id = fieldZones[0].Id; } if (countFz > 1) { fz2Id = fieldZones[1].Id; } if (countFz > 2) { fz3Id = fieldZones[2].Id; } if (countFz > 3) { fz4Id = fieldZones[3].Id; } if (countFz > 4) { fz5Id = fieldZones[4].Id; } int fieldId = currentField.Id; List <Match> matches = new List <Match>(); if (App.Current.Properties.ContainsKey("loggedField")) { FieldZone fz = App.Current.Properties["currentFieldZone"] as FieldZone; var input = $"https://www.harbisaha.com/api/Field/GetYearlyMatches?year=" + year + "&fz1Id=" + fz1Id + "&fz2Id=" + fz2Id + "&fz3Id=" + fz3Id + "&fz4Id=" + fz4Id + "&fz5Id=" + fz5Id; var client = await GetClient(); var result = await client.GetStringAsync(input); matches = JsonConvert.DeserializeObject <List <Match> >((result)); } else // düzenlenecek. { return(null); } return(matches); }
private void PickerFieldZones_SelectedIndexChanged(object sender, EventArgs e) { if (!isStarted) { return; } string fieldZoneName = pickerFieldZones.SelectedItem as string; currentFieldZone = mainField.FieldZones.Where(x => x.FieldZoneName == fieldZoneName).FirstOrDefault(); colMatches.SelectedItem = null; lblKapora.Text = ""; lblTotal.Text = ""; btnContinue.IsEnabled = false; viewModels.Clear(); FillAgainDateChanged(); }
private void PickerFieldZone_SelectedIndexChanged(object sender, EventArgs e) { if (isChancing) { control.MakeVisible(ActivityLayout, activity); string fzName; FieldZone fz1 = new FieldZone(); fzName = pickerFieldZone.SelectedItem as string; fz1 = fieldZones.Where(x => x.FieldZoneName == fzName).FirstOrDefault(); colMatches.ItemsSource = null; // currentFieldZone = fz; Application.Current.Properties["currentFieldZone"] = fz1; Days.Clear(); viewModels.Clear(); notes.Clear(); subs.Clear(); matches.Clear(); // fieldZoneNames.Clear(); // fieldZones.Clear(); currentField = Application.Current.Properties["loggedField"] as Field; fieldZones = currentField.FieldZones; foreach (FieldZone fz in fieldZones) { fieldZoneNames.Add(fz.FieldZoneName); } pickerFieldZone.ItemsSource = fieldZoneNames; currentFieldZone = Application.Current.Properties["currentFieldZone"] as FieldZone; fieldZoneId = currentFieldZone.Id; pickerFieldZone.SelectedItem = currentFieldZone.FieldZoneName; datePicker1.Date = DateTime.Today; datePicker1.Format = " dddd dd/MM"; datePicker1.MinimumDate = DateTime.Today; datePicker1.MaximumDate = DateTime.Today.AddDays(21); if (datePicker1.Date == today) { //btnPrev.IsEnabled = false; } //btnPrev.IsEnabled = false; Fill(); } }
public async Task <User> GetSingleUser(int userId) { User user = new User(); if (App.Current.Properties.ContainsKey("loggedField")) { FieldZone fz = App.Current.Properties["currentFieldZone"] as FieldZone; var input = $"https://www.harbisaha.com/api/Field/GetSingleUser?userId=" + userId; var client = await GetClient(); var result = await client.GetStringAsync(input); user = JsonConvert.DeserializeObject <User>((result)); } else // düzenlenecek. { return(null); } return(user); }
public AddSubscribePopupPage() { InitializeComponent(); currentFieldZone = Application.Current.Properties["currentFieldZone"] as FieldZone; pickerDays.ItemsSource = dayList; //PAZARTESİ GİBİ İŞLEM YAP. //if (Application.Current.Properties["Subscribes"] != null) //{ // subscribes.Clear(); // subscribes = Application.Current.Properties["Subscribes"] as List<Announcement>; // foreach (Announcement sub in subscribes) // { // if (sub.FieldZoneId == currentFieldZone.Id && sub.SubscribeDayOfWeek == 1) // { // currentDaySubsList.Add(sub); // subscribedTimeList.Add(sub.SubscribeMatchTime); // } // } //} //if (currentDaySubsList.Count > 0) //{ // if (currentFieldZone.TimeMethod == "exact") // { // for (int i = 0; i <= 2300; i += 100) // { // if (subscribedTimeList.Contains(i)) // continue; // timeList.Add(convertTimeIntToStr(i)); // } // } //} //else //{ // for (int i = 0; i <= 2300; i += 100) // { // timeList.Add(convertTimeIntToStr(i)); // } //} }
public async Task <Match> SetOpenFromRented(int day, int month, int year, int time) { FieldZone fieldZone = App.Current.Properties["currentFieldZone"] as FieldZone; int halfPrice = fieldZone.PaymentModel1SmallCost; int fullPrice = fieldZone.PaymentModel1FullCost; //int halfPrice = f try { Match responseMatch = new Match(); if (App.Current.Properties.ContainsKey("loggedField")) { var input = $"https://www.harbisaha.com/api/Field/SetOpenFromRented?fieldZoneId=" + fieldZone.Id + "&day=" + day + "&month=" + month + "&year=" + year + "&time=" + time + "&halfPrice=" + halfPrice + "&fullPrice=" + fullPrice; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); responseMatch = JsonConvert.DeserializeObject <Match>((result)); } else // düzenlenecek. { var input = $"https://www.harbisaha.com/api/Field/SetOpenFromRented?fieldZoneId=" + fieldZone.Id + "&day=" + day + "&month=" + month + "&year=" + year + "&time=" + time + "&halfPrice=" + halfPrice + "&fullPrice=" + fullPrice; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); responseMatch = JsonConvert.DeserializeObject <Match>((result)); } return(responseMatch); } catch (Exception ex) { string error = ex.Message; return(null); } }
bool isStarted = false; // for pickers public FieldTimesPage(Field field) { InitializeComponent(); currentDay = DateTime.Now; mainField = field; foreach (FieldZone zone in mainField.FieldZones) { fieldZoneNames.Add(zone.FieldZoneName); } pickerFieldZones.ItemsSource = fieldZoneNames; pickerFieldZones.SelectedIndex = 0; isStarted = true; currentFieldZone = mainField.FieldZones[0]; datePickerDate.Format = " dddd, dd MMMM "; datePickerDate.MinimumDate = DateTime.Today; datePickerDate.MaximumDate = DateTime.Today.AddDays(21); datePickerDate.Date = currentDay.Date; NavigationPage navPage = App.Current.MainPage as NavigationPage; navPage.Title = mainField.FieldName; Fill(); }
public async Task <string> CancelSubscribe(int dayOfWeek, int time) { FieldZone fieldZone = App.Current.Properties["currentFieldZone"] as FieldZone; //int halfPrice = f try { //Match responseMatch = new Match(); string response; if (App.Current.Properties.ContainsKey("loggedField")) { var input = $"https://www.harbisaha.com/api/Field/CancelSubscribe?fieldZoneId=" + fieldZone.Id + "&dayOfWeek=" + dayOfWeek + "&time=" + time; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); response = JsonConvert.DeserializeObject <string>((result)); } else // düzenlenecek. { var input = $"https://www.harbisaha.com/api/Field/CancelSubscribe?fieldZoneId=" + fieldZone.Id + "&dayOfWeek=" + dayOfWeek + "&time=" + time; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); response = JsonConvert.DeserializeObject <string>((result)); } return(response); } catch (Exception ex) { string error = ex.Message; return("Başarısız"); } }
public async Task <Match> CancelDiscount(int day, int month, int year, int time) { Match responseMatch = new Match(); //Field field = App.Current.Properties["loggedField"] as Field; FieldZone fieldZone = App.Current.Properties["currentFieldZone"] as FieldZone; int normalCost = fieldZone.PaymentModel1FullCost; try { if (App.Current.Properties.ContainsKey("loggedField")) { var input = $"https://www.harbisaha.com/api/Field/CancelDiscount?fieldZoneId=" + fieldZone.Id + "&day=" + day + "&month=" + month + "&year=" + year + "&time=" + time + "&normalCost=" + normalCost;; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); responseMatch = JsonConvert.DeserializeObject <Match>((result)); } else // düzenlenecek. { var input = $"https://www.harbisaha.com/api/Field/CancelDiscount?fieldZoneId=" + fieldZone.Id + "&day=" + day + "&month=" + month + "&year=" + year + "&time=" + time + "&normalCost=" + normalCost;; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); responseMatch = JsonConvert.DeserializeObject <Match>((result)); } return(responseMatch); } catch (Exception) { return(null); } }
public async Task <Match> SetCloseToOpen(int year, int month, int day, int time) { FieldZone currentFz = Application.Current.Properties["currentFieldZone"] as FieldZone; int fieldZoneId = currentFz.Id; Match match = new Match(); if (App.Current.Properties.ContainsKey("loggedField")) { FieldZone fz = App.Current.Properties["currentFieldZone"] as FieldZone; var input = $"https://www.harbisaha.com/api/Field/TimeMakeAvailable?year=" + year + "&month=" + month + "&day=" + day + "&time=" + time + "&fieldZoneId=" + fieldZoneId + "&halfPrice=" + fz.PaymentModel1SmallCost + "&fullPrice=" + fz.PaymentModel1FullCost; //var client = await GetClient(); var client = await GetClient(); var result = await client.GetStringAsync(input); match = JsonConvert.DeserializeObject <Match>((result)); } else // düzenlenecek. { var input = $"https://www.harbisaha.com/api/Field/TimeMakeAvailable?year=" + year + "&month=" + month + "&day=" + day + "&time=" + time + "&fieldZoneId=" + fieldZoneId; //var client = await GetClient(); var client = await GetFirstClient(); var result = await client.GetStringAsync(input); match = JsonConvert.DeserializeObject <Match>((result)); } try { return(match); } catch (Exception) { return(null); } }
private async void Fill() { //allSubs.Clear(); subscribeList.Clear(); //await Navigation.PushPopupAsync(new BasePopupPage("Yükleniyor...")); allSubs = App.Current.Properties["Subscribes"] as List <Announcement>; currentFz = App.Current.Properties["currentFieldZone"] as FieldZone; pickerFieldZone.SelectedItem = currentFz.FieldZoneName; if (allSubs.Count > 0) { foreach (Announcement sub in allSubs) { if (sub.FieldZoneId == currentFz.Id) { subscribeList.Add(sub); } } } if (subscribeList == null) { lblAlertMonday.IsVisible = true; lblAlertTuesday.IsVisible = true; lblAlertWednesday.IsVisible = true; lblAlertThursday.IsVisible = true; lblAlertFriday.IsVisible = true; lblAlertSaturday.IsVisible = true; lblAlertSunday.IsVisible = true; } else { if (subscribeList.Count <= 0) { lblAlertMonday.IsVisible = true; lblAlertTuesday.IsVisible = true; lblAlertWednesday.IsVisible = true; lblAlertThursday.IsVisible = true; lblAlertFriday.IsVisible = true; lblAlertSaturday.IsVisible = true; lblAlertSunday.IsVisible = true; } else { foreach (Announcement sub in subscribeList) { switch (sub.SubscribeDayOfWeek) { case 1: viewModelsPzt.Add(new SubscribesPageViewModel() { Subscribe = sub }); break; case 2: viewModelsSali.Add(new SubscribesPageViewModel() { Subscribe = sub }); break; case 3: viewModelsCrs.Add(new SubscribesPageViewModel() { Subscribe = sub }); break; case 4: viewModelsPrs.Add(new SubscribesPageViewModel() { Subscribe = sub }); break; case 5: viewModelsCum.Add(new SubscribesPageViewModel() { Subscribe = sub }); break; case 6: viewModelsCts.Add(new SubscribesPageViewModel() { Subscribe = sub }); break; case 7: viewModelsPzr.Add(new SubscribesPageViewModel() { Subscribe = sub }); break; } } viewModelsPzt = viewModelsPzt.OrderBy(x => x.Subscribe.SubscribeMatchTime).ToList(); viewModelsSali = viewModelsSali.OrderBy(x => x.Subscribe.SubscribeMatchTime).ToList(); viewModelsCrs = viewModelsCrs.OrderBy(x => x.Subscribe.SubscribeMatchTime).ToList(); viewModelsPrs = viewModelsPrs.OrderBy(x => x.Subscribe.SubscribeMatchTime).ToList(); viewModelsCum = viewModelsCum.OrderBy(x => x.Subscribe.SubscribeMatchTime).ToList(); viewModelsCts = viewModelsCts.OrderBy(x => x.Subscribe.SubscribeMatchTime).ToList(); viewModelsPzr = viewModelsPzr.OrderBy(x => x.Subscribe.SubscribeMatchTime).ToList(); colMonday.ItemsSource = viewModelsPzt; colTuesday.ItemsSource = viewModelsSali; colWednesday.ItemsSource = viewModelsCrs; colThursday.ItemsSource = viewModelsPrs; colFriday.ItemsSource = viewModelsCum; colSaturday.ItemsSource = viewModelsCts; colSunday.ItemsSource = viewModelsPzr; //colMonday.ItemsSource = viewModelsPzt; } } if (viewModelsPzt == null || viewModelsPzt.Count <= 0) { lblAlertMonday.IsVisible = true; } if (viewModelsSali == null || viewModelsPzt.Count <= 0) { lblAlertTuesday.IsVisible = true; } if (viewModelsCrs == null || viewModelsPzt.Count <= 0) { lblAlertWednesday.IsVisible = true; } if (viewModelsPrs == null || viewModelsPzt.Count <= 0) { lblAlertThursday.IsVisible = true; } if (viewModelsCum == null || viewModelsPzt.Count <= 0) { lblAlertFriday.IsVisible = true; } if (viewModelsCts == null || viewModelsPzt.Count <= 0) { lblAlertSaturday.IsVisible = true; } if (viewModelsPzr == null || viewModelsPzt.Count <= 0) { lblAlertSunday.IsVisible = true; } if (viewModelsPzt.Count > 4) { colMonday.HeightRequest = 120; } else { colMonday.HeightRequest = 60; } if (viewModelsSali.Count > 4) { colTuesday.HeightRequest = 120; } else { colTuesday.HeightRequest = 60; } if (viewModelsCrs.Count > 4) { colWednesday.HeightRequest = 120; } else { colWednesday.HeightRequest = 60; } if (viewModelsPrs.Count > 4) { colThursday.HeightRequest = 120; } else { colThursday.HeightRequest = 60; } if (viewModelsCum.Count > 4) { colFriday.HeightRequest = 120; } else { colFriday.HeightRequest = 60; } if (viewModelsCts.Count > 4) { colSaturday.HeightRequest = 120; } else { colSaturday.HeightRequest = 60; } if (viewModelsPzr.Count > 4) { colSunday.HeightRequest = 120; } else { colSunday.HeightRequest = 60; } isChanged = true; }