Exemplo n.º 1
0
        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_RadioStation)
                {
                    this.currentRadioStation = item.Tag as Fire_RadioStation;

                    this.navigationControl1.BtnEdit.Enabled   = true;
                    this.navigationControl1.BtnDelete.Enabled = true;
                }
                else
                {
                    this.currentRadioStation = null;

                    this.navigationControl1.BtnDelete.Enabled = false;
                    this.navigationControl1.BtnEdit.Enabled   = false;
                }
            }
            else
            {
                this.currentRadioStation = null;

                this.navigationControl1.BtnDelete.Enabled = false;
                this.navigationControl1.BtnEdit.Enabled   = false;
            }
        }
        public void EditTest()
        {
            RadioStationController radioStationController;

            // 测试用例1
            radioStationController = new RadioStationController();
            radioStationController.Edit((Fire_RadioStation)null);
            Assert.IsNotNull((object)radioStationController);
            Assert.AreEqual <string>
                ("127.0.0.1", ((BaseService)radioStationController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)radioStationController).Port);

            //测试用例2
            radioStationController = new RadioStationController();
            Fire_RadioStation s0 = new Fire_RadioStation();

            s0.objectid      = 0;
            s0.name          = (string)null;
            s0.address       = (string)null;
            s0.manager       = (string)null;
            s0.phone         = (string)null;
            s0.longitude     = 0;
            s0.latitude      = 0;
            s0.units         = (string)null;
            s0.num_radio     = (string)null;
            s0.radioname     = (string)null;
            s0.type          = (string)null;
            s0.coding        = (string)null;
            s0.r_frequenc    = (string)null;
            s0.l_frequenc    = (string)null;
            s0.power         = (string)null;
            s0.height        = default(double?);
            s0.cre_time      = (string)null;
            s0.cre_pers      = (string)null;
            s0.mod_time      = (string)null;
            s0.mod_pers      = (string)null;
            s0.shape         = (string)null;
            s0.picture1      = (string)null;
            s0.picture2      = (string)null;
            s0.video         = (string)null;
            s0.status        = 0;
            s0.d_type        = (string)null;
            s0.note          = (string)null;
            s0.build_year    = (string)null;
            s0.id            = (string)null;
            s0.pac           = (string)null;
            s0.elevation     = default(double?);
            s0.county        = (string)null;
            s0.city          = (string)null;
            s0.mediaByteDict = (Dictionary <string, object>)null;
            s0.mediaFiles    = (List <MediaFile>)null;
            radioStationController.Edit(s0);
            Assert.IsNotNull((object)radioStationController);
            Assert.AreEqual <string>
                ("127.0.0.1", ((BaseService)radioStationController).Server);
            Assert.AreEqual <int>(8080, ((BaseService)radioStationController).Port);
        }
Exemplo n.º 3
0
        public FormRadioStation(OperationType type, Fire_RadioStation radioStation = null)
        {
            InitializeComponent();

            this.m_OperationType          = type;
            this.m_RadioStation           = radioStation;
            this.m_RadioStationController = new RadioStationController();

            this.m_RadioStationController.AddEvent  += m_RadioStationController_AddEvent;
            this.m_RadioStationController.EditEvent += m_RadioStationController_EditEvent;
        }
Exemplo n.º 4
0
        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_RadioStation.ObjectDescriptionToDict();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            if (!SmartForm.Validator(this.tabPage_baseInfo.Controls, dict))
            {
                return;
            }

            if (m_OperationType == OperationType.Add)
            {
                this.m_RadioStation = new Fire_RadioStation();
            }
            this.m_RadioStation.longitude = this.coordinatesInputControl1.Longitude;
            this.m_RadioStation.latitude  = this.coordinatesInputControl1.Latitude;
            this.m_RadioStation.pac       = this.pacControl11.LocalPac;
            this.m_RadioStation.city      = this.pacControl11.City;
            this.m_RadioStation.county    = this.pacControl11.County;
            this.m_RadioStation.shape     = Converters.LngLatToWKT(this.m_RadioStation.longitude, this.m_RadioStation.latitude);

            //自动从窗体控件上取值
            this.m_RadioStation = SmartForm.GetEntity <Fire_RadioStation>(this.tabPage_baseInfo.Controls, this.m_RadioStation);

            this.m_RadioStation.build_year    = this.dtp_build_year.Value.ToString("yyyy-MM-dd hh:mm:ss");
            this.m_RadioStation.note          = this.tbx_note.Text.Trim();
            this.m_RadioStation.mediaByteDict = this.mediaControl1.MediaByteDict;

            if (m_OperationType == OperationType.Add)
            {
                this.m_RadioStationController.Add(this.m_RadioStation);
            }
            else if (m_OperationType == OperationType.Edit)
            {
                this.m_RadioStationController.Edit(this.m_RadioStation);
            }
        }
Exemplo n.º 5
0
        private void FillData(List <Fire_RadioStation> radioStationList)
        {
            this.pagerControl1.Bind();
            this.pagerControl1.bindingSource.DataSource       = radioStationList;
            this.pagerControl1.bindingNavigator.BindingSource = this.pagerControl1.bindingSource;
            this.listView1.Items.Clear();

            if (radioStationList != null)
            {
                for (int i = 0; i < radioStationList.Count; i++)
                {
                    Fire_RadioStation radioStation = radioStationList[i];

                    ListViewItem item = new ListViewItem();

                    item.SubItems.Add(radioStation.name);
                    AreaCodeInfo county = null;
                    try
                    {
                        if (this.navigationControl1.AreaList != null)
                        {
                            county = this.navigationControl1.AreaList.Where(a => a.code == radioStation.pac).First();
                        }
                    }
                    catch { }

                    item.SubItems.Add((county == null) ? "" : county.name);
                    item.SubItems.Add(radioStation.manager);
                    item.SubItems.Add(radioStation.longitude.ToString());
                    item.SubItems.Add(radioStation.latitude.ToString());

                    item.Tag = radioStation;

                    this.listView1.Items.Add(item);
                }
            }
        }