private void Back_button_Click(object sender, RoutedEventArgs e)
        {
            Employess_Window emplWindow = new Employess_Window(_loggedInAccount);

            emplWindow.Show();
            this.Close();
        }
        private void A2_button_Click(object sender, RoutedEventArgs e)
        {
            Konto newEmployee = new Konto()
            {
                Role         = Role.Text,
                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
            };

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

            Employess_Window emplWindow = new Employess_Window(_loggedInAccount);

            emplWindow.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();
            }
        }