Example #1
0
        //public bool IsMatch(string key)
        //{
        //    return hs_status.Contains(key);
        //}
        public void loadStatus()
        {
            System.Data.Odbc.OdbcConnection cn = new System.Data.Odbc.OdbcConnection(DbCmdServer.getDbConnectStr());
               System.Data.Odbc.OdbcCommand cmd = new System.Data.Odbc.OdbcCommand();
               cmd.Connection = cn;
               cmd.CommandText= "select type,place,group,kind,dir,run_status,hw_status,density,level,no from tblsvwsconfig";
               try
               {
                   cn.Open();
                   System.Data.Odbc.OdbcDataReader rd = cmd.ExecuteReader();

                   while (rd.Read())
                   {
                       string type;
                       int place, group, kind, dir, run_status, hw_status, density, level, no;
                       type = rd[0].ToString();
                       place = System.Convert.ToInt32(rd[1]);
                       group = System.Convert.ToInt32(rd[2]);
                       kind = System.Convert.ToInt32(rd[3]);
                       dir = System.Convert.ToInt32(rd[4]);
                       run_status = System.Convert.ToInt32(rd[5]);
                       hw_status = System.Convert.ToInt32(rd[6]);
                       density = System.Convert.ToInt32(rd[7]);
                       level = System.Convert.ToInt32(rd[8]);
                       no = System.Convert.ToInt32(rd[9]);

            #if DEBUG
                       //if (place != 22 || group != 6 || kind != 2 || dir != 1 || type!="A")

                       //    continue;
            #endif
                       SVWS_Status svws_status=new SVWS_Status();
                       if (type == "A")
                           svws_status.SetAnalogStatus(place, group, kind, dir, density, level);
                       else if (type == "D")
                           svws_status.SetDigitalStatus(place, group, kind, dir, run_status, hw_status);
                       else if (type == "P")
                           svws_status.setPDStatus(place, group, kind, dir, run_status, hw_status,no);

                         this.hs_status.Add(svws_status.Key, svws_status);

                   }

                   rd.Close();
               }
               catch (Exception ex)
               {
                   ConsoleServer.WriteLine(ex.Message + "," + ex.StackTrace);
               }
               finally
               {
                   try { cn.Close(); }
                   catch { ;}
               }
        }