Пример #1
0
        private void AddLocation(UltraListViewItem lvi)
        {
            LocationsDAO lwDataAccess = new LocationsDAO();

            // Create the AssetGroup for this location noting that we need to add the root item name to all
            // locations created as this will be missing from the import text
            string     oldLocation = lvi.Text;
            AssetGroup newGroup    = new AssetGroup();

            newGroup.GroupType = AssetGroup.GROUPTYPE.userlocation;
            if (oldLocation == "")
            {
                newGroup.FullName = _rootName;
            }
            else
            {
                newGroup.FullName = _rootName + AssetGroup.LOCATIONDELIMITER + lvi.Text;
            }
            newGroup.StartIP = lvi.SubItems[0].Text;
            newGroup.EndIP   = lvi.SubItems[1].Text;

            // Add this group and get its database index
            newGroup.Add();

            // Now we need to add the asset (if there is one defined)
            string assetName = lvi.SubItems[2].Text;

            if (assetName != "")
            {
                Asset newAsset = new Asset();
                newAsset.LocationID = newGroup.GroupID;
                newAsset.Name       = assetName;
                newAsset.Add();
            }
        }