//----------------------------------------------------------------------- private List <CategoryStatus> Init(string LogFilePath, string LogFileName, SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <CategoryStatus> l_CategoryStatus = new List <CategoryStatus>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { CategoryStatus m_CategoryStatus = new CategoryStatus(db.ConnectionString); m_CategoryStatus.CategoryStatusId = smartReader.GetByte("CategoryStatusId"); m_CategoryStatus.CategoryStatusName = smartReader.GetString("CategoryStatusName"); m_CategoryStatus.CategoryStatusDesc = smartReader.GetString("CategoryStatusDesc"); l_CategoryStatus.Add(m_CategoryStatus); } smartReader.disposeReader(reader); db.closeConnection(con); } catch (SqlException ex) { LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name); } return(l_CategoryStatus); }
//----------------------------------------------------------------------- public CategoryStatus Get(List <CategoryStatus> lCategoryStatus, byte CategoryStatusId) { CategoryStatus RetVal = new CategoryStatus(db.ConnectionString); foreach (CategoryStatus mCategoryStatus in lCategoryStatus) { if (mCategoryStatus.CategoryStatusId == CategoryStatusId) { RetVal = mCategoryStatus; break; } } return(RetVal); }
//----------------------------------------------------------------------- public CategoryStatus Get(string LogFilePath, string LogFileName, byte CategoryStatusId) { CategoryStatus RetVal = new CategoryStatus(db.ConnectionString); try { List <CategoryStatus> list = GetListByCategoryStatusId(LogFilePath, LogFileName, CategoryStatusId); if (list.Count > 0) { RetVal = (CategoryStatus)list[0]; } } catch (Exception ex) { LogFiles.WriteLog(ex.Message, LogFilePath + "\\Exception", LogFileName + "." + this.GetType().Name + "." + MethodBase.GetCurrentMethod().Name); } return(RetVal); }