Пример #1
0
        /// <summary>
        /// Add a new asset to the database (or possibly update an existing item)
        /// </summary>
        /// <returns></returns>
        public int Add()
        {
            AuditWizardDataAccess lwDataAccess = new AuditWizardDataAccess();

            if (AssetID == 0)
            {
                // Add the asset to the database
                _assetID = lwDataAccess.AssetAdd(this);

                // ...and log this event in the audit trail
                AuditTrailEntry ate = new AuditTrailEntry();
                ate.Date      = DateTime.Now;
                ate.Class     = AuditTrailEntry.CLASS.asset;
                ate.Type      = AuditTrailEntry.TYPE.added;
                ate.Key       = _name;
                ate.AssetID   = _assetID;
                ate.AssetName = _name;
                ate.Username  = System.Environment.UserName;
                lwDataAccess.AuditTrailAdd(ate);
            }
            else
            {
                lwDataAccess.AssetUpdate(this);
            }
            return(0);
        }
Пример #2
0
        public int Update(Asset oldAsset)
        {
            AuditWizardDataAccess lwDataAccess = new AuditWizardDataAccess();

            if (this._assetID == 0)
            {
                return(Add());
            }
            else
            {
                lwDataAccess.AssetUpdate(this);
                AuditChanges(oldAsset);
            }
            return(0);
        }