//----------------------------------------------------------- #region Method private List <CustomerGroups> Init(SqlCommand cmd) { SqlConnection con = db.getConnection(); cmd.Connection = con; List <CustomerGroups> l_CustomerGroups = new List <CustomerGroups>(); try { con.Open(); SqlDataReader reader = cmd.ExecuteReader(); SmartDataReader smartReader = new SmartDataReader(reader); while (smartReader.Read()) { CustomerGroups m_CustomerGroups = new CustomerGroups(); m_CustomerGroups.CustomerGroupId = smartReader.GetInt16("CustomerGroupId"); m_CustomerGroups.CustomerGroupName = smartReader.GetString("CustomerGroupName"); m_CustomerGroups.CustomerGroupDesc = smartReader.GetString("CustomerGroupDesc"); m_CustomerGroups.CrUserId = smartReader.GetInt32("CrUserId"); m_CustomerGroups.CrDateTime = smartReader.GetDateTime("CrDateTime"); l_CustomerGroups.Add(m_CustomerGroups); } reader.Close(); return(l_CustomerGroups); } catch (SqlException err) { throw new ApplicationException("Data error: " + err.Message); } finally { db.closeConnection(con); } }
//-------------------------------------------------------------- public static string Static_GetDisplayString(short CustomerGroupId) { string RetVal = ""; CustomerGroups m_CustomerGroups = new CustomerGroups(); m_CustomerGroups.CustomerGroupId = CustomerGroupId; m_CustomerGroups = m_CustomerGroups.Get(); RetVal = m_CustomerGroups.CustomerGroupName; return(RetVal); }
//-------------------------------------------------------------- public CustomerGroups Get() { CustomerGroups retVal = new CustomerGroups(); int RowCount = 0; string DateFrom = ""; string DateTo = ""; string OrderBy = ""; int PageSize = 1; int PageNumber = 0; try { List <CustomerGroups> list = GetPage(DateFrom, DateTo, OrderBy, PageSize, PageNumber, ref RowCount); if (list.Count > 0) { retVal = list[0]; } } catch (Exception ex) { throw ex; } return(retVal); }