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)); }
private void Send() { if (SendMessageContent.Length > 0) { var query = ClientList.Find(p => p.LocalEndPoint.ToString() == SelectedClientConnectInfo.LocalEndPoint); query.Send(Encoding.Default.GetBytes(SendMessageContent)); } }
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); }
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)); }
public void AddClient(ClientC person) { var CheckPerson = ClientList.Find(pers => pers == person); if (CheckPerson != null) { throw new CheckPersonException(); } ClientList.Add(person); }