Exemplo n.º 1
0
        public void addAckDeal(string msg)
        {
            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");
            string type = TextFollowing(msg, "TYPE:");
            string number = TextFollowing(msg, "NUMBER:");
            string status = TextFollowing(msg, "STATUS:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");


            Fleck.IWebSocketConnection clientSock = myGlobals.operatorData.getOperatorSock(operatorName);
            Socket serverSock = myGlobals.ClientServer[clientSock];

            foreach (var kv in myGlobals.myPlans.plans.Values)
            {
                if (kv.Contains(number))
                    serverRoomId = kv.serverRoomId;
            }

            if (status == "OK")
            {
                myGlobals.mre2.WaitOne();
                myGlobals.mre1.Reset();
               // if (myGlobals.gatewaySip.active[type] == "1")
                if (myGlobals.gatewayData.gateway[type].isConnnected)
                {
                    string msg2Client = "MEMBERCONNECTED\r\n"
                                             + "NUMBER:" + number + "\r\n"
                                             + "ISOPERATOR:0\r\n"
                                             + "OPERATORNAME:" + operatorName + "\r\n"
                                             + "LOCALCONFROOMID:" + localRoomId + "\r\n"
                                             + "SERVERROOMID:" + serverRoomId + "\r\n"
                                             + "ANSWERTIME:\r\n"
                                             + "ENABLEVIDEO:NO\r\n";
                    //byte[] bytes = System.Text.Encoding.UTF8.GetBytes(msg2Client);
                   // byte[] bytes = addHead(msg2Client);
                    //ServerUpdateMessage(bytes, serverSock, 2);
                    string flagStr = "-1-2-1-2-1-2-1-2";
                    string total = flagStr + msg2Client;
                    sendMsgToClient(total, serverSock, GlobalMessage.ALIYUNDATA);
                }
                else
                {

                }
                USER_INFO oldUser = new USER_INFO();
                oldUser.phone = number;

                USER_INFO newUser = new USER_INFO();

                newUser.localRoomId = localRoomId;
                newUser.serverRoomId = serverRoomId;
                myGlobals.dbManager.UpdateUser(newUser, oldUser);
                myGlobals.mre1.Set();
            }
            else if (status == "FAILED")
            {
                //long l = myGlobals.ServerClient[sock];
                // string operatorName = myGlobals.operators[l];
                string msg2Client = "MEMBERCALLFAILED\r\n"
                                  + "CONFTYPE:0\r\n"
                                  + "OPERATORNAME:" + operatorName + "\r\n"
                                  + "ISOPERATOR:0\r\n"
                                  + "NUMBER:" + number + "\r\n"
                                  + "LOCALCONFROOMID:" + localRoomId + "\r\n"
                                  + "SERVERROOMID:" + serverRoomId + "\r\n"
                                  + "REASIONCODE:602\r\n";
                //byte[] bytes = System.Text.Encoding.UTF8.GetBytes(msg2Client);
                //byte[] bytes = addHead(msg2Client);
                string flagStr = "-1-2-1-2-1-2-1-2";
                string total = flagStr + msg2Client;
                sendMsgToClient(total, serverSock, GlobalMessage.ALIYUNDATA);
               // ServerUpdateMessage(bytes, serverSock, 2);
            }

        }
Exemplo n.º 2
0
        string serverReleaseConfRoom(string msg, Socket sock)
        {

            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");
         //   string operatorNum = TextFollowing(msg, "OPERATORNUMBER:");

            foreach(var kv in myGlobals.myPlans.plans)
            {
                if (kv.Value.serverRoomId == serverRoomId)
                {
                    myGlobals.myPlans.plans.Remove(kv.Value.operatorNum);
                    break;
                }
            }

            foreach (var kv in myGlobals.myRooms.rooms)
            {
                if (kv.Value.serverRoomId == serverRoomId)
                {
                    myGlobals.myRooms.rooms.Remove(kv.Value.operatorNum);
                    break;
                }
            }


            USER_INFO userInfo = new USER_INFO();

            userInfo.localRoomId = localRoomId;
            userInfo.serverRoomId = serverRoomId;

            USER_INFO[] userArr = myGlobals.dbManager.GetUser(userInfo);

            if (userArr.Length > 0)
            {
                USER_INFO oldUser = new USER_INFO();
                oldUser.localRoomId = localRoomId;
                oldUser.serverRoomId = serverRoomId;

                USER_INFO newUser = new USER_INFO();
                newUser.localRoomId = "0";
                newUser.serverRoomId = "0";
                myGlobals.dbManager.UpdateUser(newUser, oldUser);
            }
            return msg;

        }
Exemplo n.º 3
0
        public void delAckDeal(string msg)
        {
            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");
            string type = TextFollowing(msg, "TYPE:");
            string number = TextFollowing(msg, "NUMBER:");
            string status = TextFollowing(msg, "STATUS:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");

            Fleck.IWebSocketConnection clientSock = myGlobals.operatorData.getOperatorSock(operatorName);
            Socket serverSock = myGlobals.ClientServer[clientSock];

            //foreach (var kv in myGlobals.myPlans.plans.Values)
            //{
            //    if (kv.Contains(number))
            //        serverRoomId = kv.serverRoomId;
            //}

            if (status == "OK")
            {

                USER_INFO oldUser = new USER_INFO();
                USER_INFO newUser = new USER_INFO();

                oldUser.phone = number;
                newUser.localRoomId = "0";
                newUser.serverRoomId = "0";
                myGlobals.dbManager.UpdateUser(newUser, oldUser);



                string msg2Client = "QUITCONFROOM\r\n"
                                  + "ISOPERATOR:0\r\n"
                                  + "OPERATORNAME:" + operatorName + "\r\n"
                                  + "LOCALCONFROOMID:" + localRoomId + "\r\n"
                                  + "SERVERROOMID:" + serverRoomId + "\r\n"
                                  + "NUMBER:" + number + "\r\n";
                // byte[] bytes = System.Text.Encoding.UTF8.GetBytes(msg2Client);
               // byte[] bytes = addHead(msg2Client);
                string flagStr = "-1-2-1-2-1-2-1-2";
                string total = flagStr + msg2Client;
                //ServerUpdateMessage(bytes, serverSock, 2);
                sendMsgToClient(total, serverSock, GlobalMessage.ALIYUNDATA);

                if (myGlobals.gatewayData.gateway[type].isConnnected == true)
                {
                    USER_INFO tmpUserInfo = new USER_INFO();
                    tmpUserInfo.type = type;
                    tmpUserInfo.localRoomId = localRoomId;
                    tmpUserInfo.serverRoomId = serverRoomId;

                    USER_INFO[] userRecords = myGlobals.dbManager.GetUser(tmpUserInfo);

                    if (userRecords.Length == 0)
                    {
                        string sipNum = myGlobals.gatewayData.getNumber(type);
                        string msg2Server = "KICKCONFMEMBER\r\n"
                                          + "OPERATORNAME:" + operatorName + "\r\n"
                                          + "LOCALCONFROOMID:" + localRoomId + "\r\n"
                                          + "SERVERROOMID:" + serverRoomId + "\r\n"
                                          + "NUMBER:" + sipNum + "\r\n";

                        // byte[] byteMessage = System.Text.Encoding.UTF8.GetBytes(msg2Server);
                        byte[] buffer = addHead(msg2Server);
                        sendMsgToServer(buffer, clientSock, GlobalMessage.ALIYUNDATA);

                    }
                }

            }
        }
Exemplo n.º 4
0
        string memberCallFailed(string msg, Socket sock)
        {
            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");

            string number = TextFollowing(msg, "NUMBER:");

            foreach (var kv in myGlobals.gatewayData.gateway)
            {
                if (kv.Value.sipNo == number)
                {
                    myGlobals.gatewayData.gateway[kv.Key].isOccupied = false;

                    string type = kv.Key;

                    USER_INFO userInfo = new USER_INFO();
                    userInfo.serverRoomId = serverRoomId;
                    userInfo.type = type;
                    USER_INFO[] userRecords = myGlobals.dbManager.GetUser(userInfo);

                    Dictionary<string, List<string>> tmpPhones = new Dictionary<string, List<string>>();
                    List<string> list = new List<string>();
                    foreach (USER_INFO tmpUserInfo in userRecords)
                    {
                        string msg2Client = "MEMBERCALLFAILED\r\n"
                                  + "CONFTYPE:0\r\n"
                                  + "OPERATORNAME:" + operatorName + "\r\n"
                                  + "ISOPERATOR:0\r\n"
                                  + "NUMBER:" + tmpUserInfo.phone + "\r\n"
                                  + "LOCALCONFROOMID:" + localRoomId + "\r\n"
                                  + "SERVERROOMID:" + serverRoomId + "\r\n"
                                  + "REASIONCODE:602\r\n";

                        byte[] bytes = addHead(msg2Client);
                        sendMsgToClient(bytes, sock, GlobalMessage.DATA);
                        list.Add(tmpUserInfo.phone);
                    }

                    tmpPhones.Add(type, list);
                    myGlobals.pocSendDeal.deleteMember(operatorName, localRoomId, serverRoomId, tmpPhones);
                }
                return null;
            }

            return msg;
        }
Exemplo n.º 5
0
        string confRoomInfo(string msg, Socket sock)
        {

            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");

            int i;
            i = msg.LastIndexOf("CONFMEMBER");
            int num = Convert.ToInt32(msg[i + 1]);
            int oldNum = num;

            USER_INFO userInfo = new USER_INFO();
            userInfo.serverRoomId = serverRoomId;
            USER_INFO[] userInfoArr = myGlobals.dbManager.GetUser(userInfo);

            foreach (USER_INFO u in userInfoArr)
            {
                string tmpStr = "CONFMEMBER" + num;
                msg += tmpStr + ":" + "123456;" + u.phone + ";TALKING;;" + u.phone + ";0;0;1;1;1;" + "\r\n";
                num++;
            }

            int newNum = num;
            msg = msg.Replace("CONFMEMBER" + oldNum, "CONFMEMBER" + newNum);
            return msg;

        }
Exemplo n.º 6
0
        public Numbers processNumbers(string message, string type)
        {

            if (string.IsNullOrEmpty(message))
            {
                return null;
            }
            Numbers tmpPhoneNumbers = new Numbers();

            char splitChar = ';';
            string[] tempArr = message.Split(splitChar);
            for (int i = 0; i < tempArr.Length; i++)
            {
                //userInfo = dbManager.GetUser("", tempArr[i], "", "", "", "");
                USER_INFO userInfo = new USER_INFO();
                userInfo.phone = tempArr[i];
                USER_INFO[] userInfoArr = myGlobals.dbManager.GetUser(userInfo);
                if (userInfoArr.Length > 0)
                {
                    tmpPhoneNumbers.addNumber(userInfoArr[0].type, tempArr[i]);
                }
                else
                {
                    //dbManager.AddUser("", tempArr[i], "", "", "", type);
                    userInfo.type = type;
                    if (myGlobals.pocTypes.Contains(type))
                        myGlobals.dbManager.AddUser(userInfo);
                    tmpPhoneNumbers.addNumber(type, tempArr[i]);
                }
            }
            return tmpPhoneNumbers;
        }
Exemplo n.º 7
0
        string memberConnected(string msg, Socket sock)
        {
            string serverRoomId = TextFollowing(msg, "SERVERROOMID:");
            string localRoomId = TextFollowing(msg, "LOCALCONFROOMID:");
            string operatorName = TextFollowing(msg, "OPERATORNAME:");
            string number = TextFollowing(msg, "NUMBER:");



            // if (myGlobals.gatewaySip.sipNum.ContainsValue(number))
            if (myGlobals.gatewayData.ContainsNumber(number))
            {
                myGlobals.mre1.WaitOne();
                myGlobals.mre2.Reset();
                //foreach (KeyValuePair<string, string> kv in myGlobals.gatewaySip.sipNum)

                string type = myGlobals.gatewayData.getType(number);
                USER_INFO userInfo = new USER_INFO();
                userInfo.serverRoomId = serverRoomId;
                userInfo.type = type;
                USER_INFO[] userRecords = myGlobals.dbManager.GetUser(userInfo);

                // myGlobals.gatewaySip.active[type] = "1";
                myGlobals.gatewayData.gateway[type].isConnnected = true;
                myGlobals.gatewayData.gateway[type].serverRoomId = serverRoomId;
                myGlobals.mre2.Set();

                foreach (USER_INFO tmpUserInfo in userRecords)
                {
                    string msg2Client = "MEMBERCONNECTED\r\n"
                                        + "NUMBER:" + tmpUserInfo.phone + "\r\n"
                                        + "ISOPERATOR:0\r\n"
                                        + "OPERATORNAME:" + operatorName + "\r\n"
                                        + "LOCALCONFROOMID:" + localRoomId + "\r\n"
                                        + "SERVERROOMID:" + serverRoomId + "\r\n"
                                        + "ANSWERTIME:\r\n"
                                        + "ENABLEVIDEO:NO\r\n";
                    // byte[] bytes = System.Text.Encoding.UTF8.GetBytes(msg2Client);
                    byte[] bytes = addHead(msg2Client);
                    //ServerUpdateMessage(bytes, sock, 2);
                    sendMsgToClient(bytes, sock, GlobalMessage.DATA);
                }
                return null;

            }
            return msg;

        }
Exemplo n.º 8
0
        string deleteMemberNotify(string msg, Fleck.IWebSocketConnection clientSock)
        {
           
            string number = TextFollowing(msg, "NUMBER:");
            //string type = TextFollowing(msg, "TYPE:");

            USER_INFO userInfo = new USER_INFO();
            //userInfo.name = number;
            userInfo.phone = number;
           // userInfo.type = type;
            myGlobals.dbManager.DeleteUser(userInfo);

			return msg;

        }
Exemplo n.º 9
0
        /// <summary>
        /// 得到网关表记录,可以是一条记录,也可以是多条记录
        /// </summary>
        /// <param name="sIdValue"></param>查找条件中的网关记录id值,如果无关为空
        /// <param name="sSipNumberValue"></param>查找条件中的网关记录sip_number值,如果无关为空
        /// <param name="sPocNumberValue"></param>查找条件中的网关记录poc_number值,如果无关为空
        /// <param name="sSpTypeValue"></param>查找条件中的网关记录网关所属运营商值,如果无关为空
        /// <param name="sBelongGroupidValue"></param>查找条件中的网关记录网关所属groupid值,如果无关为空
        /// <returns></returns>返回变长的数据结构数组,每条记录放在一个结构体中
        public USER_INFO[] GetUser(USER_INFO userInfo)
        {
            string sWhereInfo = "";
            string sLogString = "GetUserTableRecords() ";
            ArrayList alTmpRet = new ArrayList();
            Char[] cSplitColumnStr = { ';' };//分隔每一列的分隔符
            Char[] cSplitFieldStr = { ':' };//分隔每个列名称和列值的分隔符
            string[] sSplitColumninfo;
            string[] sSplitFieldinfo;
            USER_INFO[] stGatewayRecord;
            int iFlag = 0;

            //生成where串
            if (!string.IsNullOrEmpty(userInfo.phone))
            {
                if (iFlag == 0)
                {
                    sWhereInfo += "phone=" + "\"" + userInfo.phone + "\"";
                    iFlag = 1;
                }
                else
                {
                    sWhereInfo += " and phone=" + "\"" + userInfo.phone + "\"";
                }
            }
            if (!string.IsNullOrEmpty(userInfo.name))
            {
                if (iFlag == 0)
                {
                    sWhereInfo += "name=" + "\"" + userInfo.name + "\"";
                    iFlag = 1;
                }
                else
                {
                    sWhereInfo += " and name=" + "\"" + userInfo.name + "\"";
                }
            }
            if (!string.IsNullOrEmpty(userInfo.localRoomId))
            {
                if (iFlag == 0)
                {
                    sWhereInfo += "localRoomId=" + "\"" + userInfo.localRoomId + "\"";
                    iFlag = 1;
                }
                else
                {
                    sWhereInfo += " and localRoomId=" + "\"" + userInfo.localRoomId + "\"";
                }
            }
            if (!string.IsNullOrEmpty(userInfo.serverRoomId))
            {
                if (iFlag == 0)
                {
                    sWhereInfo += "serverRoomId=" + "\"" + userInfo.serverRoomId + "\"";
                    iFlag = 1;
                }
                else
                {
                    sWhereInfo += " and serverRoomId=" + "\"" + userInfo.serverRoomId + "\"";
                }
            }
            if (!string.IsNullOrEmpty(userInfo.type))
            {
                if (iFlag == 0)
                {
                    sWhereInfo += "type=" + "\"" + userInfo.type + "\"";
                    iFlag = 1;
                }
                else
                {
                    sWhereInfo += " and type=" + "\"" + userInfo.type + "\"";
                }
            }
            
            sLogString += "sWhereInfo is: " + sWhereInfo + "\n";
            MysqlBasicMethods.WriteMysqlLog(sLogString);
            //调用基本的GET记录函数
            alTmpRet = MysqlBasicMethods.GetRecordsOperation(sUserInfoTableName, sWhereInfo);

            if (alTmpRet.Count > 0)
            {
                stGatewayRecord = new USER_INFO[alTmpRet.Count];
                for (int i = 0; i < alTmpRet.Count; i++)
                {
                    sSplitColumninfo = Convert.ToString(alTmpRet[i]).Split(cSplitColumnStr);
                    for (int j = 0; j < sSplitColumninfo.Length; j++)
                    {
                        sSplitFieldinfo = sSplitColumninfo[j].Split(cSplitFieldStr);
                        switch (sSplitFieldinfo[0])
                        {

                            case "phone":
                                stGatewayRecord[i].phone = sSplitFieldinfo[1];
                                break;
                            case "name":
                                stGatewayRecord[i].name = sSplitFieldinfo[1];
                                break;
                            case "localRoomId":
                                stGatewayRecord[i].localRoomId = sSplitFieldinfo[1];
                                break;
                            case "serverRoomId":
                                stGatewayRecord[i].serverRoomId = sSplitFieldinfo[1];
                                break;
                            case "type":
                                stGatewayRecord[i].type = sSplitFieldinfo[1];
                                break;
                            default:
                                break;
                        }
                    }

                }

                sLogString = "GetUserTableRecords() success.";
            }
            else
            {
                stGatewayRecord = new USER_INFO[0];
                sLogString = "GetUserTableRecords() fail.";
            }
            MysqlBasicMethods.WriteMysqlLog(sLogString);

            return stGatewayRecord;
        }
Exemplo n.º 10
0
 /// <summary>
 /// 更新网关表记录,可以是一条,也可以是多条记录
 /// </summary>
 /// <param name="sIdValue"></param>要设置的网关新id值,不改变为空
 /// <param name="sSipNumberValue"></param>要设置的网关新sip号码值,不改变为空
 /// <param name="sPocNumberValue"></param>要设置的网关新poc号码值,不改变为空
 /// <param name="sSpTypeValue"></param>要设置的网关新运营商类型值,不改变为空
 /// <param name="sBelongGroupidValue"></param>要设置的网关新所属groupid值,不改变为空
 /// <param name="sWhereIdValue"></param>要更改网关表的条件中id值,与这个值无关为空
 /// <param name="sWhereSipNumberValue"></param>要更改网关表的条件中sip号码值,与这个值无关为空
 /// <param name="sWherePocNumberValue"></param>要更改网关表的条件中poc号码值,与这个值无关为空
 /// <param name="sWhereSpTypeValue"></param>要更改网关表的条件中运营商类型值,与这个值无关为空
 /// <param name="sWhereBelongGroupidValue"></param>要更改网关表的条件中网关所属groupid值,与这个值无关为空
 /// <returns></returns>
 public int UpdateUser(USER_INFO userInfo, USER_INFO whereUserInfo)
 {
     string sSetString = "";
     string sWhereInfo = "";
     string sLogString = "UpdateUserTableRecords() ";
     int iRet = 0;
     int iFlag = 0;
     //生成set串
     if (!string.IsNullOrEmpty(userInfo.phone))
     {
         if (iFlag == 0)
         {
             sSetString += "phone=" + "\"" + userInfo.phone + "\"";
             iFlag = 1;
         }
         else
         {
             sSetString += ",phone=" + "\"" + userInfo.phone + "\"";
         }
     }
     if (!string.IsNullOrEmpty(userInfo.name))
     {
         if (iFlag == 0)
         {
             sSetString += "name=" + "\"" + userInfo.name + "\"";
             iFlag = 1;
         }
         else
         {
             sSetString += ",name=" + "\"" + userInfo.name + "\"";
         }
     }
     if (!string.IsNullOrEmpty(userInfo.localRoomId))
     {
         if (iFlag == 0)
         {
             sSetString += "localRoomId=" + "\"" + userInfo.localRoomId + "\"";
             iFlag = 1;
         }
         else
         {
             sSetString += ",localRoomId=" + "\"" + userInfo.localRoomId + "\"";
         }
     }
     if (!string.IsNullOrEmpty(userInfo.serverRoomId))
     {
         if (iFlag == 0)
         {
             sSetString += "serverRoomId=" + "\"" + userInfo.serverRoomId + "\"";
             iFlag = 1;
         }
         else
         {
             sSetString += ",serverRoomId=" + "\"" + userInfo.serverRoomId + "\"";
         }
     }
     if (!string.IsNullOrEmpty(userInfo.type))
     {
         if (iFlag == 0)
         {
             sSetString += "type=" +"\"" + userInfo.type + "\"";
             iFlag = 1;
         }
         else
         {
             sSetString += ",type="  + "\"" +userInfo.type  + "\"";
         }
     }
   
     //生成where串
     iFlag = 0;
     if (!string.IsNullOrEmpty(whereUserInfo.phone))
     {
         if (iFlag == 0)
         {
             sWhereInfo += "phone=" + "\"" + whereUserInfo.phone + "\"";
             iFlag = 1;
         }
         else
         {
             sWhereInfo += " and phone=" + "\"" + whereUserInfo.phone + "\"";
         }
     }
     if (!string.IsNullOrEmpty(whereUserInfo.name))
     {
         if (iFlag == 0)
         {
             sWhereInfo += "name=" + "\"" + whereUserInfo.name + "\"";
             iFlag = 1;
         }
         else
         {
             sWhereInfo += " and name=" + "\"" + whereUserInfo.name + "\"";
         }
     }
     if (!string.IsNullOrEmpty(whereUserInfo.localRoomId))
     {
         if (iFlag == 0)
         {
             sWhereInfo += "localRoomId=" + "\"" + whereUserInfo.localRoomId + "\"";
             iFlag = 1;
         }
         else
         {
             sWhereInfo += " and localRoomId=" + "\"" + whereUserInfo.localRoomId + "\"";
         }
     }
     if (!string.IsNullOrEmpty(whereUserInfo.serverRoomId))
     {
         if (iFlag == 0)
         {
             sWhereInfo += "serverRoomId=" + "\"" + whereUserInfo.serverRoomId + "\"";
             iFlag = 1;
         }
         else
         {
             sWhereInfo += " and serverRoomId=" + "\"" + whereUserInfo.serverRoomId + "\"";
         }
     }
     if (!string.IsNullOrEmpty(whereUserInfo.type))
     {
         if (iFlag == 0)
         {
             sWhereInfo += "type=" + "\""+whereUserInfo.type + "\"";
             iFlag = 1;
         }
         else
         {
             sWhereInfo += " and type=" + "\""+ whereUserInfo.type + "\"";
         }
     }
    
     sLogString += "sSetString is: " + sSetString + "\n"
                   + "sWhereInfo is: " + sWhereInfo + "\n";
     MysqlBasicMethods.WriteMysqlLog(sLogString);
     //调用基本的更新记录函数
     iRet = MysqlBasicMethods.UpdateRecordsOperation(sUserInfoTableName, sSetString, sWhereInfo, 0);
     if (iRet > 0)
     {
         sLogString = "UpdateUserTableRecords() success. iRet is: " + iRet.ToString();
     }
     else
     {
         sLogString = "UpdateUserTableRecords() fail. iRet is: " + iRet.ToString();
     }
     MysqlBasicMethods.WriteMysqlLog(sLogString);
     return iRet;
 }
Exemplo n.º 11
0
        public int AddUser(USER_INFO userInfo)
        {
            string sColumnsInfo = "";
            string sColumnsValues = "";
            string sLogString = "AddUserTableRecord() ";
            int iRet = 0;
            if (!string.IsNullOrEmpty(userInfo.phone))
            {
                sColumnsInfo += "phone";
                sColumnsValues += "\"" + userInfo.phone + "\"";
            }
            if (!string.IsNullOrEmpty(userInfo.name))
            {
                sColumnsInfo += ",name";
                sColumnsValues += "," + "\"" + userInfo.name + "\"";
            }
            if (!string.IsNullOrEmpty(userInfo.localRoomId))
            {
                sColumnsInfo += ",localRoomId";
                sColumnsValues += "," + "\"" + userInfo.localRoomId + "\"";
            }
            if (!string.IsNullOrEmpty(userInfo.serverRoomId))
            {
                sColumnsInfo += ",serverRoomId";
                sColumnsValues += "," + "\"" + userInfo.serverRoomId + "\"";
            }
            if (!string.IsNullOrEmpty(userInfo.type))
            {
                sColumnsInfo += ",type";
                sColumnsValues += "," + "\"" +userInfo.type + "\"";
            }
            

            sLogString += "sColumnsInfo is: " + sColumnsInfo + "\n"
                          + "; sColumnsValues is: " + sColumnsValues + "\n";
            MysqlBasicMethods.WriteMysqlLog(sLogString);
            //调用基本的增加记录函数
            iRet = MysqlBasicMethods.AddRecordOperation(sUserInfoTableName, sColumnsInfo, sColumnsValues);
            if (iRet > 0)
            {
                sLogString = "AddUserTableRecord() success. iRet is: " + iRet.ToString();
            }
            else
            {
                sLogString = "AddUserTableRecord() fail. iRet is: " + iRet.ToString();
            }
            MysqlBasicMethods.WriteMysqlLog(sLogString);
            return iRet;
        }
Exemplo n.º 12
0
        string addMemberNotify(string msg, Socket clientSock)
        {
           

            string number = TextFollowing(msg, "NUMBER:");
            string type = TextFollowing(msg, "TYPE:");
            
            USER_INFO userInfo = new USER_INFO();
            userInfo.name = number;
            userInfo.phone = number;
            userInfo.type = type;
            myGlobals.dbManager.AddUser(userInfo);
			return msg;
        }