public Kursi KursiSelectByEmri(String Emri) { SqlConnection con = Generals.GetNewConnection(); Kursi kursi = null; try { SqlCommand cmd = new SqlCommand("SelectLendaByEmri", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Emri", Emri); SqlDataReader rdr = cmd.ExecuteReader(); kursi = new Kursi(); while (rdr.Read()) { kursi.KursiID = (int)rdr["KursiID"]; } } finally { con.Close(); } return(kursi); }
public Kursi KursiSelectByID(int id) { SqlConnection con = Generals.GetNewConnection(); Kursi kursi = null; try { SqlCommand cmd = new SqlCommand("KursiSelectByID", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@KursiID", id); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { kursi = new Kursi(); kursi.KursiID = (int)rdr["KursiID"]; kursi.ProgramiID = (int)rdr["ProgramiID"]; kursi.Emri = rdr["Emri"].ToString(); kursi.Aktiv = (bool)rdr["Emri"]; if (rdr["CreatedBy"] != DBNull.Value) { kursi.CreatedBy = (int)rdr["CreatedBy"]; } if (rdr["CreatedDate"] != DBNull.Value) { kursi.CreatedDate = rdr["CreatedDate"].ToString(); } if (rdr["ModifiedBy"] != DBNull.Value) { kursi.ModifiedBy = (int)rdr["ModifiedBy"]; } if (rdr["ModifiedDate"] != DBNull.Value) { kursi.ModifiedDate = rdr["ModifiedDate"].ToString(); } } } finally { con.Close(); } return(kursi); }
public List <Kursi> GetKursetByProfesoriID(int profesori) { SqlConnection con = Generals.GetNewConnection(); List <Kursi> kurset = new List <Kursi>(); try { SqlCommand cmd = new SqlCommand("GetKursiByProfesoriID", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@ProfesoriID", profesori); SqlDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { Kursi kursi = new Kursi(); kursi.KursiID = (int)rdr["KursiID"]; kursi.Emri = rdr["Emri"].ToString(); kursi.Aktiv = rdr["Aktiv"].ToString().Equals("1"); if (rdr["CreatedBy"] != DBNull.Value) { kursi.CreatedBy = (int)rdr["CreatedBy"]; } if (rdr["CreatedDate"] != DBNull.Value) { kursi.CreatedDate = rdr["CreatedDate"].ToString(); } if (rdr["ModifiedBy"] != DBNull.Value) { kursi.ModifiedBy = (int)rdr["ModifiedBy"]; } if (rdr["ModifiedDate"] != DBNull.Value) { kursi.ModifiedDate = rdr["ModifiedDate"].ToString(); } kurset.Add(kursi); } } finally { con.Close(); } return(kurset); }