示例#1
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 /// <param name="other"></param>
 public Asset(Asset other)
 {
     _assetID          = other.AssetID;
     _parentAssetID    = other._parentAssetID;
     _uniqueID         = other._uniqueID;
     _name             = other._name;
     _location         = other._location;
     _fullLocation     = other._fullLocation;
     _locationID       = other._locationID;
     _domain           = other._domain;
     _domainID         = other._domainID;
     _ipaddress        = other._ipaddress;
     _lastAudit        = other._lastAudit;
     _requestaudit     = other._requestaudit;
     _agentStatus      = other._agentStatus;
     _agentVersion     = other._agentVersion;
     _assetTypeID      = other._assetTypeID;
     _assetTypeName    = other._assetTypeName;
     _macAddress       = other._macAddress;
     _make             = other._make;
     _model            = other._model;
     _serial           = other._serial;
     _icon             = other._icon;
     _auditable        = other._auditable;
     _alerts_enabled   = other._alerts_enabled;
     _tag              = other._tag;
     _stockStatus      = other._stockStatus;
     _supplierID       = other._supplierID;
     _supplierName     = other._supplierName;
     _listAuditedItems = other._listAuditedItems;
     _listFolders      = other._listFolders;
     _childAssets      = other._childAssets;
 }
示例#2
0
 public Asset()
 {
     _assetID        = 0;
     _parentAssetID  = 0;
     _uniqueID       = "";
     _name           = "";
     _location       = "";
     _fullLocation   = "";
     _locationID     = 1;
     _domain         = "<None>";
     _domainID       = 1;
     _ipaddress      = "";
     _lastAudit      = new DateTime(0L);
     _requestaudit   = false;
     _agentStatus    = AGENTSTATUS.notdeployed;
     _agentVersion   = "";
     _assetTypeID    = 2;
     _assetTypeName  = "";
     _macAddress     = "";
     _make           = "";
     _model          = "";
     _serial         = "";
     _icon           = "";
     _auditable      = false;
     _alerts_enabled = true;
     _tag            = null;
     _stockStatus    = STOCKSTATUS.inuse;
     _supplierID     = 1;
     _supplierName   = "";
     //
     _listAuditedItems = null;
     _listFolders      = null;
     _childAssets      = null;
 }
示例#3
0
        public Asset(DataRow dataRow) : this()
        {
            try
            {
                _assetID        = (int)dataRow["_ASSETID"];
                _parentAssetID  = (int)dataRow["_PARENT_ASSETID"];
                _uniqueID       = (string)dataRow["_UNIQUEID"];
                _name           = (string)dataRow["_NAME"];
                _locationID     = (int)dataRow["_LOCATIONID"];
                _location       = (string)dataRow["LOCATIONNAME"];
                _fullLocation   = (string)dataRow["FULLLOCATIONNAME"];
                _domainID       = (int)dataRow["_DOMAINID"];
                _domain         = (string)dataRow["DOMAINNAME"];
                _ipaddress      = (string)dataRow["_IPADDRESS"];
                _requestaudit   = (bool)dataRow["_REQUESTAUDIT"];
                _lastAudit      = (dataRow.IsNull("_LASTAUDIT")) ? new DateTime(0L) : (DateTime)dataRow["_LASTAUDIT"];
                _agentStatus    = (AGENTSTATUS)dataRow["_AGENT_STATUS"];
                _agentVersion   = (string)dataRow["_AGENT_VERSION"];
                _assetTypeID    = (int)dataRow["_ASSETTYPEID"];
                TypeAsString    = (string)dataRow["ASSETTYPENAME"];
                _macAddress     = (string)dataRow["_MACADDRESS"];
                _make           = (string)dataRow["_MAKE"];
                _model          = (string)dataRow["_MODEL"];
                _serial         = (string)dataRow["_SERIAL_NUMBER"];
                _icon           = (string)dataRow["ICON"];
                _auditable      = (bool)dataRow["AUDITABLE"];
                _alerts_enabled = (bool)dataRow["_ALERTS_ENABLED"];
                _stockStatus    = (STOCKSTATUS)dataRow["_STOCK_STATUS"];
                _overwriteData  = (dataRow.IsNull("_OVERWRITEDATA")) ? true : (bool)dataRow["_OVERWRITEDATA"];
                _assetTag       = (dataRow.IsNull("_ASSETTAG")) ? "" : (string)dataRow["_ASSETTAG"];

                // Supplier
                SupplierID = (int)dataRow["_SUPPLIERID"];

                if (dataRow["SUPPLIER_NAME"].GetType() == typeof(Boolean))
                {
                    SupplierName = "";
                }
                else
                {
                    SupplierName = (string)dataRow["SUPPLIER_NAME"];
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                Utility.DisplayErrorMessage("Exception occurred creating an ASSET Object, please check database schema.  The message was " + ex.Message);
            }
        }
示例#4
0
        public static string GetStockStatusText(STOCKSTATUS stockStatus)
        {
            switch (stockStatus)
            {
            case STOCKSTATUS.disposed: return("Disposed");

            case STOCKSTATUS.inuse: return("In Use");

            case STOCKSTATUS.pendingdisposal: return("Pending Disposal");

            case STOCKSTATUS.stock: return("Stock");

            default: return("Unknown");
            }
        }
示例#5
0
        public void UpdateStockStatus(STOCKSTATUS newStockStatus)
        {
            // Ignore if no change actually made
            if (newStockStatus == _stockStatus)
            {
                return;
            }

            AuditWizardDataAccess lwDataAccess = new AuditWizardDataAccess();

            // Audit the status change
            Asset oldAsset = new Asset(this);

            // Update the object and the database
            _stockStatus = newStockStatus;
            lwDataAccess.AssetUpdateStockStatus(_assetID, newStockStatus);

            // ...then audit the change
            AuditChanges(oldAsset);
        }
示例#6
0
        public Asset(DataRow dataRow) : this()
        {
            try
            {
                _assetID        = (int)dataRow["_ASSETID"];
                _parentAssetID  = (int)dataRow["_PARENT_ASSETID"];
                _uniqueID       = (string)dataRow["_UNIQUEID"];
                _name           = (string)dataRow["_NAME"];
                _locationID     = (int)dataRow["_LOCATIONID"];
                _location       = (string)dataRow["LOCATIONNAME"];
                _fullLocation   = (string)dataRow["FULLLOCATIONNAME"];
                _domainID       = (int)dataRow["_DOMAINID"];
                _domain         = (string)dataRow["DOMAINNAME"];
                _ipaddress      = (string)dataRow["_IPADDRESS"];
                _requestaudit   = (bool)dataRow["_REQUESTAUDIT"];
                _lastAudit      = (dataRow.IsNull("_LASTAUDIT")) ? new DateTime(0L) : (DateTime)dataRow["_LASTAUDIT"];
                _agentStatus    = (AGENTSTATUS)dataRow["_AGENT_STATUS"];
                _agentVersion   = (string)dataRow["_AGENT_VERSION"];
                _assetTypeID    = (int)dataRow["_ASSETTYPEID"];
                TypeAsString    = (string)dataRow["ASSETTYPENAME"];
                _macAddress     = (string)dataRow["_MACADDRESS"];
                _make           = (string)dataRow["_MAKE"];
                _model          = (string)dataRow["_MODEL"];
                _serial         = (string)dataRow["_SERIAL_NUMBER"];
                _icon           = (string)dataRow["ICON"];
                _auditable      = (bool)dataRow["AUDITABLE"];
                _alerts_enabled = (bool)dataRow["_ALERTS_ENABLED"];
                _stockStatus    = (STOCKSTATUS)dataRow["_STOCK_STATUS"];

                // Supplier
                this.SupplierID   = (int)dataRow["_SUPPLIERID"];
                this.SupplierName = (string)dataRow["SUPPLIER_NAME"];
            }
            catch (Exception ex)
            {
                MessageBox.Show("Exception occured creating an ASSET Object, please check database schema.  The message was " + ex.Message);
            }
        }