private void Back_button_Click(object sender, RoutedEventArgs e)
        {
            Customers_Window my_data_window = new Customers_Window(_loggedInAccount);

            this.Close();
            my_data_window.Show();
        }
        private void A1_button_Click(object sender, RoutedEventArgs e)
        {
            Konto newCustomer = new Konto()
            {
                Role         = "Customer",
                Nazwa_firmy  = Company_name.Text,
                Imie         = Name.Text,
                Nazwisko     = Surname.Text,
                Pesel        = PESEL.Text,
                Regon        = REGON.Text,
                Nip          = NIP.Text,
                Ulica        = Street.Text,
                Numer        = Number.Text,
                Kod_pocztowy = ZIP_code.Text,
                Miasto       = City.Text,
                Email        = E_mail.Text,
                Login        = Login.Text,
                Haslo        = Haslo.Text,
                Points       = 0
            };

            using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.databasePath))
            {
                conn.CreateTable <Konto>();
                conn.Insert(newCustomer);
            }

            Customers_Window custWindow = new Customers_Window(_loggedInAccount);

            custWindow.Show();

            this.Close();
        }
Beispiel #3
0
 private void Back_button_Click(object sender, RoutedEventArgs e)
 {
     if (_origin == "CUSTOMER")
     {
         Customers_Window my_data_window = new Customers_Window(_loggedInAccount);
         this.Close();
         my_data_window.Show();
     }
     else
     {
         Employess_Window emplWindow = new Employess_Window(_loggedInAccount);
         this.Close();
         emplWindow.Show();
     }
 }
Beispiel #4
0
        private void UpdateData(object sender, RoutedEventArgs e)
        {
            updatedAccount             = new Konto();
            updatedAccount.Haslo       = this.AccountToUpdate.Haslo;
            updatedAccount.Id          = this.AccountToUpdate.Id;
            updatedAccount.Role        = Role.Text;
            updatedAccount.Nazwa_firmy = Company_name.Text;
            updatedAccount.Imie        = Name.Text;
            updatedAccount.Nazwisko    = Surname.Text;
            updatedAccount.Pesel       = PESEL.Text;
            updatedAccount.Regon       = REGON.Text;
            updatedAccount.Nip         = NIP.Text;
            updatedAccount.Ulica       = Street.Text;
            updatedAccount.Numer       = Number.Text;
            updatedAccount.Miasto      = City.Text;
            updatedAccount.Email       = E_mail.Text;
            updatedAccount.Login       = this.AccountToUpdate.Login;

            using (SQLite.SQLiteConnection conn = new SQLite.SQLiteConnection(App.databasePath))
            {
                conn.CreateTable <Konto>();
                conn.Update(updatedAccount);
            }

            if (_origin == "CUSTOMER")
            {
                Customers_Window emplWindow = new Customers_Window(_loggedInAccount);
                this.Close();
                emplWindow.Show();
            }
            else
            {
                Employess_Window emplWindow = new Employess_Window(_loggedInAccount);
                this.Close();
                emplWindow.Show();
            }
        }
Beispiel #5
0
        private void Deletebtn_click(object sender, RoutedEventArgs e)
        {
            string command = $"delete FROM KONTO where id= '{AccountToUpdate.Id}'";

            if (_loggedInAccount.Role == "ADMIN")
            {
                using (SQLiteConnection connection = new SQLiteConnection(App.databasePath))
                {
                    SQLiteCommand cm = new SQLiteCommand(connection);
                    cm.CommandText = command;
                    cm.ExecuteNonQuery();
                }
            }
            else if (_origin == "CUSTOMER")
            {
                using (SQLiteConnection connection = new SQLiteConnection(App.databasePath))
                {
                    SQLiteCommand cm = new SQLiteCommand(connection);
                    cm.CommandText = command;
                    cm.ExecuteNonQuery();
                }
            }

            if (_origin == "CUSTOMER")
            {
                Customers_Window my_data_window = new Customers_Window(_loggedInAccount);
                this.Close();
                my_data_window.Show();
            }
            else
            {
                Employess_Window emplWindow = new Employess_Window(_loggedInAccount);
                this.Close();
                emplWindow.Show();
            }
        }