示例#1
0
        /// <summary>
        /// Deletes a Attachment record
        /// </summary>
        public static int Delete(AttachmentDO DO)
        {
            SqlParameter _AttachmentID = new SqlParameter("AttachmentID", SqlDbType.Int);

            _AttachmentID.Value = DO.AttachmentID;

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

            return DataCommon.ExecuteScalar("[dbo].[Attachment_Delete]", _params, "dbo");
        }
示例#2
0
        /// <summary>
        /// Creates a new Attachment record
        /// </summary>
        public static int Create(AttachmentDO DO)
        {
            SqlParameter _AttachmentTypeID = new SqlParameter("AttachmentTypeID", SqlDbType.Int);
            SqlParameter _PermitKey = new SqlParameter("PermitKey", SqlDbType.Int);
            SqlParameter _DateUploaded = new SqlParameter("DateUploaded", SqlDbType.DateTime);
            SqlParameter _User = new SqlParameter("User", SqlDbType.VarChar);
            SqlParameter _FileSize = new SqlParameter("FileSize", SqlDbType.Int);
            SqlParameter _Description = new SqlParameter("Description", SqlDbType.VarChar);
            SqlParameter _FileLocation = new SqlParameter("FileLocation", SqlDbType.VarChar);
            SqlParameter _URL = new SqlParameter("URL", SqlDbType.VarChar);
            SqlParameter _TOCLayerID = new SqlParameter("TOCLayerID", SqlDbType.Int);

            _AttachmentTypeID.Value = DO.AttachmentTypeID;
            _PermitKey.Value = DO.PermitKey;
            _DateUploaded.Value = DO.DateUploaded;
            _User.Value = DO.User;
            _FileSize.Value = DO.FileSize;
            _Description.Value = DO.Description;
            _FileLocation.Value = DO.FileLocation;
            _URL.Value = DO.URL;
            _TOCLayerID.Value = DO.TOCLayerID;

            SqlParameter[] _params = new SqlParameter[] {
                _AttachmentTypeID,
                _PermitKey,
                _DateUploaded,
                _User,
                _FileSize,
                _Description,
                _FileLocation,
                _URL,
                _TOCLayerID
            };

            return DataCommon.ExecuteScalar("[dbo].[Attachment_Insert]", _params, "dbo");
        }
示例#3
0
        /// <summary>
        /// Gets all Attachment records
        /// </summary>
        public static AttachmentDO[] GetAll()
        {
            SafeReader sr = DataCommon.ExecuteSafeReader("[dbo].[Attachment_GetAll]", new SqlParameter[] { }, "dbo");

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

            while(sr.Read()){

                AttachmentDO obj = new AttachmentDO();

                obj.AttachmentID = sr.GetInt32(sr.GetOrdinal("AttachmentID"));
                obj.AttachmentTypeID = sr.GetInt32(sr.GetOrdinal("AttachmentTypeID"));
                obj.PermitKey = sr.GetInt32(sr.GetOrdinal("PermitKey"));
                obj.DateUploaded = sr.GetDateTime(sr.GetOrdinal("DateUploaded"));
                obj.User = sr.GetString(sr.GetOrdinal("User"));
                obj.FileSize = sr.GetInt32(sr.GetOrdinal("FileSize"));
                obj.Description = sr.GetString(sr.GetOrdinal("Description"));
                obj.FileLocation = sr.GetString(sr.GetOrdinal("FileLocation"));
                obj.URL = sr.GetString(sr.GetOrdinal("URL"));
                if (sr.IsDBNull(sr.GetOrdinal("TOCLayerID"))) { obj.TOCLayerID = null; } else { obj.TOCLayerID = sr.GetInt32(sr.GetOrdinal("TOCLayerID")); }

                objs.Add(obj);
            }

            return objs.ToArray();
        }