/// <summary> /// Executes the NewSession business operation. /// </summary> public async virtual Task<NewSessionBusinessResponse> NewSession(IDatabaseConnection databaseConnection, NewSessionBusinessRequest businessRequest) { // Validate the business request. this.ValidateNewSessionRequest(businessRequest); // Initialize the operation data. NewSessionOperationData operationData = new NewSessionOperationData(); // Validate the business operation. await this.ValidateNewSessionOperation(databaseConnection, businessRequest, operationData); // Generate a unique Session code. string sessionCode = this.uniqueTokenGenerator.GenerateUniqueToken(); // Create the Session data row. operationData.SessionDataRow = new SessionDataRow(); operationData.SessionDataRow.SessionCode = sessionCode; operationData.SessionDataRow.Name = businessRequest.Session.Name; operationData.SessionDataRow.StartDate = businessRequest.Session.StartDate; await this.sessionDataAccessComponent.Create(databaseConnection, operationData.SessionDataRow); // Build the business response. NewSessionBusinessResponse businessResponse = new NewSessionBusinessResponse(); // Build the Session business response element. NewSessionBusinessResponse.SessionBusinessResponseElement sessionBusinessResponseElement = new NewSessionBusinessResponse.SessionBusinessResponseElement(); sessionBusinessResponseElement.SessionCode = operationData.SessionDataRow.SessionCode; businessResponse.Session = sessionBusinessResponseElement; // Return the business response. return businessResponse; }
/// <summary> /// Executes the NewSession business operation. /// </summary> public async virtual Task <NewSessionBusinessResponse> NewSession(IDatabaseConnection databaseConnection, NewSessionBusinessRequest businessRequest) { // Validate the business request. this.ValidateNewSessionRequest(businessRequest); // Initialize the operation data. NewSessionOperationData operationData = new NewSessionOperationData(); // Validate the business operation. await this.ValidateNewSessionOperation(databaseConnection, businessRequest, operationData); // Generate a unique Session code. string sessionCode = this.uniqueTokenGenerator.GenerateUniqueToken(); // Create the Session data row. operationData.SessionDataRow = new SessionDataRow(); operationData.SessionDataRow.SessionCode = sessionCode; operationData.SessionDataRow.Name = businessRequest.Session.Name; operationData.SessionDataRow.StartDate = businessRequest.Session.StartDate; await this.sessionDataAccessComponent.Create(databaseConnection, operationData.SessionDataRow); // Build the business response. NewSessionBusinessResponse businessResponse = new NewSessionBusinessResponse(); // Build the Session business response element. NewSessionBusinessResponse.SessionBusinessResponseElement sessionBusinessResponseElement = new NewSessionBusinessResponse.SessionBusinessResponseElement(); sessionBusinessResponseElement.SessionCode = operationData.SessionDataRow.SessionCode; businessResponse.Session = sessionBusinessResponseElement; // Return the business response. return(businessResponse); }
/// <summary> /// Validates the NewSession business operation. /// </summary> private Task ValidateNewSessionOperation(IDatabaseConnection databaseConnection, NewSessionBusinessRequest businessRequest, NewSessionOperationData operationData) { return Task.FromResult<object>(null); }
/// <summary> /// Validates the NewSession business operation. /// </summary> private Task ValidateNewSessionOperation(IDatabaseConnection databaseConnection, NewSessionBusinessRequest businessRequest, NewSessionOperationData operationData) { return(Task.FromResult <object>(null)); }