コード例 #1
0
        public List <SYS_Region_Province> SelectAllSYS_Region_Province()
        {
            List <SYS_Region_Province> sys_region_province = new List <SYS_Region_Province>();
            DbDataReader reader = null;
            DbConnection conn   = _DbHelper.CreateConnection(Common.ConnectionString);

            conn.Open();
            try
            {
                reader = _DbHelper.ExecuteReader(conn, Common.DatabaseSchema + "[SYS_Region_Province_SelectAll]", (DbParameter[])null);
                if (reader.HasRows)
                {
                    SYS_Region_ProvinceDataAccess.SetListSYS_Region_ProvinceInfo(ref reader, ref sys_region_province);
                }
                return(sys_region_province);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format(" SYS_Region_ProvinceDataAccess.SelectAll: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
コード例 #2
0
        public SYS_Region_Province SelectSYS_Region_Province(int ID)
        {
            SYS_Region_Province sys_region_province = new SYS_Region_Province();
            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_Region_Province_SelectById]", para.ToArray());
                if (reader.HasRows && reader.Read())
                {
                    SYS_Region_ProvinceDataAccess.SetSYS_Region_ProvinceInfo(reader, ref sys_region_province);
                }
                return(sys_region_province);
            }
            catch (Exception ex)
            {
                throw new Exception(String.Format("SYS_Region_ProvinceDataAccess.SelectById: {0}", ex.Message));
            }
            finally
            {
                if (reader != null)
                {
                    reader.Close();
                }
                conn.Close();
            }
        }
コード例 #3
0
        private static void SetListSYS_Region_ProvinceInfo(ref DbDataReader reader, ref List <SYS_Region_Province> sys_region_provinces)
        {
            SYS_Region_Province sys_region_province = null;

            while (reader.Read())
            {
                sys_region_province = new SYS_Region_Province();
                SYS_Region_ProvinceDataAccess.SetSYS_Region_ProvinceInfo(reader, ref sys_region_province);
                sys_region_provinces.Add(sys_region_province);
            }
        }