Exemplo n.º 1
0
 public static void PDTEst()
 {
     SecureDBEntities1 db=new SecureDBEntities1();
     tblPDConfig config= db.tblPDConfig.Where(n => n.PDName == "PD-T78-W-22.0").FirstOrDefault();
     PD.PD pd = new PD.PD("PD-T78-W-22.0", config.IP, 502,config);
     while (true)
     {
         Console.WriteLine(pd.ToString());
         System.Threading.Thread.Sleep(1000);
     }
 }
Exemplo n.º 2
0
        public PDManager()
      {
          SecureDBEntities1 db = new SecureDBEntities1();

          var q = from n in db.tblPDConfig select n;
          Console.WriteLine("PD Manager Starting....");
          foreach (tblPDConfig tbl in q)
          {
              if (!dictPDs.ContainsKey(tbl.PDName))
              {
                  if (tbl.type == 1 || tbl.type==2 || tbl.type==3 || tbl.type==4 || tbl.type==5|| tbl.type==6|| tbl.type==7)
                  {
                      try
                      {
                          PD pd = new PD(tbl.PDName, tbl.IP, (int)tbl.Port, tbl);
                          //{
                          //    ERID = tbl.ERID,
                          //    IP = tbl.IP,
                          //    NVRID = tbl.NVRID,
                          //    Password = tbl.Password,
                          //    PlaneID = tbl.PlaneID ?? 0,
                          //    Port = tbl.Port,
                          //    UserName = tbl.UserName
                          //};
                          dictPDs.TryAdd(tbl.PDName, pd);
                          Console.WriteLine("Add PD:" + tbl.PDName);
                      }
                      catch(Exception ex) 
                      {
                          Console.WriteLine("PD Manager:"+ex.Message+","+ex.StackTrace);
                          ;}

                  }

              }
          }

           
          

      }