/// <summary>
        /// Creates a new AttachmentType record
        /// </summary>
        public static int Create(AttachmentTypeDO DO)
        {
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);

            _Description.Value = DO.Description;

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

            return DataCommon.ExecuteScalar("[dbo].[AttachmentType_Insert]", _params, "dbo");
        }
        /// <summary>
        /// Deletes a AttachmentType record
        /// </summary>
        public static int Delete(AttachmentTypeDO DO)
        {
            SqlParameter _AttachmentTypeID = new SqlParameter("AttachmentTypeID", SqlDbType.Int);

            _AttachmentTypeID.Value = DO.AttachmentTypeID;

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

            return DataCommon.ExecuteScalar("[dbo].[AttachmentType_Delete]", _params, "dbo");
        }
        /// <summary>
        /// Gets all AttachmentType records
        /// </summary>
        public static AttachmentTypeDO[] GetAll()
        {
            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[AttachmentType_GetAll]", new SqlParameter[] { }, "dbo");

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

            while(sr.Read()){

                AttachmentTypeDO obj = new AttachmentTypeDO();

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

                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Selects AttachmentType records by PK
        /// </summary>
        public static AttachmentTypeDO[] GetByPK(Int32 AttachmentTypeID)
        {
            SqlParameter _AttachmentTypeID = new SqlParameter("AttachmentTypeID", SqlDbType.Int);

            _AttachmentTypeID.Value = AttachmentTypeID;

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

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

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

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

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

                objs.Add(obj);
            }

            return objs.ToArray();
        }
        /// <summary>
        /// Updates a AttachmentType record and returns the number of records affected
        /// </summary>
        public static int Update(AttachmentTypeDO DO)
        {
            SqlParameter _AttachmentTypeID = new SqlParameter("AttachmentTypeID", SqlDbType.Int);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);

            _AttachmentTypeID.Value = DO.AttachmentTypeID;
            _Description.Value = DO.Description;

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

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