private static OpenHouseBase MapOpenHouseReader(IDataReader reader) { OpenHouseBase openHouse = new OpenHouseBase(); int ordinalIndex = 0; openHouse.Id = reader.GetSafeInt32(ordinalIndex++); openHouse.ListingId = reader.GetSafeInt32(ordinalIndex++); openHouse.MlsListingId = reader.GetSafeString(ordinalIndex++); openHouse.ListPrice = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.StandardStatusName = reader.GetSafeString(ordinalIndex++); openHouse.PropertySubTypeName = reader.GetSafeString(ordinalIndex++); openHouse.YearBuilt = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.StreetName = reader.GetSafeString(ordinalIndex++); openHouse.StreetSuffix = reader.GetSafeString(ordinalIndex++); openHouse.StreetAddress = reader.GetSafeString(ordinalIndex++); openHouse.UnitNumber = reader.GetSafeString(ordinalIndex++); openHouse.CityName = reader.GetSafeString(ordinalIndex++); openHouse.StateOrProvince = reader.GetSafeString(ordinalIndex++); openHouse.PostalCode = reader.GetSafeString(ordinalIndex++); openHouse.LivingArea = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.LotSizeUnits = reader.GetSafeString(ordinalIndex++); openHouse.LotSizeSquareFeet = reader.GetSafeDecimalNullable(ordinalIndex++); openHouse.BedroomsTotal = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.BathroomsTotalInteger = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.BathroomsFull = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.BathroomsThreeQuarter = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.BathroomsHalf = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.BathroomsOneQuarter = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.ListAgentKeyNumeric = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.ListAgentMlsId = reader.GetSafeString(ordinalIndex++); openHouse.ListAgentStateLicense = reader.GetSafeString(ordinalIndex++); openHouse.ListAgentFirstName = reader.GetSafeString(ordinalIndex++); openHouse.ListAgentLastName = reader.GetSafeString(ordinalIndex++); openHouse.ListOfficeKeyNumeric = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.ListOfficeMlsId = reader.GetSafeString(ordinalIndex++); openHouse.ListOfficeName = reader.GetSafeString(ordinalIndex++); openHouse.DefaultMediaURL = reader.GetSafeString(ordinalIndex++); openHouse.ListingKeyNumeric = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.OpenHouseKeyNumeric = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.OpenHouseDate = reader.GetSafeDateTime(ordinalIndex++); openHouse.OpenHouseStartTimeNumeric = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.OpenHouseEndTimeNumeric = reader.GetSafeInt32Nullable(ordinalIndex++); openHouse.OpenHouseStartTime = reader[ordinalIndex++] as TimeSpan?; openHouse.OpenHouseEndTime = reader[ordinalIndex++] as TimeSpan?; openHouse.OpenHouseStatus = reader.GetSafeString(ordinalIndex++); openHouse.OpenHouseStatusName = reader.GetSafeString(ordinalIndex++); openHouse.OpenHouseType = reader.GetSafeString(ordinalIndex++); openHouse.OpenHouseTypeName = reader.GetSafeString(ordinalIndex++); openHouse.OpenHouseDirections = reader.GetSafeString(ordinalIndex++); openHouse.OpenHouseRemarks = reader.GetSafeString(ordinalIndex++); openHouse.OpenHouseAttendedBy = reader.GetSafeString(ordinalIndex++); openHouse.Refreshments = reader.GetSafeString(ordinalIndex++); openHouse.DrawingYN = reader.GetSafeBool(ordinalIndex++); openHouse.DeletedYN = reader.GetSafeBool(ordinalIndex++); openHouse.VisitorCount = reader.GetSafeInt32(ordinalIndex++); return(openHouse); }
public OpenHouseBase Get(int id) { OpenHouseBase openHouse = new OpenHouseBase(); DataProvider.ExecuteCmd(GetConnection, "dbo.OpenHouses_SelectById" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", id); }, map : delegate(IDataReader reader, short set) { openHouse = MapOpenHouseReader(reader); } ); return(openHouse); }
public List <OpenHouseBase> GetActiveOpenHousesBySearch(OpenHouseDatesSearchRequest model) { List <OpenHouseBase> openHouseList = null; DataProvider.ExecuteCmd(GetConnection, "dbo.OpenHouses_SelectAllActiveBySearch" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@StartDate", model.StartDate); if (model.EndDate.HasValue && (model.EndDate > model.StartDate)) { paramCollection.AddWithValue("@EndDate", model.EndDate); } else { paramCollection.AddWithValue("@EndDate", null); } paramCollection.AddWithValue("@ListingKeyNumeric", model.ListingKeyNumeric); paramCollection.AddWithValue("@MlsListingId", model.MlsListingId); paramCollection.AddWithValue("@PostalCode", model.PostalCode); paramCollection.AddWithValue("@CityName", model.CityName); paramCollection.AddWithValue("@MaxRows", model.MaxRows); }, map : delegate(IDataReader reader, short set) { OpenHouseBase openHouse = MapOpenHouseReader(reader); if (openHouseList == null) { openHouseList = new List <OpenHouseBase>(); } openHouseList.Add(openHouse); } ); return(openHouseList); }