Beispiel #1
0
        public void Ispisi(string prijava)
        {
            label2.Text = prijava;
            var con = Baza.conn();

            con.Open();
            SqlCommand    sqlCommand = new SqlCommand("SELECT * FROM Servis_racunala where Korisnik ='" + this.label2.Text + "' and Oznaka_potvrde='N'", con);
            SqlDataReader reader     = sqlCommand.ExecuteReader();

            while (reader.Read())
            {
                Servis_unos prebacivanje = new Servis_unos(prijava);
                prebacivanje.kvar     = (string)reader["kvar"];
                prebacivanje.klijent  = (string)reader["klijent"];
                prebacivanje.datum    = (string)reader["datum"];
                prebacivanje.cijena   = (int)reader["cijena"];
                prebacivanje.korisnik = (string)reader["Korisnik"];
                prebacivanje.id       = (int)reader["Id"];
                servisi.Add(prebacivanje);
            }
            foreach (var s in servisi)
            {
                string[] red   = { s.id.ToString(), s.kvar, s.cijena.ToString(), s.klijent, s.datum, s.korisnik };
                var      redak = new ListViewItem(red);

                listView1.Items.Add(redak);
            }
            con.Close();
        }
Beispiel #2
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            var con = Baza.conn();

            con.Open();
            string        izvadi     = "select * from  Servis_racunala where id = '" + textBox1.Text + "'  and Korisnik = '" + prijava + "'; ";
            SqlCommand    izvadi_cmd = new SqlCommand(izvadi, con);
            SqlDataReader prijenos;

            prijenos = izvadi_cmd.ExecuteReader();
            if (prijenos.Read())
            {
                textBox2.Text        = (prijenos["Kvar"].ToString());
                textBox3.Text        = (prijenos["cijena"].ToString());
                textBox4.Text        = (prijenos["klijent"].ToString());
                dateTimePicker1.Text = (prijenos["datum"].ToString());
            }
            else
            {
                textBox2.Text        = "";
                textBox3.Text        = "";
                textBox4.Text        = "";
                dateTimePicker1.Text = "";
            }
            con.Close();
        }
Beispiel #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            var con = Baza.conn();

            con.Open();
            int dodatak = Int32.Parse(textBox4.Text);

            cijena = +dodatak;



            string     zadatak = "INSERT INTO Racun(cijena,klijent,Korisnik)  VALUES(" + this.cijena + " ,  '" + this.textBox2.Text + "' , '" + prijava + "'  );";
            SqlCommand cmd     = new SqlCommand(zadatak, con);

            cmd.ExecuteNonQuery();

            string update = "Update Servis_racunala set Oznaka_potvrde ='D' where id= '" + textBox5.Text + "';";


            SqlCommand upcmd = new SqlCommand(update, con);

            upcmd.ExecuteNonQuery();
            con.Close();



            MessageBox.Show("Racun izdan !");
        }
Beispiel #4
0
        public void Ispisi(string prijavljeni)
        {
            var con = Baza.conn();

            con.Open();
            SqlCommand    sqlCommand = new SqlCommand("SELECT * FROM Racun where Korisnik ='" + prijavljeni + "'", con);
            SqlDataReader reader     = sqlCommand.ExecuteReader();

            while (reader.Read())
            {
                Racuni prebacivanje = new Racuni(prijava);
                prebacivanje.broj    = (int)reader["Broj"];
                prebacivanje.klijent = (string)reader["klijent"];
                prebacivanje.cijena  = (int)reader["cijena"];


                servisi.Add(prebacivanje);
            }
            foreach (var s in servisi)
            {
                string[] red   = { s.broj.ToString(), s.cijena.ToString(), s.klijent };
                var      redak = new ListViewItem(red);

                listView1.Items.Add(redak);
            }
            con.Close();
        }
Beispiel #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            var con = Baza.conn();

            con.Open();
            string     zadatak = "INSERT INTO Korisnik (Ime,Prezime,korisnik, lozinka)  VALUES( '" + this.textBox1.Text + "' ,'" + this.textBox2.Text + "','" + this.textBox3.Text + "','" + this.textBox4.Text + "')";
            SqlCommand cmdnar  = new SqlCommand(zadatak, con);

            cmdnar.ExecuteNonQuery();

            textBox2.Text = "";
            textBox1.Text = "";
            textBox3.Text = "";
            textBox4.Text = "";

            con.Close();

            MessageBox.Show("Korisnik spremljen !");
        }
Beispiel #6
0
        private void button2_Click(object sender, EventArgs e)
        {
            var con = Baza.conn();

            con.Open();



            string     zadatak = "INSERT INTO Servis_racunala(kvar,cijena,klijent,datum,Korisnik,Oznaka_potvrde)  VALUES('" + this.textBox1.Text + "' ,  " + this.textBox2.Text + " , '" + this.textBox3.Text + "', '" + this.dateTimePicker1.Text + "' ,'" + this.prijavljeni + "','N'  );";
            SqlCommand cmd     = new SqlCommand(zadatak, con);

            cmd.ExecuteNonQuery();
            con.Close();
            this.textBox1.Text = " ";
            this.textBox2.Text = " ";
            this.textBox3.Text = " ";


            MessageBox.Show("Servis spremljen!");
        }
Beispiel #7
0
        private void button2_Click(object sender, EventArgs e)
        {
            var con = Baza.conn();

            con.Open();
            SqlDataReader citac;
            string        izmjeni = "UPDATE  Servis_racunala set kvar = '" + this.textBox2.Text + "'  where id = '" + textBox1.Text + "' ; ";
            SqlCommand    cmd     = new SqlCommand(izmjeni, con);

            citac = cmd.ExecuteReader();
            citac.Close();



            izmjeni = "UPDATE  Servis_racunala set cijena = '" + this.textBox3.Text + "'  where id = '" + textBox1.Text + "' ; ";
            cmd     = new SqlCommand(izmjeni, con);
            citac   = cmd.ExecuteReader();
            citac.Close();


            izmjeni = "UPDATE  Servis_racunala set klijent = '" + this.textBox4.Text + "'  where id = '" + textBox1.Text + "' ; ";
            cmd     = new SqlCommand(izmjeni, con);
            citac   = cmd.ExecuteReader();
            citac.Close();



            izmjeni = "UPDATE  Servis_racunala set datum = '" + this.dateTimePicker1.Text + "'  where id = '" + textBox1.Text + "' ; ";
            cmd     = new SqlCommand(izmjeni, con);
            citac   = cmd.ExecuteReader();
            citac.Close();

            servisi.Clear();
            listView1.Items.Clear();
            Ispisi(prijava);
            con.Close();
            MessageBox.Show(" Izmjenjeno");
        }
Beispiel #8
0
        private void button1_Click(object sender, EventArgs e)
        {
            var con = Baza.conn();

            prijavljeni = textBox1.Text;
            con.Open();
            SqlDataAdapter prijava = new SqlDataAdapter("select count(*) from Korisnik where korisnik='" + textBox1.Text + "'and lozinka = '" + textBox2.Text + "'", con);
            DataTable      dt      = new DataTable();

            prijava.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                Izbornik otvori = new Izbornik(prijavljeni);
                this.Hide();
                otvori.Show();
                Servis_unos otvori_ = new Servis_unos(prijavljeni);
                MessageBox.Show(" Korisnik " + prijavljeni + " prijavljen");
            }
            else
            {
                MessageBox.Show("Pogresno korisnicko ime ili lozinka");
            }
        }
Beispiel #9
0
        private void button3_Click(object sender, EventArgs e)
        {
            var con = Baza.conn();

            con.Open();
            string        brisi     = "delete from  Servis_racunala where id = '" + textBox1.Text + "' ; ";
            SqlCommand    brisi_cmd = new SqlCommand(brisi, con);
            SqlDataReader citac;

            citac = brisi_cmd.ExecuteReader();
            if (citac.Read())
            {
                con.Close();
                listView1.Items.Clear();


                this.textBox1.Text = "";
                this.textBox2.Text = "";
                this.textBox3.Text = "";
                this.textBox4.Text = "";
                MessageBox.Show("Obrisano");
            }
            else
            {
                this.textBox1.Text = "";
                this.textBox2.Text = "";
                this.textBox3.Text = "";
                this.textBox4.Text = "";
            }


            servisi.Clear();
            listView1.Items.Clear();
            Ispisi(prijava);
            con.Close();
        }
Beispiel #10
0
        private void textBox5_TextChanged(object sender, EventArgs e)
        {
            var con = Baza.conn();

            con.Open();
            string        izvadi     = "select * from  Servis_racunala where id = '" + textBox5.Text + "'  ; ";
            SqlCommand    izvadi_cmd = new SqlCommand(izvadi, con);
            SqlDataReader prijenos;

            prijenos = izvadi_cmd.ExecuteReader();
            if (prijenos.Read())
            {
                textBox3.Text = (prijenos["cijena"].ToString());
                textBox2.Text = (prijenos["klijent"].ToString());
                cijena        = Int32.Parse(textBox3.Text);
            }
            else
            {
                textBox2.Text = "";
                textBox3.Text = "";
                textBox4.Text = "";
            }
            con.Close();
        }