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_Command) { this.currentFireCommand = item.Tag as Fire_Command; this.navigationControl1.BtnEdit.Enabled = true; this.navigationControl1.BtnDelete.Enabled = true; } else { this.currentFireCommand = null; this.navigationControl1.BtnDelete.Enabled = false; this.navigationControl1.BtnEdit.Enabled = false; } } else { this.currentFireCommand = null; this.navigationControl1.BtnDelete.Enabled = false; this.navigationControl1.BtnEdit.Enabled = false; } }
public FormFireCommand(OperationType type, Fire_Command fireCommand = null) { InitializeComponent(); this.m_OperationType = type; this.m_FireCommand = fireCommand; this.m_FireCommandController = new FireCommandController(); this.m_FireCommandController.AddEvent += m_FireCommandController_AddEvent; this.m_FireCommandController.EditEvent += m_FireCommandController_EditEvent; }
public void EditTest() { FireCommandController fireCommandController; // 测试用例1 fireCommandController = new FireCommandController(); fireCommandController.Edit((Fire_Command)null); Assert.IsNotNull((object)fireCommandController); Assert.AreEqual <string> ("127.0.0.1", ((BaseService)fireCommandController).Server); Assert.AreEqual <int>(8080, ((BaseService)fireCommandController).Port); // 测试用例2 fireCommandController = new FireCommandController(); Fire_Command s0 = new Fire_Command(); s0.OBJECTID = 0; s0.shape = (string)null; s0.name = (string)null; s0.address = (string)null; s0.phone = (string)null; s0.director = (string)null; s0.dir_phone = (string)null; s0.longitude = 0; s0.latitude = 0; s0.num_people = 0; s0.institutions = (string)null; s0.type = (string)null; s0.level = (string)null; s0.status = 0; s0.picture1 = (string)null; s0.picture2 = (string)null; s0.video = (string)null; s0.note = (string)null; s0.cre_time = (string)null; s0.cre_pers = (string)null; s0.mod_time = (string)null; s0.mod_pers = (string)null; s0.commander = (string)null; s0.commander_phone = (string)null; s0.id = (string)null; s0.pac = (string)null; s0.mediaByteDict = (Dictionary <string, object>)null; s0.mediaFiles = (List <MediaFile>)null; fireCommandController.Edit(s0); Assert.IsNotNull((object)fireCommandController); Assert.AreEqual <string> ("127.0.0.1", ((BaseService)fireCommandController).Server); Assert.AreEqual <int>(8080, ((BaseService)fireCommandController).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 = this.m_FireCommand.ObjectDescriptionToDict(); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (!SmartForm.Validator(this.tabPage_baseInfo.Controls, dict)) { return; } if (m_OperationType == OperationType.Add) { this.m_FireCommand = new Fire_Command(); } this.m_FireCommand.longitude = this.coordinatesInputControl1.Longitude; this.m_FireCommand.latitude = this.coordinatesInputControl1.Latitude; this.m_FireCommand.pac = this.pacControl11.LocalPac; //自动从窗体控件上取值 m_FireCommand = SmartForm.GetEntity <Fire_Command>(this.tabPage_baseInfo.Controls, this.m_FireCommand); this.m_FireCommand.mediaByteDict = this.mediaControl1.MediaByteDict; if (m_OperationType == OperationType.Add) { this.m_FireCommandController.Add(this.m_FireCommand); } else if (m_OperationType == OperationType.Edit) { this.m_FireCommandController.Edit(this.m_FireCommand); } }
private void FillData(List <Fire_Command> fireCommandList) { this.pagerControl1.Bind(); this.pagerControl1.bindingSource.DataSource = fireCommandList; this.pagerControl1.bindingNavigator.BindingSource = this.pagerControl1.bindingSource; this.listView1.Items.Clear(); if (fireCommandList != null) { for (int i = 0; i < fireCommandList.Count; i++) { Fire_Command monitor = fireCommandList[i]; ListViewItem item = new ListViewItem(); item.SubItems.Add(monitor.name); AreaCodeInfo county = null; try { if (this.navigationControl1.AreaList != null) { county = this.navigationControl1.AreaList.Where(a => a.code == monitor.pac).First(); } } catch { } item.SubItems.Add((county == null) ? "" : county.name); item.SubItems.Add(monitor.director); item.SubItems.Add(monitor.longitude.ToString()); item.SubItems.Add(monitor.latitude.ToString()); item.Tag = monitor; this.listView1.Items.Add(item); } } }