public static List <StoreFilter> GetStoreFilterListByFilter(string filter, int companyId) { List <StoreFilter> list = new List <StoreFilter>(); Database db = DatabaseFactory.CreateDatabase("Spar-StoreRep"); string sqlCommand = "GetStoreFilterListByFilter"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "@Filter", DbType.String, filter); db.AddInParameter(dbCommand, "@CompanyId", DbType.Int32, companyId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { StoreFilter storeFilter = new StoreFilter(); storeFilter.StoreFilterId = Convert.ToInt32(dataReader["StoreFilterId"]); storeFilter.FileStoreDescription = dataReader["FileStoreDescription"].ToString(); storeFilter.FileSPARStoreId = dataReader["FileSPARStoreId"].ToString(); storeFilter.FileDivision = dataReader["FileDivision"].ToString(); storeFilter.FileRegion = dataReader["FileRegion"].ToString(); storeFilter.FileZone = dataReader["FileZone"].ToString(); storeFilter.FilePCRegion = dataReader["FilePCRegion"].ToString(); storeFilter.FilePCZone = dataReader["FilePCZone"].ToString(); storeFilter.Filter = dataReader["Filter"].ToString(); storeFilter.AS400 = dataReader["AS400"].ToString(); storeFilter.InternalCode = dataReader["InternalCode"].ToString(); list.Add(storeFilter); } } return(list); }
//public string FormattedDescription //{ // get { return (String.Format("{0} - {1} - {2}", this.Location, this.region, this.description)); } //} #endregion #region Static Methods public static StoreFilter GetStoreFilterByStoreFilterId(int storeFilterId) { Database db = DatabaseFactory.CreateDatabase("Spar-StoreRep"); string sqlCommand = "GetStoreFilterByStoreFilterId"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "@StoreFilterId", DbType.Int32, storeFilterId); db.AddOutParameter(dbCommand, "@FileStoreDescription", DbType.String, 200); db.AddOutParameter(dbCommand, "@FileSPARStoreId", DbType.String, 200); db.AddOutParameter(dbCommand, "@FileDivision", DbType.String, 200); db.AddOutParameter(dbCommand, "@FileRegion", DbType.String, 200); db.AddOutParameter(dbCommand, "@FileZone", DbType.String, 200); db.AddOutParameter(dbCommand, "@FilePCRegion", DbType.String, 200); db.AddOutParameter(dbCommand, "@FilePCZone", DbType.String, 200); db.AddOutParameter(dbCommand, "@Filter", DbType.String, 500); db.AddOutParameter(dbCommand, "@AS400", DbType.String, 50); db.AddOutParameter(dbCommand, "@InternalCode", DbType.String, 50); db.ExecuteNonQuery(dbCommand); StoreFilter storeFilter = new StoreFilter(); storeFilter.StoreFilterId = storeFilterId; storeFilter.FileStoreDescription = db.GetParameterValue(dbCommand, "FileStoreDescription").ToString(); storeFilter.FileSPARStoreId = db.GetParameterValue(dbCommand, "FileSPARStoreId").ToString(); storeFilter.FileDivision = db.GetParameterValue(dbCommand, "FileDivision").ToString(); storeFilter.FileRegion = db.GetParameterValue(dbCommand, "FileRegion").ToString(); storeFilter.FileZone = db.GetParameterValue(dbCommand, "FileZone").ToString(); storeFilter.FilePCRegion = db.GetParameterValue(dbCommand, "FilePCRegion").ToString(); storeFilter.FilePCZone = db.GetParameterValue(dbCommand, "FilePCZone").ToString(); storeFilter.Filter = db.GetParameterValue(dbCommand, "Filter").ToString(); storeFilter.AS400 = db.GetParameterValue(dbCommand, "AS400").ToString(); storeFilter.InternalCode = db.GetParameterValue(dbCommand, "InternalCode").ToString(); return(storeFilter); }
public static List <StoreFilter> GetStoreFilterList(int companyId) { List <StoreFilter> list = new List <StoreFilter>(); Database db = DatabaseFactory.CreateDatabase("Spar-StoreRep"); string sqlCommand = "GetStoreFilterList"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "@CompanyId", DbType.Int32, companyId); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { StoreFilter storeFilter = new StoreFilter(); storeFilter.Filter = dataReader["Filter"].ToString(); list.Add(storeFilter); } } return(list); }