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