Пример #1
0
        public int upperTravelTimeLimit, lowerTravelTimeLimit, offset; // 旅許時間限制條件

        #endregion Fields

        #region Constructors

        public TravelDisplaySettingData(int displaypart,int iconid, string message1, string message2, byte[] fcolorbyte1, byte[] fcolorbyte2, byte[] bcolorbyte1, byte[] bcolorbyte2, TravelDisplayDetailData[] detailData,int upperTravelTimeLimit,int lowerTravelTimeLimit,int offset,bool enable)
        {
            this.message1=message1;
            this.message2=message2;
            this.iconid=iconid;
            this.fcolorbyte1 = fcolorbyte1;
            this.fcolorbyte2 = fcolorbyte2;
            this.bcolorbyte1 = bcolorbyte1;
            this.bcolorbyte2 = bcolorbyte2;
            this.detailData = detailData;
            this.displaypart = displaypart;
            this.upperTravelTimeLimit = upperTravelTimeLimit;
            this.lowerTravelTimeLimit = lowerTravelTimeLimit;
            this.offset = offset;
            this.enable = enable;
        }
Пример #2
0
        public void loadTravelSetting()
        {
            System.Collections.ArrayList ary = new System.Collections.ArrayList();
               System.Collections.ArrayList mainary = new System.Collections.ArrayList();
               OdbcConnection cn = new OdbcConnection(Global.Db2ConnectionString);
               OdbcDataReader rdMain, rd;
               OdbcCommand cmd = new OdbcCommand();
               OdbcCommand cmdMain = new OdbcCommand();
               cmd.Connection = cn;
               cmdMain.Connection = cn;
               try
               {

               cn.Open();
               cmdMain.CommandText = "select DISPLAY_PART ,g_code_id,message1,message2,msg1forecolor,msg2forecolor,msg1backcolor,msg2backcolor,uppertravelTime,lowerTravelTime,offset,enable from tblRGSTravelTime where devicename='" + this.deviceName + "'  and enable='Y' order by display_part";
               //if (deviceName == "CMS-T78-E-28.5")
               //    Console.WriteLine();
               rdMain = cmdMain.ExecuteReader();

               while (rdMain.Read())
               {
                   ary.Clear();
                   int displaypart = System.Convert.ToInt32(rdMain[0]);
                   int iconid = System.Convert.ToInt32(rdMain[1]);
                   string mesg1 = rdMain[2].ToString();
                   string mesg2 = rdMain[3].ToString();
                   string[] tmp = rdMain[4].ToString().Split(new char[] { ',' });
                   byte[] fcolor1 = new byte[mesg1.Length];

                  // if (mesg1.Length != 0)
                   for (int i = 0; i < fcolor1.Length; i++)
                       fcolor1[i] = System.Convert.ToByte(tmp[i]);

                   tmp = rdMain[5].ToString().Split(new char[] { ',' });

                   byte[] fcolor2 = new byte[mesg2.Length];
                   for (int i = 0; i < fcolor2.Length; i++)
                       fcolor2[i] = System.Convert.ToByte(tmp[i]);

                   tmp = rdMain[6].ToString().Split(new char[] { ',' });
                   int upperTravelTime = System.Convert.ToInt32(rdMain[8]);
                   int lowerTraveltime = System.Convert.ToInt32(rdMain[9]);
                   int offset = System.Convert.ToInt32(rdMain[10]);
                   bool enable = rdMain[11].ToString().ToUpper() == "Y" ? true : false;

                   //byte[] bcolor1 = new byte[tmp.Length];
                   //for (int i = 0; i < bcolor1.Length; i++)
                   //    bcolor1[i] = System.Convert.ToByte(tmp[i]);

                   //tmp = rdMain[7].ToString().Split(new char[] { ',' });
                   //byte[] bcolor2 = new byte[tmp.Length];
                   //for (int i = 0; i < bcolor2.Length; i++)
                   //    bcolor2[i] = System.Convert.ToByte(tmp[i]);

                   #region read detail
                   cmd.CommandText = "select start_lineid, direction,  display_part,start_mileage,end_mileage, isXml from tblRgsTravelTimeDetail where devicename='" + this.deviceName + "'  and Display_part=" + displaypart;

                   rd = cmd.ExecuteReader();
                   while (rd.Read())
                   {
                       string lineid = rd[0].ToString();
                       string direction = rd[1].ToString();
                       int displaypartd = System.Convert.ToInt32(rd[2]);
                       int startmile = System.Convert.ToInt32(rd[3]);
                       int endmile = System.Convert.ToInt32(rd[4]);
                       bool isXml = (System.Convert.ToString(rd[5])=="Y")?true:false;;

                       ary.Add(new TravelDisplayDetailData(displaypartd, lineid, direction, startmile, endmile,isXml));
                   }
                   rd.Close();
                   TravelDisplayDetailData[] ddata = new TravelDisplayDetailData[ary.Count];
                   for (int i = 0; i < ddata.Length; i++)
                       ddata[i] = (TravelDisplayDetailData)ary.ToArray()[i];

                   #endregion

                   mainary.Add(new TravelDisplaySettingData(displaypart, iconid, mesg1, mesg2, fcolor1, fcolor2, null, null, ddata,upperTravelTime,lowerTraveltime,offset,enable));

               }
               rdMain.Close();
               travelDisplaySettingData = new TravelDisplaySettingData[mainary.Count];
               for (int i = 0; i < travelDisplaySettingData.Length; i++)
                   travelDisplaySettingData[i] = (TravelDisplaySettingData)mainary.ToArray()[i];

               }
               catch (Exception ex)
               {
               RemoteInterface.ConsoleServer.WriteLine(this.deviceName+ex.Message + ex.StackTrace);
               }
               finally
               {
               cn.Close();
               }
        }