Example #1
0
        /// <summary>
        /// Update this supplier defininition in the database
        /// </summary>
        /// <returns></returns>
        public int Update(Supplier oldSupplier)
        {
            SuppliersDAO lwDataAccess = new SuppliersDAO();

            if (this._supplierID == 0)
            {
                Add();
            }
            else
            {
                lwDataAccess.SupplierUpdate(this);
                AuditChanges(oldSupplier);
            }

            return(0);
        }
Example #2
0
        /// <summary>
        /// Delete the current license from the database
        /// </summary>
        public void Delete()
        {
            // Delete from the database
            SuppliersDAO lwDataAccess = new SuppliersDAO();

            lwDataAccess.SupplierDelete(this);

            // ...and audit the deletion
            AuditTrailEntry ate = new AuditTrailEntry();

            ate.Date      = DateTime.Now;
            ate.Class     = AuditTrailEntry.CLASS.supplier;
            ate.Type      = AuditTrailEntry.TYPE.deleted;
            ate.Key       = _name;
            ate.AssetID   = 0;
            ate.AssetName = "";
            ate.Username  = System.Environment.UserName;
            new AuditTrailDAO().AuditTrailAdd(ate);
        }
Example #3
0
        /// <summary>
        /// Add this supplier to the database
        /// </summary>
        /// <returns></returns>
        public int Add()
        {
            int status = -1;

            // If this SUPPLIER already exists then call the update instead
            if (_supplierID != 0)
            {
                return(Update(null));
            }

            // Add the supplier to the database
            SuppliersDAO lwDataAccess = new SuppliersDAO();
            int          supplierID   = lwDataAccess.SupplierAdd(this);

            if (supplierID != 0)
            {
                AuditChanges(null);
                _supplierID = supplierID;
                status      = 0;
            }

            return(status);
        }