private string MakeMeTable(Command command) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<table><tr>"); for (int i = 0; i < command.ColumnsList.Count; i++) { stringBuilder.Append(string.Format("<th>{0}</th>", command.ColumnsList[i])); } stringBuilder.Append("</tr>"); for (int i = 0; i < command.ValuesList.Count; i++) { stringBuilder.Append("<tr>"); for (int j = 0; j < command.ColumnsList.Count; j++) { stringBuilder.Append(string.Format("<td>{0}</td>", command.ValuesList[i][j])); } stringBuilder.Append("</tr>"); } stringBuilder.Append("</table>"); return stringBuilder.ToString(); }
private void GetFullData() { Command command = new Command(Command.Commands.FullData, string.Empty); JsonProtocol protocol = new JsonProtocol(); protocol.SendObject(command, tcpClient); Command comresp = null; while (comresp == null) { comresp = protocol.ReadObject(tcpClient, typeof(Command)) as Command; } protocol.SendObject(new Command(Command.Commands.Exit, string.Empty), tcpClient); result = MakeMeTable(comresp); }
private void GetImage(int id) { Command command = new Command(Command.Commands.ReadPhoto, id.ToString()); JsonProtocol protocol = new JsonProtocol(); protocol.SendObject(command, tcpClient); Command respCom = null; while (respCom == null) { respCom = protocol.ReadObject(tcpClient, typeof(Command)) as Command; } string fileName = "tmp.jpg"; SaveFile(respCom.File, fileName); result = string.Format(@"<img src=""{0}"">", result); }