public void ClientEvents_ReadPhotoLink(object sender, SocketEventArgs e) { using (FileStream fs = new FileStream(e.Command.Data + "_" + e.Command.FilePath, FileMode.Open)) { byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, (int)fs.Length); Command command = new Command(Command.Commands.ReadPhotoLink, string.Empty); command.File = buffer; command.FilePath = e.Command.FilePath; jsonProtocol.SendObject(command, (sender as ClientThread).Socket); } }
private void ClientEvents_SendFile(object sender, SocketEventArgs e) { dao.SaveFile(int.Parse(e.Command.Data), e.Command.File); }
private void ClientEvents_UpdateRecord(object sender, SocketEventArgs e) { Table table = new Table(); table.TypesList = e.Command.TypesList; table.ValuesList = e.Command.ValuesList; dao.UpdatePerson(table); }
private void ClientEvents_ReadFile(object sender, SocketEventArgs e) { byte[] file = dao.GetFile(int.Parse(e.Command.Data)); Command command = new Command(Command.Commands.ReadFile, string.Empty); command.File = file; command.FilePath = e.Command.FilePath; jsonProtocol.SendObject(command, (sender as ClientThread).Socket); }
void ClientEvents_ReadPhoto(object sender, SocketEventArgs e) { byte[] photo = dao.GetPhoto(int.Parse(e.Command.Data)); Command command = new Command(Command.Commands.ReadPhoto, string.Empty); command.File = photo; command.FilePath = e.Command.FilePath; jsonProtocol.SendObject(command, (sender as ClientThread).Socket); }
private void ClientEvents_Photo(object sender, SocketEventArgs e) { dao.AddPhoto(e.Command.File, int.Parse(e.Command.Data)); }
private void ClientEvents_PhotoLink(object sender, SocketEventArgs e) { using (FileStream fs = new FileStream(e.Command.Data + "_" + e.Command.FilePath, FileMode.Create)) { int bufferSize = int.Parse(Resources.Buffer); int position = 0; while (position < e.Command.File.Length) { fs.Write(e.Command.File, position, bufferSize); position += bufferSize; } fs.Write(e.Command.File, position - bufferSize, e.Command.File.Length - position); } dao.SetPhotoLinkName(e.Command.FilePath, int.Parse(e.Command.Data)); }
private void ClientEvents_FullData(object sender, SocketEventArgs e) { Table table = dao.GetQuery(e.Command.Data); Command command = new Command(Command.Commands.FullData, string.Empty); command.TypesList = table.TypesList; command.ValuesList = table.ValuesList; command.ColumnsList = table.ColumnsList; jsonProtocol.SendObject(command, (sender as ClientThread).Socket); }
private void ClientEvents_Exit(object sender, SocketEventArgs e) { ClientThread clientThread = sender as ClientThread; clientThread.Stop(); Command command = new Command(Command.Commands.Confirm, string.Empty); jsonProtocol.SendObject(command, clientThread.Socket); }
private void ClientEvents_DeleteRecord(object sender, SocketEventArgs e) { dao.DeletePerson(e.Command.Data); }
private void ClientEvents_AddRecord(object sender, SocketEventArgs e) { Table table = new Table(); dao.AddPerson(e.Command.ValuesList); }
private void ClientEvents_UpdateRecord(object sender, SocketEventArgs e) { Table table = new Table(); table.TypesList = e.Command.TypesList; table.ValuesList = e.Command.ValuesList; dao.UpdatePerson(int.Parse(e.Command.ValuesList.First().First().ToString()), e.Command.ValuesList.First()); }