/// <summary> /// This is going to be commented out because it becomes unusably slow after a few hundred thousand unique sessions /// are created. Use the getSessions(int howMany) function instead to retrieve the latest howMany number of sessions /// </summary> /// <returns></returns> //public ApplicationSessionsTO getAllSessions() //{ // ApplicationSessionsTO result = new ApplicationSessionsTO(); // SqlConnection conn = new SqlConnection(); // SqlTransaction tx = null; // try // { // conn = getConnection(); // tx = conn.BeginTransaction(); // SqlDataAdapter adapter = buildSelectSessionsAdapter(conn, tx); // DataSet sessionData = new DataSet(); // int sessionCount = adapter.Fill(sessionData); // adapter = buildSelectSessionRequestsAdapter(conn, tx); // DataSet requestsData = new DataSet(); // int requestsCount = adapter.Fill(requestsData); // tx.Commit(); // Dictionary<string, ApplicationSession> sessions = getApplicationSessions(sessionData); // Stack<ApplicationRequest> requests = getApplicationRequests(requestsData); // return new ApplicationSessionsTO(addRequestsToSessions(sessions, requests)); // } // catch (Exception exc) // { // if (tx != null) // { // tx.Rollback(); // } // result.fault = new FaultTO(exc); // return null; // } // finally // { // conn.Close(); // if (tx != null) // { // tx.Dispose(); // } // } //} SqlDataAdapter buildInsertRequestAdapter(ApplicationRequest request, SqlConnection conn, SqlTransaction tx) { SqlDataAdapter adapter = new SqlDataAdapter(); adapter.InsertCommand = new SqlCommand(); adapter.InsertCommand.Connection = conn; adapter.InsertCommand.Transaction = tx; adapter.InsertCommand.CommandText = "INSERT INTO dbo.MdwsSessionRequests " + "([ASP.NET_SessionId], URI, RequestTimestamp, ResponseTimestamp, RequestBody, ResponseBody) VALUES ('" + request.AspNetSessionId + "', '" + request.Uri.LocalPath + "', " + "@requestTimestamp, @responseTimestamp, @RequestBody, @ResponseBody);"; SqlParameter requestTimestampParam = new SqlParameter("@requestTimestamp", SqlDbType.DateTime); requestTimestampParam.Value = request.RequestTimestamp; SqlParameter responseTimestampParam = new SqlParameter("@responseTimestamp", SqlDbType.DateTime); responseTimestampParam.Value = request.ResponseTimestamp; SqlParameter reqestBodyParam = new SqlParameter("@RequestBody", SqlDbType.Text); reqestBodyParam.Value = String.IsNullOrEmpty(request.RequestBody) ? (object)DBNull.Value : (object)request.RequestBody; SqlParameter responseBodyParam = new SqlParameter("@ResponseBody", SqlDbType.Text); responseBodyParam.Value = String.IsNullOrEmpty(request.ResponseBody) ? (object)DBNull.Value : (object)request.ResponseBody; adapter.InsertCommand.Parameters.Add(requestTimestampParam); adapter.InsertCommand.Parameters.Add(responseTimestampParam); adapter.InsertCommand.Parameters.Add(reqestBodyParam); adapter.InsertCommand.Parameters.Add(responseBodyParam); return adapter; }
public bool can_handle(ApplicationRequest request) { throw new NotImplementedException(); }
/// <summary> /// Using the configured SQL connection string, opens a connection to the database and attempts /// to wrtie a record from the ApplicationSessions table /// </summary> /// <returns>BoolTO with true value if read was successful, FaultTO otherwise</returns> public BoolTO canWrite() { UsageDao dao = new UsageDao(_connectionString); string sessionId = gov.va.medora.utils.StringUtils.getNCharRandom(24); ApplicationSession session = new ApplicationSession(sessionId, System.Net.IPAddress.Loopback.ToString(), DateTime.Now); session.End = DateTime.Now; session.LocalhostName = System.Net.IPAddress.Loopback.ToString(); ApplicationRequest request = new ApplicationRequest(sessionId, new Uri("http://mdws.va.gov/getSomething"), DateTime.Now, DateTime.Now, "<Soap>...</Soap>", "<Soap>...</Soap>"); session.Requests.Add(request); dao.saveSession(session); return dao.deleteSession(sessionId); }
public ApplicationRequestCommand find_command_that_can_process(ApplicationRequest request) { return all_commands.FirstOrDefault(command => command.can_handle(request)) ?? new MissingCommand(); }
public void process(ApplicationRequest request) { throw new NotImplementedException(); }
public void process(ApplicationRequest request) { response_engine.display(catalog_tasks.get_sub_departments_for(request.map<DepartmentItem>())); }
/// <summary> /// This Events is triggered every time one session share a response. /// Requiere ResponseMode = Share /// </summary> /// <param name="sender"></param> /// <param name="response"></param> /// <param name="req"></param> public override void OnNewShareResponse(ApplicationInstanceBase sender, ApplicationResponse response, ApplicationRequest req) { }
public void process(ApplicationRequest request) { HttpContext.Current.Response.Write("Hello"); }
public void process(ApplicationRequest request) { response_engine.display(catalog_tasks.get_all_main_departments()); }
public HttpResponse(byte[] response,ApplicationRequest request) : base(request) { this.ResponseData = response; }
public void process(ApplicationRequest request) { application_command.process(request); }
public bool can_handle(ApplicationRequest request) { return request_specification.is_satisfied_by(request); }
/// <inheritdoc/> public ClientResponse <ApplicationResponse> UpdateApplication(Guid?applicationId, ApplicationRequest request) { return(client.UpdateApplicationAsync(applicationId, request).GetAwaiter().GetResult()); }
public async Task <TResponse> SendRequest <TEntity, TResponse>(ApplicationRequest <TEntity, TResponse> request, CancellationToken cancellationToken = default(CancellationToken)) where TEntity : class where TResponse : ApplicationResponse <TEntity> { return(await Mediator.Send(request, cancellationToken)); }