Esempio n. 1
0
    private void qrScanFinished(string dataText)
    {
        ok = 1;
        string codLocale;

        if (CheckURLValid(dataText))
        {
            if (dataText.Contains("streetshot"))
            {
                Uri myUri = new Uri(dataText);
                codLocale = ParseQueryString(myUri.Query).Get("Identify");
                string seat = ParseQueryString(myUri.Query).Get("Tav");
                Locali lc   = Locali.Load("https://safemenu.altervista.org/wp-content/" + codLocale + "/Locali.xml");
                ContentCreator.urlLocali = "https://safemenu.altervista.org/wp-content/" + codLocale + "/Locali.xml";
                foreach (Locale locale in lc.CollezioneLocali)
                {
                    ok = string.Compare(locale.s_ShortName, codLocale);
                    if (ok == 0)
                    {
                        ContentCreator.Restaurant = codLocale;
                        ContentCreator.seat       = seat;

                        ContentCreator.Db = 0;

                        LoadingPanel.gameObject.SetActive(true);
                        if (NaturalOrientation.tablet == false)
                        {
                            SceneManager.LoadSceneAsync("Menu");

                            break;
                        }
                        else
                        {
                            SceneManager.LoadSceneAsync("Menu_Tablet");

                            break;
                        }
                    }
                }
            }
            else
            {
                Uri      myUri  = new Uri(dataText);
                string   param1 = ParseQueryString(myUri.Query).Get("Identify");
                string   param2 = ParseQueryString(myUri.Query).Get("pos");
                string   param3 = ParseQueryString(myUri.Query).Get("store");
                string[] result = param1.Split(' ');
                try
                {
                    ContentCreator.Utenza     = result[1];
                    ContentCreator.Restaurant = result[0];
                }
                catch
                {
                    ContentCreator.Utenza     = "";
                    ContentCreator.Restaurant = param1; //Punto vendita
                }
                try
                {
                    result = param2.Split(' ');
                    ContentCreator.seat = result[1];
                    ContentCreator.sala = result[0];
                }
                catch
                {
                    ContentCreator.sala = "";
                    ContentCreator.seat = param2;
                }
                if (param3 != null)
                {
                    int.TryParse(param3, out ContentCreator.daysToStore);
                }
                ContentCreator.urlLocali = dataText;
                ContentCreator.Db        = 1;
                ok = 0;
                LoadingPanel.gameObject.SetActive(true);
                if (NaturalOrientation.tablet == false)
                {
                    SceneManager.LoadSceneAsync("Menu");

                    return;
                }
                else
                {
                    SceneManager.LoadSceneAsync("Menu_Tablet");

                    return;
                }
            }
        }
        else
        {
            try
            {
                CoordinateLocaliQR coordQR = JsonConvert.DeserializeObject <CoordinateLocaliQR>(dataText);
                try
                {
                    ContentCreator.Utenza = coordQR.Utenza;
                }
                catch
                {
                }
                try
                {
                    ContentCreator.Restaurant = coordQR.Ristorante;
                }
                catch
                {
                }
                try
                {
                    ContentCreator.sala = coordQR.Sala;
                }
                catch
                {
                }
                try
                {
                    ContentCreator.seat = coordQR.Tavolo;
                }
                catch
                {
                }
                try
                {
                    ContentCreator.Db = coordQR.Db;
                }
                catch
                {
                }
                try
                {
                    ContentCreator.daysToStore = coordQR.Scadenza;
                }
                catch
                {
                }
                Locali lc = Locali.Load("https://safemenu.altervista.org/wp-content/" + ContentCreator.Restaurant + "/Locali.xml");
                ContentCreator.urlLocali = "https://safemenu.altervista.org/wp-content/" + ContentCreator.Restaurant + "/Locali.xml";
                foreach (Locale locale in lc.CollezioneLocali)
                {
                    ok = string.Compare(locale.s_ShortName, ContentCreator.Restaurant);
                    if (ok == 0)
                    {
                        LoadingPanel.gameObject.SetActive(true);
                        if (NaturalOrientation.tablet == false)
                        {
                            SceneManager.LoadSceneAsync("Menu");

                            break;
                        }
                        else
                        {
                            SceneManager.LoadSceneAsync("Menu_Tablet");

                            break;
                        }
                    }
                }
            }
            catch
            {
                try
                {
                    string[] result = dataText.Split(' ');

                    codLocale = result[0];

                    Locali lc = Locali.Load("https://safemenu.altervista.org/wp-content/" + codLocale + "/Locali.xml");
                    ContentCreator.urlLocali = "https://safemenu.altervista.org/wp-content/" + codLocale + "/Locali.xml";
                    foreach (Locale locale in lc.CollezioneLocali)
                    {
                        ok = string.Compare(locale.s_ShortName, codLocale);
                        if (ok == 0)
                        {
                            ContentCreator.Restaurant = result[0];
                            ContentCreator.seat       = result[1];
                            if (result.Length > 2)
                            {
                                int Dbn;
                                int.TryParse(result[2], out Dbn);
                                ContentCreator.Db = Dbn;
                            }
                            else
                            {
                                ContentCreator.Db = 0;
                            }
                            LoadingPanel.gameObject.SetActive(true);
                            if (NaturalOrientation.tablet == false)
                            {
                                SceneManager.LoadSceneAsync("Menu");

                                break;
                            }
                            else
                            {
                                SceneManager.LoadSceneAsync("Menu_Tablet");

                                break;
                            }
                        }
                    }
                }
                catch
                {
                }
            }
        }
        if (ok != 0)
        {
            this.UiText.text = m_errore;
        }
        if (this.resetBtn != null)
        {
            this.resetBtn.SetActive(true);
        }
        if (this.scanLineObj != null)
        {
            this.scanLineObj.SetActive(false);
        }
    }
Esempio n. 2
0
    public void OnLocaleClick(int id, string Utenza, string Restaurant, string Sala, string Seat, int Db)
    {
        ContentCreator.loadFromCache = true;
        try
        {
            ContentCreator.Utenza = Utenza;
        }
        catch
        {
        }
        try
        {
            ContentCreator.Restaurant = Restaurant;
        }
        catch
        {
        }
        try
        {
            ContentCreator.sala = Sala;
        }
        catch
        {
        }
        try
        {
            ContentCreator.seat = Seat;
        }
        catch
        {
        }
        try
        {
            ContentCreator.Db = Db;
        }
        catch
        {
        }
        if (Db == 0)
        {
            try {
                int    ok = 1;
                Locali lc = Locali.Load("https://safemenu.altervista.org/wp-content/" + ContentCreator.Restaurant + "/Locali.xml");
                ContentCreator.urlLocali = "https://safemenu.altervista.org/wp-content/" + ContentCreator.Restaurant + "/Locali.xml";
                foreach (Locale locale in lc.CollezioneLocali)
                {
                    ok = string.Compare(locale.s_ShortName, ContentCreator.Restaurant);
                    if (ok == 0)
                    {
                        if (NaturalOrientation.tablet == false)
                        {
                            LoadingWindow.SetActive(true);
                            SceneManager.LoadSceneAsync("Menu");

                            break;
                        }
                        else
                        {
                            LoadingWindow.SetActive(true);
                            SceneManager.LoadSceneAsync("Menu_Tablet");

                            break;
                        }
                    }
                }
            }
            catch
            {
            }
        }
        if (Db == 1)
        {
            if (Utenza != null)
            {
                ContentCreator.urlLocali = "https://gccloud.software-solution.it/BookingPlatform/Identify.aspx?Identify=" + Restaurant + " " + Utenza;
            }
            else
            {
                ContentCreator.urlLocali = "https://gccloud.software-solution.it/BookingPlatform/Identify.aspx?Identify=" + Restaurant;
            }
            if (NaturalOrientation.tablet == false)
            {
                LoadingWindow.SetActive(true);
                SceneManager.LoadSceneAsync("Menu");

                return;
            }
            else
            {
                LoadingWindow.SetActive(true);
                SceneManager.LoadSceneAsync("Menu_Tablet");

                return;
            }
        }
    }
Esempio n. 3
0
    void Start()
    {
        DataService C = new DataService("DatiCliente.db");

        if (false)
        {
            ContentCreator.ClienteRegistrato = C.CheckDatiCliente();
            if (ContentCreator.ClienteRegistrato)
            {
                ContentCreator.ClienteTKy    = C.GetTipoDati();
                ContentCreator.ClienteRegMin = C.GetRegMin();
                IEnumerable <DatiCliente> Dci = C.GetDatiCliente();
                foreach (DatiCliente D in Dci)
                {
                    if (D.Id == 1)
                    {
                        ContentCreator.datiCliente.Nome      = D.Nome;
                        ContentCreator.datiCliente.Cognome   = D.Cognome;
                        ContentCreator.datiCliente.Tel       = D.Tel;
                        ContentCreator.datiCliente.Email     = D.Email;
                        ContentCreator.datiCliente.Indirizzo = D.Indirizzo;
                        ContentCreator.datiCliente.Citta     = D.Citta;
                        ContentCreator.datiCliente.CAP       = D.CAP;
                    }
                }
            }
        }



        //Update();
        if ((seat == "" && sala == "") || (seat == "X" || sala == "X") || (seat == null && sala == null))
        {
            SelectionPanel.gameObject.SetActive(true);
        }
        if (Db == 0)
        {
            //loadtext.text = ("Db= " + Db + "Utenza =" + Utenza + "Restaurant =" + Restaurant);
            if (urlLocali == null)
            {
                urlLocali  = "https://safemenu.altervista.org/wp-content/MolRa/Locale.xml";
                Restaurant = "MolRa";
                seat       = "T0";
                Db         = 0;
            }
            Locali lc = Locali.Load(urlLocali);
            foreach (Locale locale in lc.CollezioneLocali)
            {
                NomeLocaleLong = locale.s_nomeLocale;
                hideTotal      = locale.s_HideTotal;
                if (hideTotal)
                {
                    Color col = new Color(0, 0, 0, 0);
                    Comanda.C5.Totale.color      = col;
                    Comanda.C5.text_Totale.color = col;
                }
                else
                {
                    Color col = new Color(0, 0, 0, 1);
                    Comanda.C5.Totale.color      = col;
                    Comanda.C5.text_Totale.color = col;
                }
                ColorController.ColoreSfondi   = hexToColor(locale.s_ColorTheme);
                ColorController.ColoreRiquadri = hexToColor(locale.s_ColorFrame);
                print(locale.s_Landing);
                print(locale.s_ShortName);
                print(locale.s_Base);
                if (locale.s_ShortName == Restaurant)
                {
                    welcome.text = locale.s_Landing;
                    //Key = "AaK1Dsz3z2xqhYs2JaHOXQpxUxxdO3ZYihg0IuebKVxUwU2xh4vS0BThdSz4rG4uSi-QU6gMXFy_QsNE";// locale.s_CID;
                    //secret = "EBjXni131N_Ci2795OXE2qc11ndEncytbujnbHTK2Ez4o9HszD0ra2Rw8F_O03pluGxYWiZ46jwwsYiY"; // locale.s_SKE;
                    Key     = locale.s_CID;
                    secret  = locale.s_SKE;
                    consInt = locale.s_consegnaInterna;
                    Tky     = locale.s_TakeAway;
                    Dlv     = locale.s_Delivery;
                    Base    = locale.s_Base;
                    bool MD = locale.s_EnableMD;
                    SelectionBtnRoot.transform.GetChild(0).gameObject.SetActive(MD);
                    SelectionBtnRoot.transform.GetChild(1).gameObject.SetActive(Base);
                    SelectionBtnRoot.transform.GetChild(2).gameObject.SetActive(Tky);
                    SelectionBtnRoot.transform.GetChild(3).gameObject.SetActive(Dlv);
                    SelectionBtnRoot.transform.GetChild(4).gameObject.SetActive(consInt);
                    if (seat == "Tky" || seat == "Dlv")
                    {
                        welcome.text  = locale.s_LandingGen;
                        CodeUniversal = true;
                        Comanda.C5.Invia_Button_Text.text = "Vai al pagamento";
                        Comanda.C5.ComandaText.text       = "procedere con il pagamento?";
                        Comanda.Pay = true;
                        currentMode = seat;
                    }
                }
            }



            const string glyphs     = "abcdefghijklmnopqrstuvwxyz0123456789"; //add the characters you want
            int          charAmount = UnityEngine.Random.Range(8, 12);        //set those to the minimum and maximum length of your string
            for (int i = 0; i < charAmount; i++)
            {
                myString += glyphs[UnityEngine.Random.Range(0, glyphs.Length)];
            }
            token     = myString;
            myString += "GKtsh!hdisa's^nlaoek";
            md5       = GetHash(myString);
            if (Restaurant != null)
            {
                urlMenu = preUrl1 + Restaurant + "/Menu4.json";
                //urlMenu = preUrl + Restaurant + "&token="+token+"&md5="+md5;
                LogoData = new c_Data()
                {
                    imageUrl        = preUrl1 + Restaurant + "/Logo.png",
                    imageDimensions = new Vector2(643f, 227f)
                };
            }
            else
            {
                urlMenu  = "https://aruba.streetshot.it/pinapp/get.php?item=MolRa.menu.json&token=k6dduaqb1&md5=039e8a640a0d15b99641b7e3a2e08340";
                LogoData = new c_Data()
                {
                    imageUrl        = "https://aruba.streetshot.it/pinapp/get.php?item=MolRa.Logo.png&token=k6dduaqb1&md5=039e8a640a0d15b99641b7e3a2e08340",
                    imageDimensions = new Vector2(643f, 227f)
                };
            }
            SetData(LogoData);
            //ColorController.CController.CambiaColori();
            menu = Menu_Ristorante.LoadMenu(urlMenu, Db);
            Loader.gameObject.SetActive(false);
            if (!loadFromCache)
            {
                AggiungiLocale();
            }
        }
        else if (Db == 1)
        {
            //menuSS = CallWebService.LoadSSMenu(Utenza, Restaurant);
            CallWebService.LoadSSMenu(Restaurant, Utenza);
        }
    }