public static void PretragaKorisnika(DSKorisnici.KorisniksDataTable dtKorisniks, string firstname, string lastname)
        {
            dtKorisniks.Clear();
            SqlConnection cm = Connection.GetConnection();

            if (cm.State == ConnectionState.Closed)
            {
                cm.Open();
            }
            try
            {
                SqlCommand cmd = new SqlCommand("pretragaKorisnika2", cm);
                cmd.CommandType = CommandType.StoredProcedure;
                if (firstname != "")
                {
                    cmd.Parameters.Add("@Ime", SqlDbType.NVarChar).Value = firstname;
                }
                if (lastname != "")
                {
                    cmd.Parameters.Add("@Prezime", SqlDbType.NVarChar).Value = lastname;
                }

                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dtKorisniks);
            }
            finally
            {
            }
        }
Beispiel #2
0
 private void frm_pretragaKorisnika_Load(object sender, EventArgs e)
 {
     DSKorisnici.KorisniksDataTable dtKorisnik = new DSKorisnici.KorisniksDataTable();
     DAPretragaKorisnika.GetKorisnici(dtKorisnik);
     dataGridView1.AutoGenerateColumns = false;
     dataGridView1.DataSource          = dtKorisnik;
 }
Beispiel #3
0
        public static bool SelectLogin(DSKorisnici.KorisniksDataTable dtKorisnici, string korisnickoIme, string lozinka)
        {
            SqlConnection cn = Connection.GetConnection();

            if (cn.State == ConnectionState.Closed)
            {
                cn.Open();
            }
            try
            {
                SqlCommand cmd = new SqlCommand("si001_student.usp_Login", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@KorisnickoIme", korisnickoIme);
                cmd.Parameters.AddWithValue("@Lozinka", lozinka);
                SqlDataReader r = cmd.ExecuteReader();
                if (r.HasRows)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }



            finally { cn.Close(); }
        }
Beispiel #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            DSKorisnici.KorisniksDataTable dsKorisnici = new DSKorisnici.KorisniksDataTable();

            if (Login.SelectLogin(dsKorisnici, txtKorisnickoIme.Text, txtLozinka.Text) == true)
            {
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                lblInfo.Visible = true;
            }
        }
        public static void GetKorisniciByRezervacijaId(DSKorisnici.KorisniksDataTable dtKorisnici, int rezervacijaId)
        {
            dtKorisnici.Clear();
            SqlConnection cn = Connection.GetConnection();

            if (cn.State == ConnectionState.Closed)
            {
                cn.Open();
            }
            try
            {
                SqlCommand cmd = new SqlCommand("si001_student.usp_SelectKorisniciByRezervacijaId", cn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@Id", SqlDbType.Int).Value = rezervacijaId;

                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dtKorisnici);
            }
            finally { cn.Close(); }
        }
        public static void GetKorisnici(DSKorisnici.KorisniksDataTable dtKorisniks)
        {
            dtKorisniks.Clear();
            SqlConnection cm = Connection.GetConnection();

            if (cm.State == ConnectionState.Closed)
            {
                cm.Open();
            }
            try
            {
                SqlCommand cmd = new SqlCommand("proc_Korisnici", cm);
                cmd.CommandType = CommandType.StoredProcedure;

                SqlDataAdapter adapter = new SqlDataAdapter(cmd);
                adapter.Fill(dtKorisniks);
            }
            finally
            {
            }
        }