public string Post(ApiModel model)
        {
            var result = new JObject();

            result["status"] = false;

            var client = ClientList.Find(model.Token);

            if (client != null)
            {
                var obj = new JObject();
                obj["message"] = "completed";
                obj["token"]   = model.AccessToken;

                string message = JsonConvert.SerializeObject(obj);

                client.Socket.Send(message);

                ClientList.Delete(client.Id);

                result["status"] = true;
            }

            return(JsonConvert.SerializeObject(result));
        }
示例#2
0
 private void Send()
 {
     if (SendMessageContent.Length > 0)
     {
         var query = ClientList.Find(p => p.LocalEndPoint.ToString() == SelectedClientConnectInfo.LocalEndPoint);
         query.Send(Encoding.Default.GetBytes(SendMessageContent));
     }
 }
示例#3
0
文件: Sber.cs 项目: AlfaRedDog/oop
 public void SpendMoney(Guid Id, ClientC person, double money)
 {
     if (((ClientList.Find(pers => pers == person).TakeAdress() == "") || (ClientList.Find(pers => pers == person).TakePassport() == -1)) && (money > MutnyTipLimit))
     {
         throw new MutnyTipException();
     }
     ClientList[ClientList.FindIndex(pers => pers == person)].AllAccounts.Find(acc => acc.GetID() == Id).SpendMoney(money);
 }
示例#4
0
文件: Sber.cs 项目: AlfaRedDog/oop
 public void TransferMoney(Guid Id1, Guid Id2, ClientC person1, ClientC person2, double money)
 {
     if (((ClientList.Find(pers => pers == person1).TakeAdress() == "") || (ClientList.Find(pers => pers == person1).TakePassport() == -1)) && (money > MutnyTipLimit))
     {
         throw new MutnyTipException();
     }
     ClientList[ClientList.FindIndex(pers => pers == person1)].AllAccounts.Find(acc => acc.GetID() == Id1).TransferMoney(money, person2.AllAccounts.Find(acc => acc.GetID() == Id2));
     TransactionList.Add(new CTransaction(money, person1, person2, Id1, Id2));
 }
示例#5
0
文件: Sber.cs 项目: AlfaRedDog/oop
        public void AddClient(ClientC person)
        {
            var CheckPerson = ClientList.Find(pers => pers == person);

            if (CheckPerson != null)
            {
                throw new CheckPersonException();
            }
            ClientList.Add(person);
        }