Exemplo n.º 1
0
        /// <summary>
        /// Deletes a State record
        /// </summary>
        public static int Delete(StateDO DO)
        {
            SqlParameter _StateID = new SqlParameter("StateID", SqlDbType.VarChar);

            _StateID.Value = DO.StateID;

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

            return DataCommon.ExecuteScalar("[dbo].[State_Delete]", _params, "dbo");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a new State record
        /// </summary>
        public static void Create(StateDO DO)
        {
            SqlParameter _StateID = new SqlParameter("StateID", SqlDbType.VarChar);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            SqlParameter _FIPSStateID = new SqlParameter("FIPSStateID", SqlDbType.VarChar);

            _StateID.Value = DO.StateID;
            _Description.Value = DO.Description;
            _FIPSStateID.Value = DO.FIPSStateID;

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

            DataCommon.ExecuteNonQuery("[dbo].[State_Insert]", _params, "dbo");
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets all State records
        /// </summary>
        public static StateDO[] GetAll()
        {
            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[State_GetAll]", new SqlParameter[] { }, "dbo");

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

            while(sr.Read()){

                StateDO obj = new StateDO();

                obj.StateID = sr.GetString(sr.GetOrdinal("StateID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                obj.FIPSStateID = sr.GetString(sr.GetOrdinal("FIPSStateID"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Selects State records by PK
        /// </summary>
        public static StateDO[] GetByPK(String StateID)
        {
            SqlParameter _StateID = new SqlParameter("StateID", SqlDbType.VarChar);

            _StateID.Value = StateID;

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

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

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

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

                obj.StateID = sr.GetString(sr.GetOrdinal("StateID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                obj.FIPSStateID = sr.GetString(sr.GetOrdinal("FIPSStateID"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Updates a State record and returns the number of records affected
        /// </summary>
        public static int Update(StateDO DO)
        {
            SqlParameter _StateID = new SqlParameter("StateID", SqlDbType.VarChar);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            SqlParameter _FIPSStateID = new SqlParameter("FIPSStateID", SqlDbType.VarChar);

            _StateID.Value = DO.StateID;
            _Description.Value = DO.Description;
            _FIPSStateID.Value = DO.FIPSStateID;

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

            return DataCommon.ExecuteScalar("[dbo].[State_Update]", _params, "dbo");
        }