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