/// <summary> /// fetches all the agents /// </summary> /// <returns></returns> public LoginResponse GetAllAgents() { LoginResponse loginResponse = new LoginResponse(); var dbResponse = _userRepository.GetAllConditional(x => x.IsAssigned == true); if (dbResponse != null) { List <TicketsInfo> ticketsInfo = new List <TicketsInfo>(); foreach (var record in dbResponse) { TicketsInfo ticket = new TicketsInfo(); User user = new User() { Email = record.Email, Id = record.Id, UserType = record.UserType, AgentName = record.AgentName }; ticket.Users.Add(user); ticket.AgentId = record.AgentId; ticketsInfo.Add(ticket); } loginResponse.TicketSystemInfo = ticketsInfo; } return(loginResponse); }
public TicketsInfo SessionStart(TicketsInfo ticketsInfo) { try { using (var authentication = new SendReceive(new TcpClient(_host, _port))) { try { authentication.SendData(ticketsInfo); } catch (Exception ex) { authentication?.Dispose(); } ticketsInfo = (TicketsInfo)authentication.ReceiveData(); } } catch (SocketException ex) { } finally { } return(ticketsInfo); }
private IndexViewModel GetTickets() { TicketsInfo tickets = new TicketsInfo(); IndexViewModel indexViewModel = new IndexViewModel() { Authentication = HttpContext.Session.Get <Authentication>("Authentication"), TicketsInfo = ServerCommunication.client.SessionStart(tickets) }; return(indexViewModel); }