public static List<BookedEvent> GetAll(string staffUsername, int? stage) { List<BookedEvent> output = new List<BookedEvent>(); using (SqlConnection conn = UtilityDb.GetConnectionESS()) { string sql = string.Format("SELECT * FROM REQ_BookedEvents WHERE UPPER(StaffUsername)='{0}'", staffUsername.ToUpper()); if (stage.HasValue) sql += " AND stage=" + stage.Value; SqlDataReader dr = UtilityDb.GetDataReader(sql, conn); while (dr.Read()) { BookedEvent obj = new BookedEvent(); obj.LoadFromReader(dr); output.Add(obj); } } return output; }
internal static List<BookedEvent> getByUsername(string Username) { List<BookedEvent> output = new List<BookedEvent>(); using (SqlConnection conn = UtilityDb.GetConnectionESS()) { string sql = string.Format("SELECT * FROM REQ_BookedEvents WHERE UPPER(StaffUsername)='{0}'", Username.ToUpper()); SqlDataReader dr = UtilityDb.GetDataReader(sql, conn); while (dr.Read()) { BookedEvent obj = new BookedEvent(); obj.LoadFromReader(dr); output.Add(obj); } } return output; }
internal static List<BookedEvent> GetAll() { List<BookedEvent> output = new List<BookedEvent>(); using (SqlConnection conn = UtilityDb.GetConnectionESS()) { string sql = string.Format("SELECT * FROM REQ_BookedEvents"); SqlDataReader dr = UtilityDb.GetDataReader(sql, conn); while (dr.Read()) { BookedEvent obj = new BookedEvent(); obj.LoadFromReader(dr); output.Add(obj); } } return output; }
internal static List<BookedEvent> getByEventID(int SelectedID) { List<BookedEvent> output = new List<BookedEvent>(); using (SqlConnection conn = UtilityDb.GetConnectionESS()) { string sql = string.Format("SELECT * FROM REQ_BookedEvents WHERE EventID={0}", SelectedID); SqlDataReader dr = UtilityDb.GetDataReader(sql, conn); while (dr.Read()) { BookedEvent be = new BookedEvent(); be.LoadFromReader(dr); output.Add(be); } } return output; }
public static BookedEvent GetByEventDateId(string staffUsername, int eventDateId) { using (SqlConnection conn = UtilityDb.GetConnectionESS()) { string sql = "SELECT * FROM REQ_BookedEvents WHERE UPPER(StaffUsername)='" + staffUsername.ToUpper() + "' AND EventDateId=" + eventDateId.ToString(); SqlDataReader dr = UtilityDb.GetDataReader(sql, conn); while (dr.Read()) { BookedEvent output = new BookedEvent(); output.LoadFromReader(dr); return output; } } return null; }