public static Performance[] GetPerformances(DateTime startDate, DateTime endDate) { if (HttpContext.Current.Session[TessSessionKeySessionKey] == null || HttpContext.Current.Session[ModeOfSaleSessionKey] == null) MaintainTessSession(); Performance[] perfs = null; // Performance[] perfs= (Performance[])HttpContext.Current.Cache[PerformancesCacheKey]; if (perfs == null) { string sessionKey = HttpContext.Current.Session[TessSessionKeySessionKey].ToString(); short modeOfSale = (short)HttpContext.Current.Session[ModeOfSaleSessionKey]; DataSet results = unsecuredClient.GetPerformancesEx4( sWebSessionId: sessionKey, sStartDate: startDate.ToString("yyyy-MM-ddTHH:mm:ss"), sEndDate: endDate.ToString("yyyy-MM-ddTHH:mm:ss"), iVenueID: (short)-1, iModeOfSale: modeOfSale, iBusinessUnit: defaultBusinessUnit, sSortString: "", sKeywords: "", cKeywordAndOrStatement: "", sArtistLastName: "", sFullText: "", sFullTextType: "", sContentType: "", sPerformanceIds: "", sSeasonIds: "", bIncludeSeatCounts: false); DataRowCollection resultRows = results.Tables[0].Rows; perfs = new Performance[resultRows.Count]; for (int i = 0; i < resultRows.Count; i++) { perfs[i] = new Performance( Convert.ToInt32(resultRows[i]["perf_no"]), resultRows[i]["description"].ToString(), Convert.ToInt32(resultRows[i]["prod_season_no"]), Convert.ToInt16(resultRows[i]["prod_type"]), Convert.ToDateTime(resultRows[i]["perf_date"]), Convert.ToInt32(resultRows[i]["facility_no"]), results.Tables["WebContent"]); } HttpContext.Current.Cache.Insert(PerformancesCacheKey, perfs, null, DateTime.Now.AddMinutes(10), TimeSpan.Zero); } return perfs; }
public static Performance GetPerformance(int perfId) { //foreach (Performance perf in GetPerformances()) //{ // if (perf.Id == perfId) // return perf; //} if (HttpContext.Current.Session[TessSessionKeySessionKey] == null || HttpContext.Current.Session[ModeOfSaleSessionKey] == null) MaintainTessSession(); string sessionKey = HttpContext.Current.Session[TessSessionKeySessionKey].ToString(); short modeOfSale = (short)HttpContext.Current.Session[ModeOfSaleSessionKey]; DataSet results = unsecuredClient.GetPerformanceDetail( iPerf_no:perfId, iModeOfSale: modeOfSale); DataRowCollection resultRows = results.Tables[0].Rows; Performance perf=null; if(resultRows.Count>0) { perf = new Performance( perfId, resultRows[0]["description"].ToString(), Convert.ToInt32(resultRows[0]["prod_season_no"]), Convert.ToInt16(resultRows[0]["perf_type_id"]), Convert.ToDateTime(resultRows[0]["perf_dt"]), Convert.ToInt32(resultRows[0]["facility_no"]), results.Tables["WebContent"]); } return perf; }