예제 #1
0
        //Rjesit imena pomocu labela za update

        private void btnUpdate_Click(object sender, RoutedEventArgs e)
        {
            /*
             * string query = "insert into " + tableName + " values (";
             * foreach (TextBox tx in listTextBox){
             *  query += "'";
             *  query += tx.Text;
             *  query += "',";
             * }
             * query = query.Remove(query.Length - 1, 1) + ")";
             * MessageBox.Show(query);*/
            tableFieldValues.Clear();

            foreach (TextBox childOf in stackPanelMain.Children)
            {
                tableFieldValues.Add(childOf.Text);
            }
            string query = "UPDATE " + tableName + " SET ";

            for (int x = 1; x < listTextBox.Count; x++)
            {
                query += tableFieldNames[x] + " = " + "'" + tableFieldValues[x] + "'" + "," + " ";
            }
            query  = query.Remove(query.Length - 2);
            query += " WHERE " + tableFieldNames[0] + " = " + tableFieldValues[0];
            db.insert(query);
        }
예제 #2
0
        private void btnAddTitle_Click(object sender, RoutedEventArgs e)
        {
            name = txtBoxName.Text;
            string query = "insert into titl(jezik, putanja) values ( " + "'" + name + "'" + "," + "'" + path + "'" + ")";

            db.insert(query);
        }
예제 #3
0
        private void btnAddNacionalnost_Click(object sender, RoutedEventArgs e)
        {
            name = txtBoxNacionalnost.Text;
            string query = "insert into nacionalnost(naziv) values ( " + "'" + name + "'" + ")";

            db.insert(query);
        }
예제 #4
0
        private void btnAddGenre_Click(object sender, RoutedEventArgs e)
        {
            name        = txtBoxName.Text;
            description = txtBoxDescription.Text;
            string query = "insert into zanr(naziv, opis) values ( " + "'" + name + "'" + "," + "'" + description + "'" + ")";

            db.insert(query);
        }
예제 #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //actor = new glumac();
            actorName    = txtBoxActorName.Text;
            actorSurname = txtBoxActorSurname.Text;
            string query = "insert into glumac(ime, prezime) values ( " + "'" + actorName + "' " + "," + "'" + actorSurname + "'" + ")";

            db.insert(query);
        }
예제 #6
0
        private void btnAddDirector_Click(object sender, RoutedEventArgs e)
        {
            name    = txtBoxName.Text;
            surname = txtBoxSurname.Text;
            year    = txtBoxYear.Text;
            string query = "insert into redatelj(ime, prezime, datumRodenja) values ( " + "'" + name + "'" + "," + "'" + surname + "'" + "," + "'" + year + "'" + ")";

            db.insert(query);
        }
예제 #7
0
        private void btnAddModel_Click(object sender, RoutedEventArgs e)
        {
            name        = txtBoxName.Text;
            description = txtBoxDescription.Text;
            price       = txtBoxPrice.Text;
            length      = txtBoxLength.Text;
            string query = "insert into model(naziv, opis, cijena, trajanje) values ( " + "'" + name + "'" + "," + "'" + description + "'" + "," + "'" + price + "'" + "," + "'" + length + "'" + ")";

            db.insert(query);
        }
예제 #8
0
        private void btnAddAddress_Click(object sender, RoutedEventArgs e)
        {
            postNumber = txtBoxPostNumber.Text;
            place      = txtBoxMjesto.Text;
            street     = txtBoxUlica.Text;
            string query = "insert into adresa(postanskiBroj, mjesto, ulica) values ( " + "'" + postNumber + "' " + "," + "'" + place + "'" + "," + "'" + street + "'" + ")";

            db.insert(query);
            MessageBox.Show("Adresa dodana");
        }
예제 #9
0
        private void btnAddDistributor_Click(object sender, RoutedEventArgs e)
        {
            name    = txtBoxName.Text;
            address = txtBoxAddress.Text;
            phone   = txtBoxPhone.Text;
            faks    = txtBoxFax.Text;
            email   = txtBoxEmail.Text;
            oib     = txtBoxOib.Text;
            string query = "insert into distributer(naziv, adresa, telefon, faks, email, oib) values ( " + "'" + name + "'" + "," + "'" + address + "'" + "," + "'" + phone + "'" + "," + "'" + faks + "'" + "," + "'" + email + "'" + "," + "'" + oib + "'" + ")";

            db.insert(query);
        }
예제 #10
0
        private void btnAddMembership_Click(object sender, RoutedEventArgs e)
        {
            dt      = new DateTime();
            dtUntil = new DateTime();
            dt      = DateTime.Now;
            model    currentModel = (model)listBoxModel.SelectedItem;
            korisnik currentUser  = (korisnik)listBoxUser.SelectedItem;

            dtUntil = dt.AddDays(currentModel.trajanje);
            string date1 = dt.ToString("yyyy-MM-dd HH:mm:ss");
            string date2 = dtUntil.ToString("yyyy-MM-dd HH:mm:ss");
            string query = "insert into clanarina (model, korisnik, datumAktivacija, datumDeaktivacije) values (" + "'" + currentModel.idKorisnik + "'" + "," + "'" + currentUser.idKorisnik + "'" + "," + "'" + date1 + "'" + "," + "'" + date2 + "'" + ")";

            db.insert(query);
        }
예제 #11
0
        private void btnAddMovie_Click(object sender, RoutedEventArgs e)
        {
            distributer dbId = (distributer)listBoxDistributor.SelectedItem;

            name     = txtBoxNaziv.Text;
            year     = txtBoxYear.Text;
            duration = txtBoxDuration.Text;
            language = txtBoxLanguage.Text;
            country  = txtBoxCountry.Text;
            address  = dbId.idDistributer.ToString();
            path     = txtBoxPath.Text;
            string query = "insert into film(naziv, godina, trajanje, jezik, zemlja, putanja, distributer) values ( " + "'" + name + "'" + "," + "'" + year + "'" + "," + "'" + duration + "'" + "," + "'" + language + "'" + "," + "'" + country + "'" + "," + "'" + path + "'" + "," + "'" + address + "'" + ")";

            db.insert(query);
        }
예제 #12
0
        private void btnAddUser_Click(object sender, RoutedEventArgs e)
        {
            name     = txtBoxName.Text;
            surname  = txtBoxSurname.Text;
            phone    = txtBoxPhone.Text;
            email    = txtBoxEmail.Text;
            status   = txtBoxStatus.Text;
            type     = txtBoxType1.Text;
            userName = txtBoxUserName.Text;
            password = txtBoxPassword.Text;
            address  = txtBoxAddress.Text;
            string query = "insert into korisnik(ime, prezime, telefon, email, status, tip, korisnickoIme, sifra, adresa) values ( " + "'" + name + "'" + "," + "'" + surname + "'" + "," + "'" + phone + "'" + "," + "'" + email + "'" + "," + "'" + status + "'" + "," + "'" + type + "'" + "," + "'" + userName + "'" + "," + "'" + password + "'" + "," + "'" + address + "'" + ")";

            db.insert(query);
            MessageBox.Show("Korisnik dodan");
        }