public static RehaulFactoryStationData GetRehaulFactoryStationData(int factoryID, DateTime rehaulDate) { const string METHOD_NAME = "GetRehaulFactoryStationData"; string cacheKey = "RehaulFactoryStationData"; string filePath = ""; RehaulFactoryStationData rehaulData = null; try { rehaulData = (RehaulFactoryStationData)HttpRuntime.Cache.Get(cacheKey); if (rehaulData == null) { rehaulData = new RehaulFactoryStationData(); filePath = WSCIEMP.Common.AppHelper.AppPath() + @"ZHost/XML/RehaulFactoryStation.xml"; rehaulData.Load(filePath); HttpRuntime.Cache.Insert(cacheKey, rehaulData, new CacheDependency(filePath)); } // Always check database for data. SqlDataReader dr = null; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LimsConn"].ToString())) { string procName = "stapRehaulDailyGetEntry"; if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); } System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false); spParams[0].Value = factoryID; spParams[1].Value = rehaulDate; dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams); rehaulData.FillFactoryDetail((factoryID * 10).ToString(), dr); } return(rehaulData); } catch (Exception ex) { string errMsg = MOD_NAME + METHOD_NAME + "; factoryID: " + factoryID.ToString() + "; rehaulDate: " + rehaulDate.ToString(); WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex); throw (wscEx); } }
public static RehaulFactoryStationData GetRehaulFactoryStationData(int factoryID, DateTime rehaulDate) { const string METHOD_NAME = "GetRehaulFactoryStationData"; string cacheKey = "RehaulFactoryStationData"; string filePath = ""; RehaulFactoryStationData rehaulData = null; try { rehaulData = (RehaulFactoryStationData)HttpRuntime.Cache.Get(cacheKey); if (rehaulData == null) { rehaulData = new RehaulFactoryStationData(); filePath = WSCIEMP.Common.AppHelper.AppPath() + @"ZHost/XML/RehaulFactoryStation.xml"; rehaulData.Load(filePath); HttpRuntime.Cache.Insert(cacheKey, rehaulData, new CacheDependency(filePath)); } // Always check database for data. SqlDataReader dr = null; using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["LimsConn"].ToString())) { string procName = "stapRehaulDailyGetEntry"; if (conn.State != System.Data.ConnectionState.Open) { conn.Open(); } System.Data.SqlClient.SqlParameter[] spParams = SqlHelperParameterCache.GetSpParameterSet(conn, procName, false); spParams[0].Value = factoryID; spParams[1].Value = rehaulDate; dr = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, procName, spParams); rehaulData.FillFactoryDetail((factoryID * 10).ToString(), dr); } return rehaulData; } catch (Exception ex) { string errMsg = MOD_NAME + METHOD_NAME + "; factoryID: " + factoryID.ToString() + "; rehaulDate: " + rehaulDate.ToString(); WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex); throw (wscEx); } }