private void newShipTriptapped(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(state.Text) || String.IsNullOrWhiteSpace(city.Text) || String.IsNullOrWhiteSpace(direttrice.Text)) { displayError.Margin = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0); displayError.Text = "Compilare i campi"; displayError.IsVisible = true; } else { string app; displayError.IsVisible = false; Task <string> task = RestService.get("/route?idStart=" + Operator.idPorto + "&state=" + state.Text + "&city=" + city.Text); if (task.Result == "err 204") { displayError.Margin = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0); displayError.Text = "Porto non esistente"; displayError.IsVisible = true; } else { Navigation.PushAsync(new PacksOnShip(idShip, Convert.ToInt32(task.Result), direttrice.Text)); } } }
private void logInTapped(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(nome.Text) || String.IsNullOrWhiteSpace(password.Text)) { displayError.Margin = new Thickness((width - 200) / 2, 20, (width - 200) / 2, 0); displayError.Text = "Compilare i campi"; displayError.IsVisible = true; } else { string app; displayError.IsVisible = false; Task <string> task = RestService.get("/login?type=fornitore&name=" + nome.Text + "&password="******"\n\nbased " + task.Result); if (task.Result == "err 204") { displayError.Margin = new Thickness((width - 200) / 2, 20, (width - 200) / 2, 0); displayError.Text = "Credenziali sbagliate"; displayError.IsVisible = true; } else { Misc.id = Convert.ToInt32(task.Result); Console.WriteLine("id = " + Misc.id); Navigation.PushAsync(new mainFornitore()); } } }
public mainOperatore() { InitializeComponent(); Task <string> task = RestService.get("/portoByOp?idpacco=" + Misc.id); Operator.idPorto = Convert.ToInt32(task.Result); }
private void ritiraPaccoTapped(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(idPacco.Text)) { displayError.Margin = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0); displayError.TextColor = Color.OrangeRed; displayError.Text = "Compilare i campi"; displayError.IsVisible = true; } else { string app; displayError.IsVisible = false; Task <string> task = RestService.get("/packExist?idpacco=" + idPacco.Text); if (task.Result == "err 204") { displayError.Margin = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0); displayError.TextColor = Color.OrangeRed; displayError.Text = "Pacco non valido"; displayError.IsVisible = true; } else { app = "{\"idTrip\":" + idVC + ",\"idPack\":" + idPacco.Text + "}"; task = RestService.post("/completePack", app); displayError.Margin = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0); displayError.TextColor = Color.DodgerBlue; displayError.Text = "Pacco aggiornato"; displayError.IsVisible = true; idPacco.Text = ""; } } }
public void Create() { int i = 0; string app = "/shipInPort?idP=" + Operator.idPorto; Task <string> task = RestService.get(app); Ships = JsonConvert.DeserializeObject <List <Ship> >(task.Result); Button button; foreach (Ship item in Ships) { button = new Button { Text = Ships[i].nome + "#" + Ships[i].idnave, WidthRequest = 230, Margin = new Thickness(100, 20, 100, 0), TextColor = Color.White, BackgroundColor = Color.FromHex("#FF6262"), BorderColor = Color.Black, CornerRadius = 23, FontSize = 20, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, HeightRequest = 60, }; buttons.Add(button); button.Clicked += suff; ShipsInPort.Children.Add(button); i++; } }
private void stateChanged(object sender, EventArgs e) { Task <string> task = RestService.get("/portListByState?state=" + state.Items[state.SelectedIndex]); ports = JsonConvert.DeserializeObject <List <Port> >(task.Result); List <string> l = new List <string>(); foreach (Port S in ports) { l.Add(S.citta); } city.ItemsSource = l; }
public newAccount() { InitializeComponent(); width = Application.Current.MainPage.Width; Task <string> task = RestService.get("/stateList"); states = JsonConvert.DeserializeObject <List <State> >(task.Result); List <string> l = new List <string>(); foreach (State S in states) { l.Add(S.stato); } state.ItemsSource = l; }
public void Create() { int i = 0; string app = "/pendingPacks?id=" + Misc.id; Task <string> task = RestService.get(app); PPacks = JsonConvert.DeserializeObject <List <PendingPack> >(task.Result); Label label; Button button; RowDefinition rowDef = new RowDefinition(); foreach (PendingPack item in PPacks) { mainGridLayout.RowDefinitions.Add(rowDef); label = new Label { Text = PPacks[i].tipo + " x " + PPacks[i].peso, Margin = new Thickness(20, 10, 0, 0), TextColor = Color.White, FontSize = 20, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; button = new Button { Text = "CONFERMA", Margin = new Thickness(0, 10, 20, 0), TextColor = Color.White, BackgroundColor = Color.FromHex("#FF6262"), BorderColor = Color.Black, CornerRadius = 10, FontSize = 15, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.End, HeightRequest = 37, }; buttons.Add(button); button.Clicked += suff; mainGridLayout.Children.Add(label, 0, i); mainGridLayout.Children.Add(button, 1, i); i++; } }
private void signUpTapped(object sender, EventArgs e) { if (String.IsNullOrWhiteSpace(nome.Text) || String.IsNullOrWhiteSpace(password.Text) || String.IsNullOrWhiteSpace(cognome.Text) || String.IsNullOrWhiteSpace(RipPassword.Text)) { displayError.Margin = new Thickness((width - 300) / 2, 10, (width - 300) / 2, 0); displayError.Text = "Compilare i campi"; displayError.IsVisible = true; } else { string app; displayError.IsVisible = false; if (password.Text == RipPassword.Text) { app = "{\"name\":\"" + nome.Text + "\",\"surname\":\"" + cognome.Text + "\",\"password\":\"" + Misc.MD5Hash(password.Text) + "\"}"; Task <string> task = RestService.post("/signup?type=cliente", app); Console.WriteLine("\n\nbased " + task.Result); if (task.Result == "err 204") { displayError.Margin = new Thickness((width - 300) / 2, 10, (width - 300) / 2, 0); displayError.Text = "Utente già esistente"; displayError.IsVisible = true; } else { task = RestService.get("/login?type=cliente&name=" + nome.Text + "&surname=" + cognome.Text + "&password="******"id = " + Misc.id); Navigation.PushAsync(new mainCliente()); } } else { displayError.Margin = new Thickness((width - 300) / 2, 10, (width - 300) / 2, 0); displayError.Text = "Campi password diversi"; displayError.IsVisible = true; } } }
public PacksOnShip(int idShip, int idRoute, string direttrice) { string app; InitializeComponent(); this.idShip = idShip; this.idRoute = idRoute; this.direttrice = direttrice; width = Application.Current.MainPage.Width; PacksInPort = new List <idPack>(); DateTime dateTime = DateTime.UtcNow; Task <string> task = RestService.get("/packsInPort?idP=" + Operator.idPorto); PacksInPort = JsonConvert.DeserializeObject <List <idPack> >(task.Result); string data = dateTime.Year.ToString() + '-' + dateTime.Month.ToString() + '-' + dateTime.Day.ToString() + ' ' + dateTime.Hour.ToString() + ':' + dateTime.Minute.ToString() + ':' + dateTime.Second.ToString(); app = "{\"idShip\":" + idShip + ",\"idRoute\":" + idRoute + ",\"direttrice\":\"" + direttrice + "\",\"date\":\"" + data + "\"}"; Console.WriteLine(app); task = RestService.post("/viaggio", app); idViaggio = Convert.ToInt32(task.Result); Console.WriteLine("idViaggio = " + idViaggio); }
public void Create() { int i = 0; string app = "/notSentPacks?id=" + Misc.id; Task <string> task = RestService.get(app); orders = JsonConvert.DeserializeObject <List <Order> >(task.Result); app = "/sentPacks?id=" + Misc.id; task = RestService.get(app); Console.WriteLine(task); orders.AddRange(JsonConvert.DeserializeObject <List <Order> >(task.Result)); app = "/ritiredPacks?id=" + Misc.id; task = RestService.get(app); orders.AddRange(JsonConvert.DeserializeObject <List <Order> >(task.Result)); Label l1, l2, l3, l4; RowDefinition rowDef = new RowDefinition(); foreach (Order item in orders) { mainGridLayout.RowDefinitions.Add(rowDef); l1 = new Label { Text = item.tipo + " x " + item.peso, Margin = new Thickness(20, 20, 0, 0), TextColor = Color.White, FontSize = 20, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; if (item.FKPortoStart == -1) { l2 = new Label { Text = "In attesa", Margin = new Thickness(40, 20, 0, 0), TextColor = Color.Red, FontSize = 20, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; } else if (item.FKViaggioCamion == -1) { l2 = new Label { Text = "In transito", Margin = new Thickness(40, 20, 0, 0), TextColor = Color.Orange, FontSize = 20, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; } else { l2 = new Label { Text = "Ritirato", Margin = new Thickness(40, 20, 0, 0), TextColor = Color.LightGreen, FontSize = 20, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; } mainGridLayout.Children.Add(l1, 0, i); mainGridLayout.Children.Add(l2, 1, i); i++; mainGridLayout.RowDefinitions.Add(rowDef); if (item.FKPortoStart == -1) { var d = DateTime.Parse(item.dataAcq); l3 = new Label { Text = "Acquistato: " + d.ToString("dd-MM-yy"), Margin = new Thickness(40, -10, 0, 0), TextColor = Color.White, FontSize = 18, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; } else if (item.FKViaggioCamion == -1) { var d = DateTime.Parse(item.dataAcq); int temp = (int)Math.Ceiling((double)item.tempoSt / 24); d = d.AddDays(temp); l3 = new Label { Text = "Stimato: " + d.ToString("dd-MM-yy"), Margin = new Thickness(40, -10, 0, 0), TextColor = Color.White, FontSize = 18, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; } else { var d = DateTime.Parse(item.data); l3 = new Label { Text = "Ritirato: " + d.ToString("dd-MM-yy"), Margin = new Thickness(40, -10, 0, 0), TextColor = Color.White, FontSize = 18, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; } mainGridLayout.Children.Add(l3, 1, i); if (item.stato != null) { l4 = new Label { Text = "Da: " + item.stato + ", " + item.citta, Margin = new Thickness(20, -10, 0, 0), TextColor = Color.White, FontSize = 18, VerticalTextAlignment = TextAlignment.Center, HorizontalTextAlignment = TextAlignment.Start, }; mainGridLayout.Children.Add(l4, 0, i); } i++; } }