Exemplo n.º 1
0
        public bool Response()
        {
            SQLService sql = new SQLService();
            ArrayList arrMsg = sql.SelOverMessages(rr.User_id);
            Sender sender = new Sender(data.Client);

            foreach (object obj in arrMsg)
            {
                MessageData msg = (MessageData)obj;
                MessageDataConvert converter = new MessageDataConvert();
                byte[] dataSend = converter.ConvertToBytes(msg);
                DataPackage dpk = new DataPackage();
                dpk.Data = dataSend;
                dpk.Client = data.Client;
                if (!sender.SendMessage(dpk))
                    return false;
            }

            //结束标识
            DataPackage endDpk = new DataPackage();
            endDpk.Data = BitConverter.GetBytes(0);
            endDpk.Client = data.Client;
            sender.SendMessage(endDpk);

            return true;
        }
Exemplo n.º 2
0
 public ReadUserInfo(DataPackage data)
 {
     AccountInfoConvet convert = new AccountInfoConvet();
     accountInfo = convert.ConvertToClass(data.Data);
     SQLService sql = new SQLService();
     accountInfo = sql.AccountInfoReader(accountInfo.User_id);
     dataSend.Client = data.Client;
     dataSend.Data = convert.ConvertToBytes(accountInfo);
 }
Exemplo n.º 3
0
        public AccountRequest(DataPackage data)
        {
            SQLService sql = new SQLService();
            dataRespect.User_IP = data.User_IP;

            LoginData loginData = new LoginData();
            loginData.User_password = convert.ConvertToPassword(data.Data);
            loginData.User_id = sql.AccountRequest(loginData.User_password);
            dataRespect.Data = convert.ConvertToSend(loginData);
        }
Exemplo n.º 4
0
        public AccountRequest(DataPackage data)
        {
            SQLService sql = new SQLService();
            dataResponse.Client = data.Client;

            LoginData loginData = convert.ConvertToClass(data.Data);
            loginData.User_id = sql.AccountRequest(loginData.User_password);

            dataResponse.Data = convert.ConvertToBytes(loginData);
        }
Exemplo n.º 5
0
        public void Send()
        {
            ArrayList arrOnlineUsers = new ArrayList();
            lock (Data.Data.ArrOnlineUsers)
            {
                for (int i = 0; i < Data.Data.ArrOnlineUsers.Count; i++)
                    arrOnlineUsers.Add(Data.Data.ArrOnlineUsers[i]);
            }
            bool isFoundOnline = false;

            //[未升级] 数据库处理
            for (int i = 0; i < arrOnlineUsers.Count; i++)
            {
                Data.OnlineUserProperties user = (Data.OnlineUserProperties)arrOnlineUsers[i];
                if (msgData.Receiver_id == user.User_id)
                {
                    isFoundOnline = true;
                    DataPackage dataPackage = new DataPackage();
                    dataPackage.Client = user.Client;
                    dataPackage.Data = bData;
                    Sender sender = new Sender(dataPackage.Client);
                    if (sender.SendMessage(dataPackage))
                        return;
                    else
                    {
                        //lock (Data.Data.ArrSendingMessages)
                        //{
                        //    Data.Data.ArrSendingMessages.Add(msgData);
                        //}
                        SQLService sql = new SQLService();
                        sql.InsertIntoOverMessages(msgData);
                    }
                    break;
                }
            }
            if (!isFoundOnline)
            {
                SQLService sql = new SQLService();
                sql.InsertIntoOverMessages(msgData);
            }
                //lock (Data.Data.ArrSendingMessages)
                //{
                //    Data.Data.ArrSendingMessages.Add(msgData);
                //}
        }
Exemplo n.º 6
0
        public bool Response()
        {
            try
            {
                SQLService sql = new SQLService();
                System.Collections.ArrayList arr = sql.SearchAccount(selAcc);

                foreach (object obj in arr)
                {
                    Sender sender = new Sender(client);
                    DataPackage dpk = new DataPackage();
                    AccountInfoConvet converter = new AccountInfoConvet();
                    dpk.Data = converter.ConvertToBytes((AccountInfo)obj);
                    dpk.Client = client;
                    sender.SendMessage(dpk);
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
Exemplo n.º 7
0
 public void Response()
 {
     SQLService sql = new SQLService();
     byte[] bIsSucceed = BitConverter.GetBytes(sql.AccountInfoEditor(accountInfo));
     dataSend.Data = bIsSucceed;
 }
Exemplo n.º 8
0
 public bool Login()
 {
     SQLService sql = new SQLService();
     return sql.Login(loginData);
 }