Ejemplo n.º 1
0
        /// <summary>
        /// Creates a new CompanyName record
        /// </summary>
        public static int Create(CompanyNameDO DO)
        {
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);

            _Description.Value = DO.Description;

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

            return DataCommon.ExecuteScalar("[dbo].[CompanyName_Insert]", _params, "dbo");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes a CompanyName record
        /// </summary>
        public static int Delete(CompanyNameDO DO)
        {
            SqlParameter _CompanyNameID = new SqlParameter("CompanyNameID", SqlDbType.Int);

            _CompanyNameID.Value = DO.CompanyNameID;

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

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

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

            while(sr.Read()){

                CompanyNameDO obj = new CompanyNameDO();

                obj.CompanyNameID = sr.GetInt32(sr.GetOrdinal("CompanyNameID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));

                objs.Add(obj);
            }

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

            _CompanyNameID.Value = CompanyNameID;

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

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

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

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

                obj.CompanyNameID = sr.GetInt32(sr.GetOrdinal("CompanyNameID"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));

                objs.Add(obj);
            }

            return objs.ToArray();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Updates a CompanyName record and returns the number of records affected
        /// </summary>
        public static int Update(CompanyNameDO DO)
        {
            SqlParameter _CompanyNameID = new SqlParameter("CompanyNameID", SqlDbType.Int);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);

            _CompanyNameID.Value = DO.CompanyNameID;
            _Description.Value = DO.Description;

            SqlParameter[] _params = new SqlParameter[] {
                _CompanyNameID,
                _Description
            };

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