Ejemplo n.º 1
0
        public void GetDatas(string dates)
        {
            string message_to_send = "getbevetelN" + dates;
            string response        = Server_connection.GetInstance().SendMessageToServer(message_to_send, true);

            List <int> napibe = new List <int>();

            if (response == "NoData")
            {
                MessageBox.Show("There were no transactions on these days");
            }
            else if (response != "Error")
            {
                response = response.Remove(response.Length - 1);
                string datesgive = "";
                foreach (var item in response.Split('?'))
                {
                    napibe.Add(Convert.ToInt32(item.Split(';')[1]));
                    datesgive += item.Split(';')[0] + ";";
                }

                datesgive = datesgive.Substring(0, (datesgive.Length - 1));
                SeriesAddN(napibe, datesgive);

                this.Show();
            }
            else
            {
                MessageBox.Show("Something went wrond! Please try again!");
                PickDate pd = new PickDate();
                pd.Show();
            }
        }
Ejemplo n.º 2
0
        public void Bejelentkezes()
        {
            string message_to_send = "loginrestaurante" + ";" + 1 + ";" + etterem_nev + ";" + Password.Text;

            MessageBox.Show(etterem_nev);
            try
            {
                string response = Server_connection.GetInstance().SendMessageToServer(message_to_send, true);
                if (response == "accepted")
                {
                    MessageBox.Show(UserData.GetInstance().Database_ID.ToString());
                    FoMenu fm = new FoMenu();
                    fm.Show();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Wrong datas");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Failed");
            }
        }
Ejemplo n.º 3
0
 public static Server_connection GetInstance()
 {
     if (instance == null)
     {
         instance = new Server_connection();
     }
     return(instance);
 }
Ejemplo n.º 4
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string response = Server_connection.GetInstance().SendMessageToServer("asd;asd");

            MainWindow m = new MainWindow();

            m.Show();
            this.Close();
        }
Ejemplo n.º 5
0
        public void NewButton()
        {
            etterem.Clear();
            try
            {
                string message      = "Buttoncont";
                string message_back = Server_connection.GetInstance().SendMessageToServer(message, true);

                if (message_back != "failed")
                {
                    message_back = message_back.Remove(message_back.Length - 1);
                    foreach (var item in message_back.Split('?'))
                    {
                        etterem.Add(item.Split(';')[0], item.Split(';')[1]);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Server Error");
            }
            Thickness margin = new Thickness();

            margin.Left   = 5;
            margin.Bottom = 5;
            margin.Right  = 5;
            margin.Top    = 5;

            for (int i = 0; i < etterem.Count; i++)
            {
                Button button = new Button()
                {
                    Name    = string.Format(etterem.ElementAt(i).Key),
                    Margin  = margin,
                    Content = new Image
                    {
                        Source            = new BitmapImage(new Uri(etterem.ElementAt(i).Value)),
                        Stretch           = Stretch.Fill,
                        VerticalAlignment = VerticalAlignment.Center,
                    }
                };

                if (i < 7)
                {
                    Grid.SetRow(button, 3);
                    Grid.SetColumn(button, i + 1);
                }
                else
                {
                    Grid.SetRow(button, 4);
                    Grid.SetColumn(button, i - 5);
                }

                button.Click += new RoutedEventHandler(Login_Click);
                this.grid.Children.Add(button);
            }
        }
Ejemplo n.º 6
0
        private void Reg_Click(object sender, RoutedEventArgs e)
        {
            string message      = "regR;" + Enev.Text + ";" + Ecim.Text + ";" + Email.Text + ";" + Etel.Text + ";" + Ejel.Text + ";" + "https://szoftbead.000webhostapp.com/etteremicon/" + filename;
            string message_back = Server_connection.GetInstance().SendMessageToServer(message, true);

            if (message_back == "OK")
            {
                MessageBox.Show("Regisztrálás sikerült");
                MainWindow mw = new MainWindow();
                mw.NewButton();
                mw.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Adatbázis hiba");
                this.Close();
            }
        }
Ejemplo n.º 7
0
        private void NewFood_Click(object sender, RoutedEventArgs e)
        {
            string message      = "nfood;" + Etel_nev.Text + ";" + Etel_ar.Text + ";" + Elk_ido.Text + ";" + "https://szoftbead.000webhostapp.com/etteremicon/" + UserData.GetInstance().Name + filename;
            string message_back = Server_connection.GetInstance().SendMessageToServer(message, true);

            if (message_back == "OK")
            {
                MessageBox.Show("Ételfelvétes sikeresen megtörtént");
                MainWindow mw = new MainWindow();
                mw.NewButton();
                mw.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show("Adatbázis hiba");
                this.Close();
            }
        }
Ejemplo n.º 8
0
        public void GetDatas()
        {
            string message_to_send = "getbevetelH";
            string response        = Server_connection.GetInstance().SendMessageToServer(message_to_send, true);

            int[] havibe = new int[12];
            for (int i = 0; i < havibe.Length; i++)
            {
                havibe[i] = 0;
            }
            if (response != "Error")
            {
                response = response.Remove(response.Length - 1);
                foreach (var item in response.Split('?'))
                {
                    havibe[Convert.ToInt32(item.Split(';')[0]) - 1] = Convert.ToInt32(item.Split(';')[1]);
                }

                SeriesCollection = new SeriesCollection
                {
                    new ColumnSeries
                    {
                        Title  = "Series 1",
                        Values = new ChartValues <int>(havibe)
                    }
                };
                this.Show();
            }
            else
            {
                MessageBox.Show("Something went wrond! Please try again!");
            }


            Labels    = new[] { "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sep", "Okt", "Nov", "Dec" };
            Formatter = value => value.ToString("");

            DataContext = this;
        }