Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new Address record
        /// </summary>
        public static int Create(AddressDO DO)
        {
            SqlParameter _AddressTypeID = new SqlParameter("AddressTypeID", SqlDbType.VarChar);
            SqlParameter _Address1 = new SqlParameter("Address1", SqlDbType.VarChar);
            SqlParameter _Address2 = new SqlParameter("Address2", SqlDbType.VarChar);
            SqlParameter _POBox = new SqlParameter("POBox", SqlDbType.VarChar);
            SqlParameter _City = new SqlParameter("City", SqlDbType.VarChar);
            SqlParameter _StateID = new SqlParameter("StateID", SqlDbType.VarChar);
            SqlParameter _Zipcode = new SqlParameter("Zipcode", SqlDbType.VarChar);

            _AddressTypeID.Value = DO.AddressTypeID;
            _Address1.Value = DO.Address1;
            _Address2.Value = DO.Address2;
            _POBox.Value = DO.POBox;
            _City.Value = DO.City;
            _StateID.Value = DO.StateID;
            _Zipcode.Value = DO.Zipcode;

            SqlParameter[] _params = new SqlParameter[] {
                _AddressTypeID,
                _Address1,
                _Address2,
                _POBox,
                _City,
                _StateID,
                _Zipcode
            };

            return DataCommon.ExecuteScalar("[dbo].[Address_Insert]", _params, "dbo");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes a Address record
        /// </summary>
        public static int Delete(AddressDO DO)
        {
            SqlParameter _AddressID = new SqlParameter("AddressID", SqlDbType.Int);

            _AddressID.Value = DO.AddressID;

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

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

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

            while(sr.Read()){

                AddressDO obj = new AddressDO();

                obj.AddressID = sr.GetInt32(sr.GetOrdinal("AddressID"));
                obj.AddressTypeID = sr.GetString(sr.GetOrdinal("AddressTypeID"));
                obj.Address1 = sr.GetString(sr.GetOrdinal("Address1"));
                obj.City = sr.GetString(sr.GetOrdinal("City"));
                obj.StateID = sr.GetString(sr.GetOrdinal("StateID"));
                obj.Zipcode = sr.GetString(sr.GetOrdinal("Zipcode"));
                if (sr.IsDBNull(sr.GetOrdinal("Address2"))) { obj.Address2 = null; } else { obj.Address2 = sr.GetString(sr.GetOrdinal("Address2")); }
                if (sr.IsDBNull(sr.GetOrdinal("POBox"))) { obj.POBox = null; } else { obj.POBox = sr.GetString(sr.GetOrdinal("POBox")); }

                objs.Add(obj);
            }

            return objs.ToArray();
        }