public static List <Zadatak> VratiZadatkeFaze(int id_faze) { using (OracleCommand cmd = new OracleCommand("P_ZADATAK.Vrati_Zadatke_Faze", DBConnection.con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new OracleParameter("zadaci", OracleDbType.RefCursor, ParameterDirection.ReturnValue)); cmd.Parameters.Add(new OracleParameter("faza_id", OracleDbType.Varchar2, ParameterDirection.Input)); cmd.Parameters["faza_id"].Value = id_faze; OracleDataReader dr = cmd.ExecuteReader(); List <Zadatak> zadaci = new List <Zadatak>(); while (dr.Read()) { int id = (int)dr.GetDecimal(0); string ime = dr.GetString(1); string opis = dr.IsDBNull(2) ? null : dr.GetString(2); ZStatus status = (ZStatus)dr.GetDecimal(3); DateTime?pocetak = dr.IsDBNull(4) ? (DateTime?)null : dr.GetDateTime(4); DateTime?kraj = dr.IsDBNull(5) ? (DateTime?)null : dr.GetDateTime(5); ZTip tip = (ZTip)dr.GetDecimal(6); Zadatak zad = new Zadatak() { Id = id, Ime = ime, Opis = opis, Status = status, PocetakIzrade = pocetak, KrajIzrade = kraj, Tip = tip }; zadaci.Add(zad); } dr.Close(); return(zadaci); } }
public static void IzmeniInformacije(int id, string ime, string opis, DateTime?vr_poc, DateTime?vr_kraj, ZTip tip) { using (OracleCommand cmd = new OracleCommand("P_ZADATAK.Izmeni_Informacije", DBConnection.con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new OracleParameter("p_id", OracleDbType.Decimal, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_ime", OracleDbType.Varchar2, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_opis", OracleDbType.Varchar2, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_poc", OracleDbType.Date, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_kraj", OracleDbType.Date, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_tip", OracleDbType.Decimal, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_user", OracleDbType.Varchar2, ParameterDirection.Input)); cmd.Parameters["p_id"].Value = id; cmd.Parameters["p_ime"].Value = ime; cmd.Parameters["p_opis"].Value = opis; cmd.Parameters["p_poc"].Value = vr_poc; cmd.Parameters["p_kraj"].Value = vr_kraj; cmd.Parameters["p_tip"].Value = tip; cmd.Parameters["p_user"].Value = Korisnik.KorisnickoIme; cmd.ExecuteNonQuery(); } }
public static int Dodaj(string ime, string opis, DateTime?vr_poc, DateTime?vr_kraj, ZTip tip, int id_faze) { using (OracleCommand cmd = new OracleCommand("P_ZADATAK.Dodaj", DBConnection.con)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new OracleParameter("p_ime", OracleDbType.Varchar2, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_opis", OracleDbType.Varchar2, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_poc", OracleDbType.Date, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_kraj", OracleDbType.Date, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_tip", OracleDbType.Decimal, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_faza", OracleDbType.Decimal, ParameterDirection.Input)); cmd.Parameters.Add(new OracleParameter("p_id", OracleDbType.Decimal, ParameterDirection.Output)); cmd.Parameters["p_ime"].Value = ime; cmd.Parameters["p_opis"].Value = opis; cmd.Parameters["p_poc"].Value = vr_poc; cmd.Parameters["p_kraj"].Value = vr_kraj; cmd.Parameters["p_tip"].Value = tip; cmd.Parameters["p_faza"].Value = id_faze; cmd.ExecuteNonQuery(); return(int.Parse(cmd.Parameters["p_id"].Value.ToString())); } }