Ejemplo n.º 1
0
        //// 2007.02.11 Added
        ////
        //static public void ResolveGprsStation()
        //{
        //    string s = string.Format(@"select gprs_station_id, name, commport,
        //        gr_address, xg_address, grstation_id, xgstation_id from v_gprs_gr_xg where client = {0}", XGConfig.Default.ClientAorB );
        //    DataSet ds = DbClient.Execute( s );
        //    DataTable dt = ds.Tables[0];
        //    foreach ( DataRow r in dt.Rows )
        //    {
        //        string name = r[1].ToString();
        //        int commport = int.Parse( r[2].ToString() );
        //        CommPortProxy cpp = new CommPortProxy((short) commport, XGConfig.Default.CommPortSettings );
        //        // add try
        //        //
        //        try
        //        {
        //            cpp.Open();
        //        }
        //        catch
        //        {
        //            // Open commport fail.
        //            //
        //            Debug.Fail( "Open commport " + commport + " fail." );
        //        }
        //
        //        cpp.IsEnableAutoReport = true;
        //        cpp.RThreshold = 1;
        //        //cpp.ReceiveAutoReport += new EventHandler( ARDProcessor.Default.Process );
        //
        //        CFW.TaskScheduler commTaskSch = new CFW.TaskScheduler( cpp, XGConfig.Default.TaskSchedulerInterval );
        //        //commTaskSch.Executed +=new EventHandler( CommTaskResultProcessor.Default.Process );
        //        commTaskSch.Enabled = true;
        //
        //        // Add the commTask scheduler to taskSchedulerCollection
        //        //
        //        TaskSchedulersCollection tss = Singles.S.TaskSchCollection;
        //        tss.Add( commTaskSch );
        //
        //    }
        //
        //}

        static public ObjectIdAssociateCollection ResolveCard()
        {
            ObjectIdAssociateCollection cardIdAssoc = new ObjectIdAssociateCollection("tbl_card");

            string    s   = "select card_id, sn, person from tbl_card";
            DataSet   ds  = DbClient.Execute(s);
            DataTable tbl = ds.Tables[0];

            foreach (DataRow r in tbl.Rows)
            {
                int    id     = int.Parse(r[0].ToString());
                string sn     = r[1].ToString();
                string person = r[2].ToString();

                Card card = new Card(sn, person);
                cardIdAssoc.Add(card, id);
            }

            return(cardIdAssoc);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 解析巡更控制器站点
        /// </summary>
        /// <returns></returns>
        static public ObjectIdAssociateCollection ResolveXGStation()
        {
            ObjectIdAssociateCollection stationIdAssoc = new ObjectIdAssociateCollection("tbl_xgstation");

//            string s = "select xgstation_id, name, address from tbl_xgstation";
            string    s   = "select xgstation_id, name, xg_address, ip from v_gprs_gr_xg";
            DataSet   ds  = DbClient.Execute(s);
            DataTable tbl = ds.Tables[0];

            foreach (DataRow r in tbl.Rows)
            {
                int    id      = int.Parse(r[0].ToString());
                string name    = r[1].ToString();
                int    address = int.Parse(r[2].ToString());
                string ipAddr  = r[3].ToString().Trim();

                XGStation st = new XGStation(name, ipAddr, address);
                stationIdAssoc.Add(st, id);
            }

            return(stationIdAssoc);
        }