//----------------------------------------------------------- #region Method private List <SectionServiceError> Init(SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <SectionServiceError> l_SectionServiceError = new List <SectionServiceError>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { SectionServiceError m_SectionServiceError = new SectionServiceError(); m_SectionServiceError.SectionServiceErrorId = smartReader.GetInt32("SectionServiceErrorId"); m_SectionServiceError.SectionServiceId = smartReader.GetInt32("SectionServiceId"); m_SectionServiceError.SectionErrorId = smartReader.GetInt32("SectionErrorId"); m_SectionServiceError.ErrorContent = smartReader.GetString("ErrorContent"); m_SectionServiceError.StatusId = smartReader.GetByte("StatusId"); l_SectionServiceError.Add(m_SectionServiceError); } reader.Close(); return(l_SectionServiceError); } catch (SqlException err) { throw new ApplicationException("Data error: " + err.Message); } finally { db.closeConnection(con); } }
//-------------------------------------------------------------- public static string Static_GetDisplayString(int SectionServiceErrorId) { string RetVal = ""; SectionServiceError m_SectionServiceError = new SectionServiceError(); m_SectionServiceError.SectionServiceErrorId = SectionServiceErrorId; m_SectionServiceError = m_SectionServiceError.Get(); RetVal = m_SectionServiceError.SectionServiceErrorName; return(RetVal); }
//-------------------------------------------------------------- public SectionServiceError Get() { SectionServiceError retVal = new SectionServiceError(); int RowCount = 0; string DateFrom = ""; string DateTo = ""; string OrderBy = ""; int PageSize = 1; int PageNumber = 0; try { List <SectionServiceError> list = GetPage(DateFrom, DateTo, OrderBy, PageSize, PageNumber, ref RowCount); if (list.Count > 0) { retVal = list[0]; } } catch (Exception ex) { throw ex; } return(retVal); }