예제 #1
0
        /// <summary>
        ///加载运行线路信息
        /// </summary>
        public void DateViewDetails()
        {
            SelectStation selSta = new SelectStation();

            listDV = selSta.SelectGridViewStation();
            dataGridView1.DataSource       = listDV;
            dataGridView1.Rows[0].Selected = false;//dataGridView默认未选中
        }
예제 #2
0
        /// <summary>
        /// 显示首末站
        /// </summary>
        public void showStation()
        {
            string[]      str1, str2;
            SelectStation sel = new SelectStation();

            str1 = sel.SelectFirstStation().Split(',');
            str2 = sel.SelectLastStation().Split(',');
            this.textBox2.Text = str1[0];    //首站
            this.textBox3.Text = str2[0];    //末站
        }
예제 #3
0
        /// <summary>
        /// 发车语音播报
        /// </summary>

        public void SpeechFa()
        {
            LedShow led   = new LedShow();
            string  text1 = null;
            string  text2 = null;

            string[]           str1, str2;
            string             ent1      = "intp65";
            string             vcn1      = "xiaoyan";
            string             ent2      = "intp65";
            string             vcn2      = "henry";
            SelectStation      sel       = new SelectStation();
            SpeechOperat       spo       = new SpeechOperat();
            List <Common>      listCom   = new List <Common>();
            List <SpeechModel> listSpFa  = new List <SpeechModel>();
            List <SpeechModel> listSpJin = new List <SpeechModel>();
            Speech             sp        = new Speech();

            str1    = sel.SelectFirstStation().Split(',');
            str2    = sel.SelectLastStation().Split(',');
            listCom = sel.SelectComboBoxStation();
            text1   = ",惠而浦冰箱洗衣机提醒您,列车已经由 " + this.dataGridView1.Rows[m - 1].Cells[0].Value.ToString() + " 开出,前方到站 " +
                      this.dataGridView1.Rows[m].Cells[0].Value.ToString();
            text2 = "Whirlpool refrigerator and washing machine remind you,The train has been started from " + this.dataGridView1.Rows[m - 1].Cells[1].Value.ToString() + " Station " +
                    "and next station is " + this.dataGridView1.Rows[m].Cells[1].Value.ToString() + " Station";
            text1 = text1 + ",本次列车为 " + this.textBox1.Text + " 次列车,由 " + this.textBox2.Text + " 发往 " + this.textBox3.Text + ",途径";
            text2 = text2 + ",This train is " + this.textBox1.Text + " train,and is sent from " + str1[1] + " Station to " + str2[1] + " Station,channel ";
            for (int i = 1; i < listCom.Count - 1; i++)
            {
                text1 = text1 + listCom[i].StationName + "、";
                text2 = text2 + listCom[i].StationEnName + " Station,";
            }
            listSpFa  = spo.SelectSp("欢迎提示语");
            listSpJin = spo.SelectSp("禁烟提示语");
            for (int i = 0; i < listSpFa.Count; i++)
            {
                text1 = listSpFa[i].speechContent + text1;
                text2 = listSpFa[i].speechEnContent + text2;
            }
            for (int i = 0; i < listSpJin.Count; i++)
            {
                text1 = text1 + listSpJin[i].speechContent;
                text2 = text2 + listSpJin[i].speechEnContent;
            }
            led.ShowLEDMessage(text1 + "  " + text2 + "                     ", this.textBox1.Text, this.textBox17.Text);
            sp.SpeechTest(text1, ent1, vcn1);
            sp.SpeechTest(text2, ent2, vcn2);
            int RowNum = this.dataGridView1.Rows.Count;

            Thread.Sleep(102000 + (RowNum - 13) * 2 * 1000);  // 停顿秒数
            LedSWShow();
        }
예제 #4
0
        /// <summary>
        ///加载运行线路各个站名称(comboBox数据)
        /// </summary>
        public void ComboBoxDetails()
        {
            SelectStation sel     = new SelectStation();
            List <Common> listCom = new List <Common>();

            listCom = sel.SelectComboBoxStation();
            ArrayList list = new ArrayList();

            for (int i = 0; i < listCom.Count; i++)
            {
                list.Add(listCom[i].StationName);
            }
            comboBox1.DataSource = list;
        }
예제 #5
0
파일: Form2.cs 프로젝트: saigon-magic/CRH
        public void ShowMessage(String stationName, String stationEnName, double stationLng, double stationLat, int stopTime, String lastStation)
        {                                                        //插入站点
            // Console.WriteLine(stationName + stationEnName + stationLng + stationLat + stopTime + lastStation);
            SelectStation   sel         = new SelectStation();   //实例化查询对象
            UpdateStation   updateSta   = new UpdateStation();   //实例化更新对象
            Common          commStaName = new Common();          //实例化实体类对象
            IncreaseStation increaseSta = new IncreaseStation(); //实例化插入对象
            Calculate       cal         = new Calculate();       //实例化计算距离对象
            Common          com         = sel.SelectFirstStation(lastStation);

            //Console.WriteLine(com.StationName);
            try
            {
                if (lastStation == "首站")//在运行线路开始插入一站(首站)
                {
                    List <Common> listSub1 = sel.SelectSubStation(0);
                    if (listSub1.Count > 0)
                    {//数据库中还有站点
                        for (int i = 0; i < listSub1.Count; i++)
                        {
                            String StaName    = listSub1[i].StationName;
                            int    StaSubject = listSub1[i].SubjectStation + 1;
                            updateSta.UpdateSubject(StaName, StaSubject);
                        }
                        String firstStationName = null;
                        if (com.StationName == null)
                        {
                            firstStationName = sel.SelectFirstStation("首站").StationName;
                        }
                        else
                        {
                            firstStationName = com.StationName;
                        }
                        Console.WriteLine(firstStationName);
                        double lng      = sel.SelectLngLat(firstStationName).lng;
                        double lat      = sel.SelectLngLat(firstStationName).lat;
                        double distance = cal.Distance(stationLng, stationLat, lng, lat); //计算相邻两站之间的距离
                        updateSta.UpdateDistance(firstStationName, distance);             //修改当前首站的距离
                        updateSta.UpdateLastStation(stationName, firstStationName);       //修改当前的首站的上一站名称为要插入的站的站名
                        increaseSta.insertStation(stationName, stationEnName, stationLng, stationLat, stopTime, 0, lastStation, 1);
                    }
                    else
                    {//刚开始插入,数据库中还没有插入站点(首站)
                        increaseSta.insertStation(stationName, stationEnName, stationLng, stationLat, stopTime, 0, lastStation, 1);
                    }
                }
                else
                {
                    int sub = sel.SelectBelong(lastStation);
                    //Console.WriteLine(sub);
                    List <Common> listSub2 = sel.SelectSubStation(sub);
                    if (listSub2.Count > 0)
                    {//在运行线路中间插入一站
                        for (int i = 0; i < listSub2.Count; i++)
                        {
                            String StaName    = listSub2[i].StationName;
                            int    StaSubject = listSub2[i].SubjectStation + 1;
                            updateSta.UpdateSubject(StaName, StaSubject);
                        }
                        String staname = null;
                        if (com.StationName == null)
                        {
                            staname = sel.SelectFirstStation("首站").StationName;
                        }
                        else
                        {
                            staname = com.StationName;
                        }
                        Console.WriteLine(staname);
                        double lng       = sel.SelectLngLat(staname).lng;
                        double lat       = sel.SelectLngLat(staname).lat;
                        double lngL      = sel.SelectLngLat(lastStation).lng;
                        double latL      = sel.SelectLngLat(lastStation).lat;
                        double distanceL = cal.Distance(stationLng, stationLat, lngL, latL); //计算插入站与前一站两站之间的距离
                        double distance  = cal.Distance(lng, lat, stationLng, stationLat);   //计算插入站与后一站两站之间的距离
                        updateSta.UpdateDistance(staname, distance);                         //修改插入站点与后一站的的距离
                        updateSta.UpdateLastStation(stationName, staname);                   //修改后一站的上一站名称为要插入的站的站名
                        increaseSta.insertStation(stationName, stationEnName, stationLng, stationLat, stopTime, distanceL, lastStation, sub + 1);
                    }
                    else
                    {//在运行线路的末尾插入一站
                        double lng      = sel.SelectLngLat(lastStation).lng;
                        double lat      = sel.SelectLngLat(lastStation).lat;
                        double distance = cal.Distance(lng, lat, stationLng, stationLat);//计算插入站与后一站两站之间的距离
                        increaseSta.insertStation(stationName, stationEnName, stationLng, stationLat, stopTime, distance, lastStation, sub + 1);
                    }
                }
                MessageBox.Show("添加成功!");
            }
            catch {
                MessageBox.Show("添加失败,请检查网络连接!");
            }
        }
예제 #6
0
 /// <summary>
 /// 删除停靠点
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void button6_Click(object sender, EventArgs e)
 {
     if (colIndex == null)
     {//未选中
         MessageBox.Show("请选择您要删除的站点!");
     }
     else
     {
         DialogResult r = MessageBox.Show("确定要删除该停靠站点?", "操作提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
         if (r != DialogResult.OK)
         {
             // Cancel = true;
             dataGridView1.Rows[Index].Selected = false;
         }
         else
         {
             try
             {
                 string        commLastStaName = null;
                 string        commStaName     = null;
                 UpdateStation ups             = new UpdateStation();
                 DeleteStation delSta          = new DeleteStation();
                 SelectStation sel             = new SelectStation();
                 Calculate     cal             = new Calculate();
                 int           sub             = sel.SelectBelong(colIndex);
                 List <Common> list            = new List <Common>();
                 list = sel.SelectSubStation(sub);
                 for (int i = 0; i < list.Count; i++)
                 {
                     ups.UpdateSubject(list[i].StationName, list[i].SubjectStation - 1);
                 }
                 //Console.WriteLine(colIndex);
                 commLastStaName = sel.SelectBeforeStation(colIndex).LastStationName; //查询删除站点的上一站
                 if (commLastStaName == "首站")
                 {                                                                    //只有首站
                     if (sel.SelectFirstStation(colIndex) == null)
                     {
                         delSta.deleteSta(colIndex);
                     }
                     else
                     {
                         ups.UpdateLastStation(commStaName, "首站");
                         delSta.deleteSta(colIndex);
                     }
                 }
                 else
                 {
                     if (sel.SelectFirstStation(colIndex) == null)
                     {//删除末站
                         delSta.deleteSta(colIndex);
                     }
                     else
                     {                                                               //删除中间某一站
                         commStaName = sel.SelectFirstStation(colIndex).StationName; //查询以删除站点为上一站的站点
                         double lastLng  = sel.SelectLngLat(commLastStaName).lng;
                         double lastLat  = sel.SelectLngLat(commLastStaName).lat;
                         double afterLng = sel.SelectLngLat(commStaName).lng;
                         double afterLat = sel.SelectLngLat(commStaName).lat;
                         ups.UpdateDistance(commStaName, cal.Distance(afterLng, afterLat, lastLng, lastLat));
                         ups.UpdateLastStation(commStaName, commLastStaName);
                         delSta.deleteSta(colIndex);
                     }
                 }
                 DateViewDetails(); //加载运行线路信息
                 showStation();     //首末站数据加载
                 ComboBoxDetails(); //掉电恢复区comboBox数据加载
                 showStation();     //显示首末站
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 return;
             }
         }
     }
 }