private void btnAddArea_Click(object sender, EventArgs e) { if (SharedData.iLocationSite < 1) { MessageBox.Show("Choose a site to add an area to.", "Choose Site", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } SharedData.iLocationArea = 0; SharedData.sLocationType = "area"; Form frmLocation = new frmLocationAdd(); DialogResult dlg = frmLocation.ShowDialog(); if (dlg == DialogResult.OK && SharedData.iLocationArea > 0) { SharedData.iLocationVessel = 0; SharedData.iLocationFloor = 0; SharedData.iLocationGrid = 0; if (cbxArea.Items.Count > 0) { foreach (DevComponents.Editors.ComboItem i in cbxArea.Items) { if (i.Value.ToString() == SharedData.iLocationSite.ToString()) { cbxArea.SelectedItem = i; break; } } } LoadLocations(); } }
private void btnAddSite_Click(object sender, EventArgs e) { SharedData.iLocationSite = 0; SharedData.sLocationType = "site"; Form frmLocation = new frmLocationAdd(); DialogResult dlg = frmLocation.ShowDialog(); if (dlg == DialogResult.OK && SharedData.iLocationSite > 0) { SharedData.iLocationArea = 0; SharedData.iLocationVessel = 0; SharedData.iLocationFloor = 0; SharedData.iLocationGrid = 0; if (cbxSite.Items.Count > 0) { foreach (DevComponents.Editors.ComboItem i in cbxSite.Items) { if (i.Value.ToString() == SharedData.iLocationSite.ToString()) { cbxSite.SelectedItem = i; break; } } } LoadLocations(); } }
private void btnEditGrid_Click(object sender, EventArgs e) { DevComponents.Editors.ComboItem i = (DevComponents.Editors.ComboItem)cbxGrid.Items[cbxGrid.SelectedIndex]; SharedData.iLocationGrid = Convert.ToInt32(i.Value); SharedData.sLocationGrid = i.Text.ToString(); SharedData.sLocationType = "grid"; SharedData.bLocationEdit = true; Form frmLocation = new frmLocationAdd(); DialogResult dlg = frmLocation.ShowDialog(); if (dlg == DialogResult.OK && SharedData.iLocationSite > 0) { LoadLocations(); } SharedData.iLocationGrid = 0; SharedData.sLocationGrid = ""; SharedData.sLocationType = ""; SharedData.bLocationEdit = false; }