Beispiel #1
0
        /// <summary>
        /// 把字符串表达的沟通消息内部参数解析为消息内部参数对象
        /// </summary>
        /// <param name="szUserInfoData">字符串表达的沟通消息</param>
        /// <param name="szSplitChar">分隔符</param>
        /// <returns>UserInfo</returns>
        public static QChatArgs GetQChatArgsFromStr(string szQChatArgsData, string szSplitChar)
        {
            if (GlobalMethods.Misc.IsEmptyString(szQChatArgsData))
            {
                throw new Exception("用户信息数据不能为空!");
            }

            QChatArgs qChatArgs = new QChatArgs();

            string[] arrQChatArgs = szQChatArgsData.Split(new string[] { szSplitChar }, StringSplitOptions.None);
            if (arrQChatArgs.Length > 0)
            {
                qChatArgs.Sender = arrQChatArgs[0];
            }

            if (arrQChatArgs.Length > 1)
            {
                qChatArgs.Listener = arrQChatArgs[1];
            }



            //if (arrQChatArgs.Length > 0)
            //    qChatArgs.PatientID = arrQChatArgs[0];

            //if (arrQChatArgs.Length > 1)
            //    qChatArgs.VisitID = arrQChatArgs[1];

            //if (arrQChatArgs.Length > 2)
            //    qChatArgs.Sender = arrQChatArgs[2];

            //if (arrQChatArgs.Length > 3)
            //    qChatArgs.Listener = arrQChatArgs[3];

            //if (arrQChatArgs.Length > 4)
            //    qChatArgs.ArgType = arrQChatArgs[4];

            //if (arrQChatArgs.Length > 5)
            //    qChatArgs.UserType = arrQChatArgs[5];

            //if (arrQChatArgs.Length > 6)
            //    qChatArgs.MsgID = arrQChatArgs[6];

            return(qChatArgs);
        }
Beispiel #2
0
        /// <summary>
        /// 把用户信息对象解析为字符串形式
        /// </summary>
        /// <param name="userInfo">用户信息对象</param>
        /// <param name="szSplitChar">分隔符</param>
        /// <returns>用户信息字符串</returns>
        public static string GetStrFromQChatArgs(QChatArgs qChatArgs, string szSplitChar)
        {
            if (qChatArgs == null)
            {
                qChatArgs = new QChatArgs();
            }

            StringBuilder sbQChatArgs = new StringBuilder();

            sbQChatArgs.Append(qChatArgs.PatientID);
            sbQChatArgs.Append(szSplitChar);
            sbQChatArgs.Append(qChatArgs.VisitID);
            sbQChatArgs.Append(szSplitChar);
            sbQChatArgs.Append(qChatArgs.Sender);
            sbQChatArgs.Append(szSplitChar);
            sbQChatArgs.Append(qChatArgs.Listener);
            sbQChatArgs.Append(szSplitChar);
            sbQChatArgs.Append(qChatArgs.ArgType);
            sbQChatArgs.Append(szSplitChar);
            return(sbQChatArgs.ToString());
        }