Ejemplo n.º 1
0
        /// <summary>
        /// Deletes a County record
        /// </summary>
        public static int Delete(CountyDO DO)
        {
            SqlParameter _CountyID = new SqlParameter("CountyID", SqlDbType.Int);

            _CountyID.Value = DO.CountyID;

            SqlParameter[] _params = new SqlParameter[] {
                _CountyID
            };

            return DataCommon.ExecuteScalar("[dbo].[County_Delete]", _params, "dbo");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a new County record
        /// </summary>
        public static int Create(CountyDO DO)
        {
            SqlParameter _FIPSStateID = new SqlParameter("FIPSStateID", SqlDbType.VarChar);
            SqlParameter _FIPSCountyID = new SqlParameter("FIPSCountyID", SqlDbType.VarChar);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);

            _FIPSStateID.Value = DO.FIPSStateID;
            _FIPSCountyID.Value = DO.FIPSCountyID;
            _Description.Value = DO.Description;

            SqlParameter[] _params = new SqlParameter[] {
                _FIPSStateID,
                _FIPSCountyID,
                _Description
            };

            return DataCommon.ExecuteScalar("[dbo].[County_Insert]", _params, "dbo");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets all County records
        /// </summary>
        public static CountyDO[] GetAll()
        {
            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[County_GetAll]", new SqlParameter[] { }, "dbo");

            List<CountyDO> objs = new List<CountyDO>();

            while(sr.Read()){

                CountyDO obj = new CountyDO();

                obj.CountyID = sr.GetInt32(sr.GetOrdinal("CountyID"));
                obj.FIPSStateID = sr.GetString(sr.GetOrdinal("FIPSStateID"));
                obj.FIPSCountyID = sr.GetString(sr.GetOrdinal("FIPSCountyID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Selects County records by PK
        /// </summary>
        public static CountyDO[] GetByPK(Int32 CountyID)
        {
            SqlParameter _CountyID = new SqlParameter("CountyID", SqlDbType.Int);

            _CountyID.Value = CountyID;

            SqlParameter[] _params = new SqlParameter[] {
                _CountyID
            };

            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[County_GetByPK]", _params, "dbo");

            List<CountyDO> objs = new List<CountyDO>();

            while(sr.Read())
            {
                CountyDO obj = new CountyDO();

                obj.CountyID = sr.GetInt32(sr.GetOrdinal("CountyID"));
                obj.FIPSStateID = sr.GetString(sr.GetOrdinal("FIPSStateID"));
                obj.FIPSCountyID = sr.GetString(sr.GetOrdinal("FIPSCountyID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }