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