コード例 #1
0
 private void newShipTapped(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(name.Text) || String.IsNullOrWhiteSpace(v.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;
         DateTime dateTime = DateTime.UtcNow;
         string   data     = dateTime.Year.ToString() + '-' + dateTime.Month.ToString() + '-' + dateTime.Day.ToString();
         app = "{\"name\":\"" + name.Text + "\",\"v\":" + v.Text + ",\"date\":\"" + data + "\"}";
         Console.WriteLine(app);
         Task <string> task = RestService.post("/ship", app);
         Console.WriteLine("\n\nbased " + task.Result);
         if (task.Result == "204")
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.OrangeRed;
             displayError.Text      = "Errore";
             displayError.IsVisible = true;
         }
         else
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.DodgerBlue;
             displayError.Text      = "ID = " + name.Text + "#" + task.Result;
             displayError.IsVisible = true;
         }
     }
 }
コード例 #2
0
ファイル: newMerch.xaml.cs プロジェクト: Rayett/clientCliente
 private void newGoodTapped(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(name.Text) || String.IsNullOrWhiteSpace(cost.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;
         app = "{\"type\":\"" + name.Text + "\",\"cost\":" + cost.Text + "}";
         Task <string> task = RestService.post("/good?id=" + Misc.id, app);
         if (task.Result == "204")
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.OrangeRed;
             displayError.Text      = "Campi non validi";
             displayError.IsVisible = true;
         }
         else
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.DodgerBlue;
             displayError.Text      = "Merce aggiunta";
             displayError.IsVisible = true;
             name.Text = "";
             cost.Text = "";
         }
     }
 }
コード例 #3
0
 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           = "";
         }
     }
 }
コード例 #4
0
 private void newCamionTapped(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(targa.Text) || String.IsNullOrWhiteSpace(marca.Text) || String.IsNullOrWhiteSpace(modello.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;
         DateTime dateTime = DateTime.UtcNow;
         string   data     = dateTime.Year.ToString() + '-' + dateTime.Month.ToString() + '-' + dateTime.Day.ToString() + ' ' + dateTime.Hour.ToString() + ':' + dateTime.Minute.ToString() + ':' + dateTime.Second.ToString();
         app = "{\"plate\":\"" + targa.Text + "\",\"brand\":\"" + marca.Text + "\",\"model\":\"" + modello.Text + "\",\"idDriver\":" + Misc.id + ",\"date\":\"" + data + "\"}";
         Console.WriteLine(app);
         Task <string> task = RestService.post("/viaggio_camion", app);
         if (task.Result == "err 204")
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.Text      = "Camion non registrato";
             displayError.IsVisible = true;
         }
         else
         {
             Navigation.PushAsync(new completePack(Convert.ToInt32(task.Result)));
         }
     }
 }
コード例 #5
0
 private void setDestinationTapped(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(state.Text) || String.IsNullOrWhiteSpace(city.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;
         app = "{\"state\":\"" + state.Text + "\",\"city\":\"" + city.Text + "\"}";
         Task <string> task = RestService.post("/setPackStart?id=" + idpacco, app);
         if (task.Result == "err 204")
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.OrangeRed;
             displayError.Text      = "Porto non valido";
             displayError.IsVisible = true;
         }
         else
         {
             Navigation.PopAsync();
         }
     }
 }
コード例 #6
0
        private void newPackTapped(object sender, EventArgs e)
        {
            string app;

            if (state.SelectedIndex < 0 || city.SelectedIndex < 0)
            {
                displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
                displayError.Text      = "Compilare i campi";
                displayError.IsVisible = true;
            }
            else
            {
                app = "{\"idGood\":" + idGood + ",\"quantity\":" + quantity.Text + ",\"idP\":" + ports[city.SelectedIndex].idP + "}";
                Task <string> task = RestService.post("/pack?id=" + Misc.id, app);
                Navigation.PopAsync();
            }
        }
コード例 #7
0
 private void AggiungiPaccoTapped(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
     {
         displayError.IsVisible = false;
         int  i;
         bool flag = false;
         for (i = 0; i < PacksInPort.Count; i++)
         {
             if (PacksInPort[i].idpacco == Convert.ToInt32(idPacco.Text))
             {
                 flag = true;
             }
         }
         if (flag == false)
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.OrangeRed;
             displayError.Text      = "Pacco non in porto";
             displayError.IsVisible = true;
         }
         else
         {
             string app;
             app = "{\"idTrip\":" + idViaggio + ",\"idPack\":" + idPacco.Text + "}";
             Task <string> task = RestService.post("/viaggio_pacco", app);
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.DodgerBlue;
             displayError.Text      = "Pacco aggiunto";
             displayError.IsVisible = true;
             idPacco.Text           = "";
         }
     }
 }
コード例 #8
0
ファイル: signUp.xaml.cs プロジェクト: Rayett/clientCliente
        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;
                }
            }
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 private void newCamionTapped(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(targa.Text) || String.IsNullOrWhiteSpace(marca.Text) || String.IsNullOrWhiteSpace(modello.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;
         app = "{\"plate\":\"" + targa.Text + "\",\"brand\":\"" + marca.Text + "\",\"model\":\"" + modello.Text + "\"}";
         Console.WriteLine(app);
         Task <string> task = RestService.post("/camion", app);
         Console.WriteLine("\n\nbased " + task.Result);
         displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
         displayError.TextColor = Color.DodgerBlue;
         displayError.Text      = "Camion registrato";
         displayError.IsVisible = true;
     }
 }
コード例 #11
0
 private void completeTripTapped(object sender, EventArgs e)
 {
     if (String.IsNullOrWhiteSpace(idNave.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
     {
         displayError.IsVisible = false;
         string app;
         string idShip;
         idShip = idNave.Text.Substring(idNave.Text.IndexOf("#") + 1);
         DateTime dateTime = DateTime.UtcNow;
         string   data     = dateTime.Year.ToString() + '-' + dateTime.Month.ToString() + '-' + dateTime.Day.ToString() + ' ' + dateTime.Hour.ToString() + ':' + dateTime.Minute.ToString() + ':' + dateTime.Second.ToString();
         app = "{\"idP\":" + Operator.idPorto + ",\"idShip\":" + idShip + ",\"date\":\"" + data + "\"}";
         Task <string> task = RestService.post("/completeViaggio", app);
         if (task.Result == "err 204")
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.OrangeRed;
             displayError.Text      = "Nave non valida";
             displayError.IsVisible = true;
         }
         else
         {
             displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
             displayError.TextColor = Color.DodgerBlue;
             displayError.Text      = "Viaggio aggiornato";
             displayError.IsVisible = true;
             idNave.Text            = "";
         }
     }
 }
コード例 #12
0
        private void newAccountTapped(object sender, EventArgs e)
        {
            string app;

            if (user.SelectedIndex == 0)
            {
                if (String.IsNullOrWhiteSpace(nome.Text) || String.IsNullOrWhiteSpace(password.Text))
                {
                    displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
                    displayError.Text      = "Compilare i campi";
                    displayError.IsVisible = true;
                }
                else
                {
                    app = "{\"name\":\"" + nome.Text + "\",\"password\":\"" + Misc.MD5Hash(password.Text) + "\"}";
                    Task <string> task = RestService.post("/signup?type=fornitore", app);
                    displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
                    displayError.TextColor = Color.DodgerBlue;
                    displayError.Text      = "Fornitore aggiunto";
                    displayError.IsVisible = true;
                    nome.Text = "";
                }
            }

            if (user.SelectedIndex == 1)
            {
                if (String.IsNullOrWhiteSpace(nome.Text) || String.IsNullOrWhiteSpace(password.Text) || state.SelectedIndex < 0 || city.SelectedIndex < 0)
                {
                    displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
                    displayError.Text      = "Compilare i campi";
                    displayError.IsVisible = true;
                }
                else
                {
                    app = "{\"name\":\"" + nome.Text + "\",\"surname\":\"" + cognome.Text + "\",\"password\":\"" + Misc.MD5Hash(password.Text) + "\",\"idP\":" + ports[city.SelectedIndex].idP + "}";
                    Task <string> task = RestService.post("/signup?type=operatore", app);
                    displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
                    displayError.TextColor = Color.DodgerBlue;
                    displayError.Text      = "Operatore aggiunto";
                    displayError.IsVisible = true;
                    nome.Text = "";
                }
            }
            else
            {
                if (String.IsNullOrWhiteSpace(nome.Text) || String.IsNullOrWhiteSpace(cognome.Text) || String.IsNullOrWhiteSpace(password.Text))
                {
                    displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
                    displayError.Text      = "Compilare i campi";
                    displayError.IsVisible = true;
                }
                else
                {
                    app = "{\"name\":\"" + nome.Text + "\",\"surname\":\"" + cognome.Text + "\",\"password\":\"" + Misc.MD5Hash(password.Text) + "\"}";
                    Task <string> task = RestService.post("/signup?type=autista", app);
                    displayError.Margin    = new Thickness((width - 300) / 2, 70, (width - 300) / 2, 0);
                    displayError.TextColor = Color.DodgerBlue;
                    displayError.Text      = "Autotraportatore aggiunto";
                    displayError.IsVisible = true;
                    nome.Text = "";
                }
            }
        }