Exemple #1
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            string message_back = "";

            if (UserData.GetInstance().Availability)
            {
                message_back = Server_connection.GetInstance().SendMessageToServer("setactive;0;" + UserData.GetInstance().Database_ID, true);
            }
            else
            {
                message_back = Server_connection.GetInstance().SendMessageToServer("setactive;1;" + UserData.GetInstance().Database_ID, true);
            }

            if (message_back == "OK" && UserData.GetInstance().Availability)
            {
                elerhetoseg.Background = Brushes.Red;
                UserData.GetInstance().Availability = false;
                return;
            }
            if (message_back == "OK" && !UserData.GetInstance().Availability)
            {
                elerhetoseg.Background = Brushes.Green;
                UserData.GetInstance().Availability = true;
                return;
            }

            MessageBox.Show("Hiba");
            this.Close();
        }
Exemple #2
0
        public void GetDatas(string dates)
        {
            string message_to_send = "getbevetelNC" + dates + ";" + UserData.GetInstance().Database_ID;
            string response        = Server_connection.GetInstance().SendMessageToServer(message_to_send, true);

            MessageBox.Show(response);
            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();
            }
        }
Exemple #3
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            // ask server to save this ip adress
            // send datas to server and wait for response
            // if login failed notify user else:

            string message_to_send = "logincourier" + ";" + UserData.GetInstance().Database_ID + ";" + name.Text + ";" + pwd.Text;

            try
            {
                string response = Server_connection.GetInstance().SendMessageToServer(message_to_send, true);

                if (response == "accepted")
                {
                    MainMenu mm = new MainMenu();
                    mm.Show();
                    this.Close();
                }
                else
                {
                    if (response == "failed")
                    {
                        MessageBox.Show("Rosz adatok");
                    }
                    else
                    {
                        MessageBox.Show("Adatbázis hiba");
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Hiba");
            }
        }
Exemple #4
0
 public static Server_connection GetInstance()
 {
     if (instance == null)
     {
         instance = new Server_connection();
     }
     return(instance);
 }
Exemple #5
0
        protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
        {
            try
            {
                Server_connection.GetInstance().SendMessageToServer("setactive;0;" + UserData.GetInstance().Database_ID, true);
                Server_connection.GetInstance().SendMessageToServer("closethisclient;" + UserData.GetInstance().Database_ID + ",C");

                UserData.GetInstance().SetDefault();
                Server_connection.SetDefault();
            }
            catch (Exception)
            {
            }
        }
Exemple #6
0
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            if (StringEll())
            {
                if (UserData.GetInstance().Database_ID != -1)
                {
                    string message      = "updateC;" + nev.Text + ";" + datum.Text + ";" + varos.Text + ";" + jogsi.Text + ";" + email.Text + ";" + tel.Text + ";" + jelso.Text + ";" + UserData.GetInstance().Database_ID;
                    string message_back = Server_connection.GetInstance().SendMessageToServer(message, true);

                    if (message_back == "OK")
                    {
                        MessageBox.Show("Adatváltoztatás sikerült");

                        UserData.GetInstance().Name     = nev.Text;
                        UserData.GetInstance().City     = varos.Text;
                        UserData.GetInstance().Date     = datum.Text;
                        UserData.GetInstance().Driver_L = jogsi.Text;
                        UserData.GetInstance().Email    = email.Text;
                        UserData.GetInstance().Tel      = tel.Text;
                        UserData.GetInstance().Password = jelso.Text;

                        this.Close();
                        return;
                    }

                    MessageBox.Show("Adatbázis hiba");
                    this.Close();
                }
                else
                {
                    string message      = "regC;" + nev.Text + ";" + datum.Text + ";" + varos.Text + ";" + jogsi.Text + ";" + email.Text + ";" + tel.Text + ";" + jelso.Text;
                    string message_back = Server_connection.GetInstance().SendMessageToServer(message, true);

                    if (message_back == "OK")
                    {
                        MessageBox.Show("Regisztrálás sikerült");
                        this.Close();
                        return;
                    }

                    MessageBox.Show("Adatbázis hiba");
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Az adatok nem megfelelőek");
            }
        }
 public static void SetDefault()
 {
     instance = null;
 }