public override void Run()
        {
            ReferenceData.Entity.Account acc  = (ReferenceData.Entity.Account)data.Data;
            ReferenceData.Entity.Account user = new AccountDAO().GetAccountBySignInInfo(acc.email, acc.password);
            SocketData response = new SocketData("ACCOUNT", user);

            worker.send(response);
            if (user != null)
            {
                worker.Server.OnlineList.Add(new OnlineAccount(worker, user));
                sendConversationList(user);
                Console.WriteLine($"Account: {user.firstName} {user.lastName}, AccountId: {user.id} Signed In!!!");
                Console.WriteLine($"Number Of Online Account: {worker.Server.OnlineList.Count}");
            }
        }
        public override void Run()
        {
            string         keyword = (string)data.Data;
            List <Account> list    = new AccountDAO().SearchAccount(keyword);

            worker.send(new SocketData("SEARCHRESULT", list));
        }
        public override void Run()
        {
            ReferenceData.Entity.Account account = (ReferenceData.Entity.Account)data.Data;
            int result = 1;

            try
            {
                db.Usp_InsertAccount(account.email, account.password, account.firstName, account.lastName);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                result = 0;
            }
            SocketData dataRes;

            if (result == 1)
            {
                dataRes = new SocketData("OK", true);
            }
            else
            {
                dataRes = new SocketData("FAIL", false);
            }
            worker.send(dataRes);
        }
Esempio n. 4
0
 public override void Run()
 {
     if (worker.MessageList.Count > worker.From - 1)
     {
         List <ReferenceData.Entity.Message> list = worker.MessageList.Skip(worker.From - 1).Take(15).ToList();
         worker.send(new SocketData("LOADMOREMESSAGE", list));
         worker.From += 15;
     }
 }
        public override void Run()
        {
            object[]       d = (object[])data.Data;
            string         conversationId = (string)d[0];
            int            offset         = (int)d[1];
            int            limit          = (int)d[2];
            List <Message> list           = new MessageDAO().GetMessagesByConversationId(conversationId, offset, limit);

            if (list != null)
            {
                worker.send(new SocketData("MESSAGELIST", list));
                worker.From        = limit;
                worker.MessageList = new MessageDAO().GetAllMessagesByConversationId(conversationId);
            }
        }
 public override void Run()
 {
     ReferenceData.Entity.Account acc     = (ReferenceData.Entity.Account)data.Data;
     ReferenceData.Entity.Account account = new AccountDAO().UpdateAccount(acc);
     worker.send(new SocketData("RESULTUPDATE", account));
 }