private void listView1_SelectedIndexChanged(object sender, EventArgs e) { if (this.listView1.SelectedItems.Count > 0) { ListViewItem item = this.listView1.SelectedItems[0]; if (item.Tag != null && item.Tag is Fire_ForestBeltPoint) { this.currentFireForestBelt = item.Tag as Fire_ForestBeltPoint; this.navigationControl1.BtnEdit.Enabled = true; this.navigationControl1.BtnDelete.Enabled = true; } else { this.currentFireForestBelt = null; this.navigationControl1.BtnDelete.Enabled = false; this.navigationControl1.BtnEdit.Enabled = false; } } else { this.currentFireForestBelt = null; this.navigationControl1.BtnDelete.Enabled = false; this.navigationControl1.BtnEdit.Enabled = false; } }
public FormFireForestBelt(OperationType type, Fire_ForestBeltPoint fireForestBelt = null) { InitializeComponent(); this.m_OperationType = type; this.m_FireForestBelt = fireForestBelt; this.m_ForestBeltController = new ForestBeltPointController(); this.m_ForestBeltController.AddEvent += m_ForestBeltControllerr_AddEvent; this.m_ForestBeltController.EditEvent += m_ForestBeltController_EditEvent; }
public void EditTest() { ForestBeltPointController forestBeltPointController; // 测试用例1 forestBeltPointController = new ForestBeltPointController(); forestBeltPointController.Edit((Fire_ForestBeltPoint)null); Assert.IsNotNull((object)forestBeltPointController); Assert.AreEqual <string> ("127.0.0.1", ((BaseService)forestBeltPointController).Server); Assert.AreEqual <int>(8080, ((BaseService)forestBeltPointController).Port); // 测试用例2 forestBeltPointController = new ForestBeltPointController(); Fire_ForestBeltPoint s0 = new Fire_ForestBeltPoint(); s0.OBJECTID = 0; s0.SHAPE = (string)null; s0.start_addr = (string)null; s0.stop_addr = (string)null; s0.name = (string)null; s0.build_addr = (string)null; s0.build_year = (string)null; s0.tree_type = (string)null; s0.type = (string)null; s0.build_unit = (string)null; s0.belt_len = default(double?); s0.belt_width = default(double?); s0.status = 0; s0.picture1 = (string)null; s0.picture2 = (string)null; s0.video = (string)null; s0.note = (string)null; s0.longitude = 0; s0.latitude = 0; s0.row_spacing = (string)null; s0.id = (string)null; s0.management_unit = (string)null; s0.phone = (string)null; s0.manager = (string)null; s0.pac = (string)null; s0.city_name = (string)null; s0.county_name = (string)null; s0.mediaByteDict = (Dictionary <string, object>)null; s0.mediaFiles = (List <MediaFile>)null; forestBeltPointController.Edit(s0); Assert.IsNotNull((object)forestBeltPointController); Assert.AreEqual <string> ("127.0.0.1", ((BaseService)forestBeltPointController).Server); Assert.AreEqual <int>(8080, ((BaseService)forestBeltPointController).Port); }
private void btnOK_Click(object sender, EventArgs e) { if (!IsCondition()) { return; } IDictionary <string, string> dict = new Dictionary <string, string>(); try { this.tabControl1.SelectedTab = this.tabPage_baseInfo; dict = m_FireForestBelt.ObjectDescriptionToDict(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (!SmartForm.Validator(this.tabPage_baseInfo.Controls, dict)) { return; } if (m_OperationType == OperationType.Add) { this.m_FireForestBelt = new Fire_ForestBeltPoint(); } this.m_FireForestBelt.longitude = this.coordinatesInputControl1.Longitude; this.m_FireForestBelt.latitude = this.coordinatesInputControl1.Latitude; this.m_FireForestBelt.pac = this.pacControl11.LocalPac; this.m_FireForestBelt.city_name = this.pacControl11.City; this.m_FireForestBelt.county_name = this.pacControl11.County; this.m_FireForestBelt.SHAPE = Converters.LngLatToWKT(this.m_FireForestBelt.longitude, this.m_FireForestBelt.latitude); //自动从窗体控件上取值 this.m_FireForestBelt = SmartForm.GetEntity <Fire_ForestBeltPoint>(this.tabPage_baseInfo.Controls, this.m_FireForestBelt); this.m_FireForestBelt.build_year = this.dtp_build_year.Value.ToString("yyyy-MM-dd hh:mm:ss"); this.m_FireForestBelt.note = this.tbx_note.Text.Trim(); this.m_FireForestBelt.mediaByteDict = this.mediaControl1.MediaByteDict; if (m_OperationType == OperationType.Add) { this.m_ForestBeltController.Add(this.m_FireForestBelt); } else if (m_OperationType == OperationType.Edit) { this.m_ForestBeltController.Edit(this.m_FireForestBelt); } }
private void FillData(List <Fire_ForestBeltPoint> fireForestBeltList) { this.pagerControl1.Bind(); this.pagerControl1.bindingSource.DataSource = fireForestBeltList; this.pagerControl1.bindingNavigator.BindingSource = this.pagerControl1.bindingSource; this.listView1.Items.Clear(); if (fireForestBeltList != null) { for (int i = 0; i < fireForestBeltList.Count; i++) { Fire_ForestBeltPoint fireForestBelt = fireForestBeltList[i]; ListViewItem item = new ListViewItem(); item.SubItems.Add(fireForestBelt.name); AreaCodeInfo county = null; try { if (this.navigationControl1.AreaList != null) { county = this.navigationControl1.AreaList.Where(a => a.code == fireForestBelt.pac).First(); } } catch { } item.SubItems.Add((county == null) ? "" : county.name); item.SubItems.Add(fireForestBelt.build_unit); item.SubItems.Add(fireForestBelt.longitude.ToString()); item.SubItems.Add(fireForestBelt.latitude.ToString()); item.Tag = fireForestBelt; this.listView1.Items.Add(item); } } }