Пример #1
0
        public void Display(Asset theAsset)
        {
            _asset = theAsset;

            lbAssetNameText.Text = theAsset.Name;
            lblCategory.Text     = theAsset.TypeAsString;
            lblMake.Text         = theAsset.Make;
            lblModel.Text        = theAsset.Model;
            lblAssetTag.Text     = theAsset.AssetTag;
            lbSerialNumber.Text  = theAsset.SerialNumber;
            //
            lblIPAddress.Text  = theAsset.IPAddress;
            lblMacAddress.Text = theAsset.MACAddress;
            lblDomain.Text     = theAsset.Domain;

            lblDateOfLastAudit.Text = String.Empty;
            lblScannerType.Text     = String.Empty;
            lblName.Text            = String.Empty;
            lblExtendedName.Text    = String.Empty;
            lblProductID.Text       = String.Empty;
            lblCDKey.Text           = String.Empty;

            if (theAsset.LastAudit != DateTime.MinValue)
            {
                lblScannerType.Text     = theAsset.AgentVersion;
                lblDateOfLastAudit.Text = theAsset.LastAuditDateString;
            }

            // Is this an auditable device?
            if (theAsset.Auditable)
            {
                // But OS information we need to read from the database
                ApplicationsDAO lwDataAccess = new ApplicationsDAO();
                DataTable       osTable      = lwDataAccess.GetInstalledOS(theAsset);

                gbOS.Visible = true;

                // If we have an OS then list it
                if (osTable.Rows.Count > 0)
                {
                    OSInstance ourOS = new OSInstance(osTable.Rows[0]);
                    lblName.Text         = ourOS.Name;
                    lblExtendedName.Text = ourOS.Name + " " + ourOS.Version;
                    lblProductID.Text    = ourOS.Serial.ProductId;
                    lblCDKey.Text        = ourOS.Serial.CdKey;

                    // 8.3.4 - CMD
                    // We may also be able to display the system type (32 or 64 bit OS) however this would be held in the Processor Hardware data
                    // if it is available.
                    AuditedItem systemTypeItem = theAsset.AuditedItems.FindItemByName("Hardware|CPU", "System Type");
                    if (systemTypeItem != null)
                    {
                        lblSystemType.Text = systemTypeItem.Value;
                    }
                    else
                    {
                        lblSystemType.Text = "";
                    }
                }
                else
                {
                    lblName.Text         = String.Empty;
                    lblExtendedName.Text = String.Empty;
                    lblProductID.Text    = String.Empty;
                    lblCDKey.Text        = String.Empty;
                    lblSystemType.Text   = "";
                }
            }
            else
            {
                gbOS.Visible = false;
            }

            LoadForm();
        }