private SeatingData getBuildingJson(int buildingKey, bool balcony) { var json = File.ReadAllText(string.Format("{0}{1}{2}.json", HttpContext.Current.Server.MapPath("~/Content/maps/"), buildingKey, balcony == true ? "b" : "")); SeatingData building = JsonConvert.DeserializeObject <List <SeatingData> >(json).First(); return(building); }
private SeatingData getSectionJson(int sectionKey, int subsection) { var subsectionFilename = (subsection == 0) ? "" : "-" + subsection; var json = File.ReadAllText(string.Format("{0}{1}{2}.json", HttpContext.Current.Server.MapPath("~/Content/maps/sections/"), sectionKey, subsectionFilename)); SeatingData section = JsonConvert.DeserializeObject <List <SeatingData> >(json).First(); return(section); }
private SeatingData getSectionSeatData(SeatingData section, int sectionKey, int subsection, int eventId) { DataTable seatsTable = new DataTable(); List <RowRecord> seats = new List <RowRecord>(); using (OracleConnection objConn = new OracleConnection(Global.ConnectionString)) { // Set up the upcomingEvents command var eventCommand = new OracleCommand("TICKETS_QUERIES.getSectionSeatsForEvent", objConn) { BindByName = true, CommandType = CommandType.StoredProcedure }; eventCommand.Parameters.Add("p_Return", OracleDbType.RefCursor, ParameterDirection.ReturnValue); eventCommand.Parameters.Add("p_EventId", OracleDbType.Int64, eventId, ParameterDirection.Input); eventCommand.Parameters.Add("p_SectionKey", OracleDbType.Int64, sectionKey, ParameterDirection.Input); eventCommand.Parameters.Add("p_Subsection", OracleDbType.Int64, subsection, ParameterDirection.Input); // Execute the queries and auto map the results to models objConn.Open(); var eventAdapter = new OracleDataAdapter(eventCommand); eventAdapter.Fill(seatsTable); seats = Mapper.DynamicMap <IDataReader, List <RowRecord> >(seatsTable.CreateDataReader()); objConn.Close(); } if (seats.Any()) { foreach (var seat in seats) { foreach (var row in section.Data) { if (row.Seat_Row == seat.Seat_Row) { row.Empty_Seats = seat.Empty_Seats; row.Prime_Row = string.IsNullOrEmpty(seat.Is_Prime_Seat) ? 0 : 1; } } } } return(section); }