/// <summary>
        /// 服务器列表更新通知
        /// </summary>
        public static void NoticeServerList()
        {
            try
            {
                short cmd1 = 0; //主命令字
                short cmd2 = 0; //子命令字
                cmd1 = OMSCmd.RspGetServList;
                cmd2 = ErrCommon.Success;
                byte[]    ByteResult = null;
                DataTable dt         = new DataTable();
                dt = CommClass.DtServList.Copy();
                Commonality.CommClass.OutputBody(dt);
                CommClass.DataTableToByteArry(dt, ref ByteResult);


                foreach (KeyValuePair <string, Kernel.StateObject> a in CommClass.ClientConnList)
                {
                    Hashtable _hashtable_Package = new Hashtable();
                    _hashtable_Package.Add("1", a.Value);//...連結位置
                    _hashtable_Package.Add("2", cmd1);
                    _hashtable_Package.Add("3", cmd2);
                    _hashtable_Package.Add("4", ByteResult);
                    ThreadPool.QueueUserWorkItem(new WaitCallback(CommonFunction.SendDatas), _hashtable_Package);
                }
            }
            catch (Exception ex)
            {
                Commonality.ConsoleManage.Write(Commonality.ErrorLevel.Serious, "KOIPMonitor>>NoticeServerList>>", ex.Message);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 消息处理
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static void process(StateObject request)
        {
            //哈希表存放包体内容
            Hashtable _hashtable_Package = new Hashtable();

            try
            {
                if (request != null)
                {
                    #region 包体解析
                    short cmd1 = 0;    //主命令字
                    short cmd2 = 0;    //子命令字
                    cmd1 = OMSCmd.RspGetServList;
                    cmd2 = ErrCommon.Success;
                    byte[] ByteResult = null;
                    //DataTable dt = new DataTable();
                    //Commonality.CommClass.ReadXML(request.receiveFileTemporarily, ref dt);

                    //if (dt.Rows.Count <= 0)
                    //{
                    //    cmd2 = -101;//解包失败
                    //    //哈希表存放包体内容
                    //    Hashtable _hashtable_Package_Temp = new Hashtable();
                    //    _hashtable_Package_Temp.Add("1", request);//...連結位置
                    //    _hashtable_Package_Temp.Add("2", cmd1);
                    //    _hashtable_Package_Temp.Add("3", cmd2);
                    //    ByteResult = null;
                    //    _hashtable_Package_Temp.Add("4", ByteResult);
                    //    ThreadPool.QueueUserWorkItem(new WaitCallback(CommonFunction.SendDatas), _hashtable_Package_Temp);
                    //    Commonality.ConsoleManage.Write(Commonality.ErrorLevel.Serious,
                    //                                   "BusinessDAL.KNS.server>>SuperaddSingSongList>>process>>", "消息体内容有误");
                    //    return;
                    //}

                    //sessionid = dt.Rows[0]["SESSIONID"].ToString();
                    //RoomId = dt.Rows[0]["ROOMID"].ToString();
                    //UserID = sessionid;

                    #endregion

                    ////List表内容
                    //List<Commonality.CommClass.TTable> ListTtable = new List<Commonality.CommClass.TTable>();
                    ////Table属性内容
                    //Commonality.CommClass.TTable Ttable = new Commonality.CommClass.TTable();

                    //Ttable.FieldName = "MYLANAUDIO";
                    //Ttable.FieldValue = "";
                    //ListTtable.Add(Ttable);

                    //Commonality.CommClass.TableToByteArry(ListTtable, ref ByteResult);
                    DataTable dt = new DataTable();
                    dt = CommClass.DtServList.Copy();
                    Commonality.CommClass.OutputBody(dt);
                    CommClass.DataTableToByteArry(dt, ref ByteResult);

                    Hashtable _hashtable_PackageArry = new Hashtable();


                    _hashtable_PackageArry.Add("1", request);    //...連結位置
                    _hashtable_PackageArry.Add("2", cmd1);
                    _hashtable_PackageArry.Add("3", cmd2);
                    _hashtable_PackageArry.Add("4", ByteResult);
                    ThreadPool.QueueUserWorkItem(new WaitCallback(CommonFunction.SendDatas), _hashtable_PackageArry);
                }
                else
                {
                    Commonality.ConsoleManage.Write(Commonality.ErrorLevel.Serious, "RspGetServList>>process>>", "StateObject request==null");
                }
            }
            catch (Exception ex)
            {
                Commonality.ConsoleManage.Write(Commonality.ErrorLevel.Serious, "RspGetServList>>process>>", ex.Message);
            }
            finally
            {
                //删除文件
                //if (!string.IsNullOrEmpty(request.receiveFileTemporarily))
                //    ThreadPool.QueueUserWorkItem(new WaitCallback(DiskIO.Del), request.receiveFileTemporarily);

                //GC.Collect();
            }
        }
Beispiel #3
0
        /// <summary>
        /// 消息处理
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public static void process(StateObject request)
        {
            //哈希表存放包体内容
            Hashtable _hashtable_Package = new Hashtable();
            string    DEVID     = ""; //设备信息编号
            string    DEVNAME   = ""; //设备名称
            string    DEVTYPE   = ""; //设备类型;
            int       PageCount = 0;  //单页记录数
            int       CurrPage  = 0;  //当前页
            int       ID        = 0;  //自动增量编号

            try
            {
                if (request != null)
                {
                    #region 包体解析
                    short cmd1 = 0; //主命令字
                    short cmd2 = 0; //子命令字
                    cmd1 = OMSCmd.DevInfoQuery;
                    cmd2 = ErrCommon.Success;
                    byte[]    ByteResult = null;
                    DataTable dt         = new DataTable();
                    Commonality.CommClass.ReadXML(request.receiveFileTemporarily, ref dt);

                    if (dt.Rows.Count <= 0)
                    {
                        cmd2 = -101;//解包失败
                        //哈希表存放包体内容
                        Hashtable _hashtable_Package_Temp = new Hashtable();
                        _hashtable_Package_Temp.Add("1", request);//...連結位置
                        _hashtable_Package_Temp.Add("2", cmd1);
                        _hashtable_Package_Temp.Add("3", cmd2);
                        ByteResult = null;
                        _hashtable_Package_Temp.Add("4", ByteResult);
                        ThreadPool.QueueUserWorkItem(new WaitCallback(CommonFunction.SendDatas), _hashtable_Package_Temp);
                        Commonality.ConsoleManage.Write(Commonality.ErrorLevel.Serious,
                                                        "KOIPMonitor>>DevInfoQuery>>process>>", "消息体内容有误");
                        return;
                    }



                    if (dt.Columns["DEVID"] != null)
                    {
                        DEVID = dt.Rows[0]["DEVID"].ToString();
                    }
                    else
                    {
                        DEVID = null;
                    }

                    if (dt.Columns["DEVTYPE"] != null)
                    {
                        DEVTYPE = dt.Rows[0]["DEVTYPE"].ToString();
                    }
                    else
                    {
                        DEVTYPE = null;
                    }
                    if (dt.Columns["DEVNAME"] != null)
                    {
                        DEVNAME = dt.Rows[0]["DEVNAME"].ToString();
                    }
                    else
                    {
                        DEVNAME = null;
                    }

                    try
                    {
                        ID = Convert.ToInt32(dt.Rows[0]["ID"].ToString());
                    }
                    catch
                    {
                        ID = 0;
                    }

                    try
                    {
                        PageCount = Convert.ToInt32(dt.Rows[0]["PAGECOUNT"].ToString());
                    }
                    catch
                    {
                        PageCount = 0;
                    }
                    try
                    {
                        CurrPage = Convert.ToInt32(dt.Rows[0]["CURRPAGE"].ToString());
                    }
                    catch
                    {
                        CurrPage = 0;
                    }



                    #endregion
                    DataTable dtRet     = null;
                    DataTable dtRetInfo = null;
                    Devinfo_Query(ID, DEVID, DEVNAME, DEVTYPE, PageCount, CurrPage, ref dtRet, ref dtRetInfo);

                    if (dtRet != null)
                    {
                        int TotalRecords = Convert.ToInt32(dtRetInfo.Rows[0][0].ToString());
                        int TotalPage    = Convert.ToInt32(dtRetInfo.Rows[0][1].ToString());;//总记录数
                        _hashtable_Package.Add("1", request);
                        _hashtable_Package.Add("3", TotalPage);
                        _hashtable_Package.Add("4", CurrPage);
                        _hashtable_Package.Add("5", TotalRecords);
                        _hashtable_Package.Add("6", cmd1);
                        CommClass.DataTableToByteArry(dtRet, ref ByteResult);
                        _hashtable_Package.Add("2", ByteResult);
                        ThreadPool.QueueUserWorkItem(new WaitCallback(CommonFunction.SendDatasPage), _hashtable_Package);
                    }
                    else
                    {
                        cmd2 = -8019;
                        Hashtable _hashtable_PackageArry = new Hashtable();
                        _hashtable_PackageArry.Add("1", request);//...連結位置
                        _hashtable_PackageArry.Add("2", cmd1);
                        _hashtable_PackageArry.Add("3", cmd2);
                        _hashtable_PackageArry.Add("4", ByteResult);
                        ThreadPool.QueueUserWorkItem(new WaitCallback(CommonFunction.SendDatas), _hashtable_PackageArry);
                    }
                }
                else
                {
                    Commonality.ConsoleManage.Write(Commonality.ErrorLevel.Serious, "KOIPMonitor>>DevInfoQuery>>process>>", "StateObject request==null");
                }
            }
            catch (Exception ex)
            {
                Commonality.ConsoleManage.Write(Commonality.ErrorLevel.Serious, "KOIPMonitor>>DevTypeQuery>>process>>", ex.Message);
            }
            finally
            {
                //删除文件
                //if (!string.IsNullOrEmpty(request.receiveFileTemporarily))
                //    ThreadPool.QueueUserWorkItem(new WaitCallback(DiskIO.Del), request.receiveFileTemporarily);

                //GC.Collect();
            }
        }