예제 #1
0
        private void LoadForm()
        {
            tbParentLocation.Text   = _asset.Location;
            tbAssetName.Text        = _asset.Name;
            tbSerialNumber.Text     = _asset.SerialNumber;
            tbAssetTag.Text         = _asset.AssetTag;
            cbOverwriteData.Checked = _asset.OverwriteData;

            _assetTypes.Populate();

            // Recover the category of the current asset so that we can select it correctly in the combo
            AssetType assetType = _assetTypes.FindByName(_asset.TypeAsString);

            if (assetType == null)
            {
                assetType = _assetTypes[0];
            }

            AssetType assetCategory = _assetTypes.GetParent(assetType);

            // We now need to add the Asset Type categories to the combo box
            cbAssetCategories.BeginUpdate();

            cbAssetCategories.Items.Clear();

            AssetTypeList categories = _assetTypes.EnumerateCategories();

            foreach (AssetType category in categories)
            {
                cbAssetCategories.Items.Add(category);
            }

            int index = cbAssetCategories.Items.IndexOf(assetCategory);

            cbAssetCategories.SelectedIndex = (index != -1) ? index : 0;

            cbAssetCategories.EndUpdate();

            FillAssetTypes(assetCategory);
            FillStockStatuses(_asset.StockStatus);

            // ...and select the asset type for the asset
            index = cbAssetTypes.Items.IndexOf(assetType);
            cbAssetTypes.SelectedIndex = (index != -1) ? index : 0;

            FillAssetMakes(assetType.AssetTypeID);
            FillAssetModels(assetType.AssetTypeID);

            InitializeNotesTab();
            PopulateSuppliers();
            InitializeDocumentsTab();

            FillUserDefinedData();
            //Added by Sojan E John KTS Infotech
            ClearControlsSupportContract();
            FillControlsOnLoad();
            FillSupportContractComboBox();
            FillSuppliersComboBox();
            InitialiseSupportContractTab();
        }