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