public static LocationList GetCategories() { LocationList lstCat = new LocationList(); using (SqlConnection Conn = new SqlConnection("server=SURESHJALAJA-PC;database=Parking;uid=sa;password=suresh;")) { using (SqlCommand Cmd = new SqlCommand(Constants.Proc.USP_GET_CATEGORIES, Conn)) { Cmd.CommandType = CommandType.StoredProcedure; Conn.Open(); using (SqlDataReader dr = Cmd.ExecuteReader()) { while (dr.Read()) { LocationsBO ObjCat = new LocationsBO(); ObjCat.CategoryID = Convert.ToInt32(dr["CategoryID"]); ObjCat.CategoryName = Convert.ToString(dr["CategoryName"]); lstCat.Add(ObjCat); } } } } return lstCat; }
public static LocationList GetLocationsByCatID(int CategoryID) { LocationList lstCat = new LocationList(); using (SqlConnection Conn = new SqlConnection("server=SURESHJALAJA-PC;database=Parking;uid=sa;password=suresh;")) { using (SqlCommand Cmd = new SqlCommand(Constants.Proc.USP_GET_LOCATIONS_BY_CATEGORYID, Conn)) { Cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.Add("@CategoryID", SqlDbType.Int).Value = CategoryID; Conn.Open(); using (SqlDataReader dr = Cmd.ExecuteReader()) { while (dr.Read()) { LocationsBO ObjCat = new LocationsBO(); ObjCat.LocationID = Convert.ToInt32(dr["LocationID"]); ObjCat.LocationName = Convert.ToString(dr["LocationName"]); lstCat.Add(ObjCat); } } } } return lstCat; }
public static LocationList GetLocations(int LocationID, DateTime AvailabiltyDateTime) { LocationList lstCat = new LocationList(); using (SqlConnection Conn = new SqlConnection("server=SURESHJALAJA-PC;database=Parking;uid=sa;password=suresh;")) { using (SqlCommand Cmd = new SqlCommand(Constants.Proc.USP_GET_LOCATIONS_BY_CATEGORYIDANDAVAILDTTIME, Conn)) { Cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.Add("@LocationID", SqlDbType.Int).Value = LocationID; // Cmd.Parameters.Add("@AvailabilityDate", SqlDbType.DateTime).Value = AvailabiltyDateTime; Conn.Open(); using (SqlDataReader dr = Cmd.ExecuteReader()) { while (dr.Read()) { LocationsBO ObjCat = new LocationsBO(); ObjCat.CatLocationID = Convert.ToInt32(dr["CatLocationID"]); ObjCat.LocationID = Convert.ToInt32(dr["LocationID"]); ObjCat.LocationName = Convert.ToString(dr["LocationName"]); ObjCat.Price = Convert.ToDecimal(dr["Price"]); ObjCat.Tax = Convert.ToDecimal(dr["tax"]); ObjCat.ParkType = Convert.ToString(dr["ParkType"]); ObjCat.ParkTypeID = Convert.ToInt32(dr["ParkTypeID"]); ObjCat.Description = Convert.ToString(dr["Description"]); lstCat.Add(ObjCat); } } } } return lstCat; }