예제 #1
0
        public SYS_CCU SelectSYS_CCU(int ID)
        {
            SYS_CCU      sys_ccu = new SYS_CCU();
            DbDataReader reader  = null;
            DbConnection conn    = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            try
            {
                List <DbParameter> para = new List <DbParameter>();
                para.Add(_DbHelper.CreateParameter(FIELD_ID, ID, false));

                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_CCU_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_CCUDataAccess.SetSYS_CCUInfo(reader, ref sys_ccu);
                }
                return(sys_ccu);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_CCUDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
예제 #2
0
        public BindingList <SYS_CCU> SelectBindingAllSYS_CCU()
        {
            BindingList <SYS_CCU> sys_ccu = new BindingList <SYS_CCU>();
            DbDataReader          reader  = null;
            DbConnection          conn    = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            try
            {
                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_CCU_SelectAll]", (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_CCUDataAccess.SetBindingListSYS_CCUInfo(ref reader, ref sys_ccu);
                }
                return(sys_ccu);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_CCUDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
예제 #3
0
        public List <SYS_CCU> SelectAllSYS_CCU_ByDateTime(DateTime TuDateTime, DateTime DenDateTime)
        {
            List <SYS_CCU> sys_ccu = new List <SYS_CCU>();
            DbDataReader   reader  = null;
            DbConnection   conn    = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            try
            {
                List <DbParameter> para = new List <DbParameter>();

                para.Add(_DbHelper.CreateParameter("TuDateTime", TuDateTime, false));
                para.Add(_DbHelper.CreateParameter("DenDateTime", DenDateTime, false));

                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SelectAllSYS_CCU_ByDateTime]", para.ToArray());
                if (reader.HasRows)
                {
                    SYS_CCUDataAccess.SetListSYS_CCUInfo(ref reader, ref sys_ccu);
                }
                return(sys_ccu);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_CCUDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
예제 #4
0
        private static void SetBindingListSYS_CCUInfo(ref DbDataReader reader, ref BindingList <SYS_CCU> sys_ccus)
        {
            SYS_CCU sys_ccu = null;

            while (reader.Read())
            {
                sys_ccu = new SYS_CCU();
                SYS_CCUDataAccess.SetSYS_CCUInfo(reader, ref sys_ccu);
                sys_ccus.Add(sys_ccu);
            }
        }