public Upravnik dajUpravnika() { try { MySqlCommand cmd = new MySqlCommand("select * from uposlenici where posao = 'u'", con); MySqlDataReader r = cmd.ExecuteReader(); r.Read(); Upravnik u = null; if (r.HasRows) { Image i = DAL.dajSlikuOdBajta(11, r); u = new Upravnik(r.GetString("ime"), r.GetString("prezime"), r.GetString("adresa"), r.GetDateTime("datum_rodjenja"), r.GetInt32("idUposlenici"), (Spol)Enum.Parse(typeof(Spol), r.GetString("spol"), true), r.GetString("napomene"), r.GetDateTime("datum_zaposlenja"), new List <Prisustvo>(), i); } return(u); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); throw; } }
public UpravnikOdjela getById(int id) { try { MySqlCommand cmd = new MySqlCommand("select * from uposlenici where idUposlenici = @ID ", con); cmd.Parameters.Add("@ID", MySqlDbType.Int32).Value = id; MySqlDataReader r = cmd.ExecuteReader(); r.Read(); UpravnikOdjela uo = null; if (r.HasRows) { Image i = DAL.dajSlikuOdBajta(11, r); uo = new UpravnikOdjela(r.GetString("ime"), r.GetString("prezime"), r.GetString("adresa"), r.GetDateTime("datum_rodjenja"), r.GetInt32("idUposlenici"), (Spol)Enum.Parse(typeof(Spol), r.GetString("spol"), true), r.GetString("napomene"), r.GetDateTime("datum_zaposlenja"), new List <Prisustvo>(), (Blok)(r.GetInt32("idOdjeli") - 1), i); } return(uo); } catch (Exception) { throw; } }
public List <UpravnikOdjela> getAll() { try { MySqlCommand cmd = new MySqlCommand("select * from uposlenici where posao = 'uo'", con); MySqlDataReader r = cmd.ExecuteReader(); List <UpravnikOdjela> uo = new List <UpravnikOdjela>(); while (r.Read()) { if (r.HasRows) { Image i = DAL.dajSlikuOdBajta(11, r); uo.Add(new UpravnikOdjela(r.GetString("ime"), r.GetString("prezime"), r.GetString("adresa"), r.GetDateTime("datum_rodjenja"), r.GetInt32("idUposlenici"), (Spol)Enum.Parse(typeof(Spol), r.GetString("spol"), true), r.GetString("napomene"), r.GetDateTime("datum_zaposlenja"), new List <Prisustvo>(), (Blok)(r.GetInt32("idOdjeli") - 1), i)); } } return(uo); } catch (Exception) { throw; } }
public List <Arhiv> dajUslovne() { try { MySqlCommand cmd = new MySqlCommand("select * from arhiv where razlog = 'Uslovno'", con); MySqlDataReader r = cmd.ExecuteReader(); List <Arhiv> a = new List <Arhiv>(); while (r.Read()) { Image i = DAL.dajSlikuOdBajta(10, r); Zatvorenik z = new Zatvorenik(r.GetString("ime"), r.GetString("prezime"), r.GetString("adresa"), (DateTime)r.GetDateTime("datum_rodjenja"), r.GetInt32("idZatvorenici"), Spol.Musko, r.GetString("napomene"), (Blok)(r.GetInt32("idOdjeli") - 1), r.GetInt32("br_celije"), (DateTime)r.GetDateTime("datum_dolaska"), (DateTime)r.GetDateTime("datum_izlaska"), i); Arhiv arhiv = new Arhiv(z, (DateTime)r.GetDateTime("datum_arhiviranja"), r.GetString("razlog")); a.Add(arhiv); } return(a); } catch (Exception) { throw; } }
public List <Cuvar> getAll() { try { MySqlCommand cmd = new MySqlCommand("select * from uposlenici where posao = 'c'", con); MySqlDataReader r = cmd.ExecuteReader(); List <Cuvar> c = new List <Cuvar>(); while (r.Read()) { if (r.HasRows) { Image i = DAL.dajSlikuOdBajta(11, r); c.Add(new Cuvar(r.GetString("ime"), r.GetString("prezime"), r.GetString("adresa"), r.GetDateTime("datum_rodjenja"), r.GetInt32("idUposlenici"), (Spol)Enum.Parse(typeof(Spol), r.GetString("spol"), true), r.GetString("napomene"), (Blok)(r.GetInt32("idOdjeli") - 1), r.GetDateTime("datum_zaposlenja"), new List <Prisustvo>(), r.GetString("zaduzenja"), i)); } } return(c); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); throw; } }