コード例 #1
0
ファイル: CustomerFields.cs プロジェクト: hieuhan/Database
        //-----------------------------------------------------------
        #region Method
        private List <CustomerFields> Init(SqlCommand cmd)
        {
            SqlConnection con = db.getConnection();

            cmd.Connection = con;
            List <CustomerFields> l_CustomerFields = new List <CustomerFields>();

            try
            {
                con.Open();
                SqlDataReader   reader      = cmd.ExecuteReader();
                SmartDataReader smartReader = new SmartDataReader(reader);
                while (smartReader.Read())
                {
                    CustomerFields m_CustomerFields = new CustomerFields();
                    m_CustomerFields.CustomerFieldId = smartReader.GetInt32("CustomerFieldId");
                    m_CustomerFields.CustomerId      = smartReader.GetInt32("CustomerId");
                    m_CustomerFields.FieldId         = smartReader.GetInt16("FieldId");
                    m_CustomerFields.DocGroupId      = smartReader.GetByte("DocGroupId");
                    m_CustomerFields.DisplayOrder    = smartReader.GetInt16("DisplayOrder");
                    m_CustomerFields.CrDateTime      = smartReader.GetDateTime("CrDateTime");
                    l_CustomerFields.Add(m_CustomerFields);
                }
                reader.Close();
                return(l_CustomerFields);
            }
            catch (SqlException err)
            {
                throw new ApplicationException("Data error: " + err.Message);
            }
            finally
            {
                db.closeConnection(con);
            }
        }
コード例 #2
0
ファイル: CustomerFields.cs プロジェクト: hieuhan/Database
        //--------------------------------------------------------------
        public static string Static_GetDisplayString(int CustomerFieldId)
        {
            string         RetVal           = "";
            CustomerFields m_CustomerFields = new CustomerFields();

            m_CustomerFields.CustomerFieldId = CustomerFieldId;
            m_CustomerFields = m_CustomerFields.Get();
            RetVal           = m_CustomerFields.CustomerFieldName;
            return(RetVal);
        }
コード例 #3
0
ファイル: CustomerFields.cs プロジェクト: hieuhan/Database
        //--------------------------------------------------------------
        public CustomerFields Get()
        {
            CustomerFields retVal     = new CustomerFields();
            int            RowCount   = 0;
            string         DateFrom   = "";
            string         DateTo     = "";
            string         OrderBy    = "";
            int            PageSize   = 1;
            int            PageNumber = 0;

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