Exemplo n.º 1
0
        //-----------------------------------------------------------
        #region Method
        private List <Warranty> Init(SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <Warranty> l_Warranty = new List <Warranty>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    Warranty m_Warranty = new Warranty();
                    m_Warranty.WarrantyId   = smartReader.GetInt16("WarrantyId");
                    m_Warranty.WarrantyName = smartReader.GetString("WarrantyName");
                    m_Warranty.WarrantyDesc = smartReader.GetString("WarrantyDesc");
                    m_Warranty.DisplayOrder = smartReader.GetInt16("DisplayOrder");
                    l_Warranty.Add(m_Warranty);
                }
                reader.Close();
                return(l_Warranty);
            }
            catch (SqlException err)
            {
                throw new ApplicationException("Data error: " + err.Message);
            }
            finally
            {
                db.closeConnection(con);
            }
        }
Exemplo n.º 2
0
        //--------------------------------------------------------------
        public static string Static_GetDisplayString(short WarrantyId)
        {
            string   RetVal     = "";
            Warranty m_Warranty = new Warranty();

            m_Warranty.WarrantyId = WarrantyId;
            m_Warranty            = m_Warranty.Get();
            RetVal = m_Warranty.WarrantyName;
            return(RetVal);
        }
Exemplo n.º 3
0
        //--------------------------------------------------------------
        public Warranty Get()
        {
            Warranty retVal     = new Warranty();
            int      RowCount   = 0;
            string   DateFrom   = "";
            string   DateTo     = "";
            string   OrderBy    = "";
            int      PageSize   = 1;
            int      PageNumber = 0;

            try
            {
                List <Warranty> list = GetPage(DateFrom, DateTo, OrderBy, PageSize, PageNumber, ref RowCount);
                if (list.Count > 0)
                {
                    retVal = list[0];
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(retVal);
        }