public IHttpActionResult CreateNewUser(User user) { try { this.RegisterWrapper.CreateNewUser(user); return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = string.Format("{0}, {1}", mex.Message, mex.StackTrace) })); } catch (WrapperException wex) { // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = string.Format("{0}, {1}", wex.InnerException.Message, wex.InnerException.StackTrace) })); } catch (System.Exception) { // Throw the exception throw ExceptionResponse.ThrowException("Error creating new user", ERROR_REGISTER_USER); } }
public IHttpActionResult ValidateNewUser([FromBody] string token) { try { // Subscript user this.RegisterWrapper.ValidateUser(token); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception) { // Throw the exception throw ExceptionResponse.ThrowException("Error validation new user", ERROR_VALIDATE_USER); } }
public IHttpActionResult ResetPassword(ResetPasswordPrm resetPasswordPrm) { try { // Subscript user this.RegisterWrapper.ResetPassword(resetPasswordPrm.Token, resetPasswordPrm.Password); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception) { // Throw the exception throw ExceptionResponse.ThrowException("Error on password reset", ERROR_RESET_PASSWORD); } }
public async Task <IHttpActionResult> UploadProfilePicture() { // Check if the request contains multipart/form-data. if (!Request.Content.IsMimeMultipartContent()) { throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); } // Define the stream provider MultipartMemoryStreamProvider memoryStreamProvider = new MultipartMemoryStreamProvider(); try { Guid userDataId = this.GetUserDataId(); // Read the form data. await Request.Content.ReadAsMultipartAsync(memoryStreamProvider).ContinueWith(async(task) => { // Get Http Content HttpContent content = memoryStreamProvider.Contents[0]; // Get the stream Stream stream = await content.ReadAsStreamAsync(); // Save the file this.UserWrapper.UploadProfilePicture(userDataId, stream); }); // Return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error uploading profile picture", ERROR_UPLOADING_PROFILE_PICTURE); } }
public IEnumerable <Invitation> GetCurrent() { try { return(this.IInvitationMgr.GetByEmail(this.GetUserDataEmail())); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting invitations", ERROR_IN_GET_INVITATION); } }
public IEnumerable <Event> GetCurrent() { try { return(this.IEventMgr.GetByUser(this.GetUserDataId())); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting Event", ERROR_IN_GET_EVENT); } }
public Transport GetById(Guid transportId) { try { return(this.ITransportMgr.GetById(transportId)); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting transport", ERROR_IN_GET_TRANSPORT); } }
public IEnumerable <Passenger> GetByEventGroupId(Guid transportId) { try { return(this.IPassengerMgr.GetByTransportId(transportId)); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting Passenger", ERROR_IN_GET_PASSENGER); } }
public IEnumerable <Transport> GetByEventId(Guid eventId, bool travelSense) { try { return(this.ITransportMgr.GetByEventId(eventId, travelSense)); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting transport", ERROR_IN_GET_TRANSPORT); } }
public Passenger GetByUserIdEventIdSense(Guid userId, Guid eventId, bool travelSense) { try { return(this.IPassengerMgr.GetByUserIdEventIdSense(userId, eventId, travelSense)); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting Passenger", ERROR_IN_GET_PASSENGER); } }
public IEnumerable <Assistant> GetByEventId(Guid eventId) { try { return(this.IAssistantMgr.GetByEventId(eventId)); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting Assistant", ERROR_IN_GET_ASSISTANT); } }
public EventGroup GetById(Guid eventGroupId) { try { return(this.IEventGroupMgr.GetById(eventGroupId)); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting EventGroup", ERROR_IN_GET_EVENT_GROUP); } }
public User GetCurrentUser() { try { return(this.IUserMgr.GetById(this.GetUserDataId())); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register("CRM Server", this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting current user", ERROR_IN_GET_CURRENT_USER); } }
public IEnumerable <MenuItemView> GetUserMenu() { try { return(this.MenuItemWrapper.GetUserMenu(this.GetUserDataEmail())); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register("Auth Server", this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting MenuItem", ERROR_IN_GET); } }
public IEnumerable <UserDepartment> GetByIds(Guid userId, Guid eventId) { try { return(this.IUserDepartmentMgr.GetByUserIdEventId(userId, eventId)); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting User Department", ERROR_IN_GET_USERDEPARTMENT); } }
public Address GetById(Guid eventId) { try { return(this.IAddressMgr.GetByEventId(eventId)); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error getting Address", ERROR_IN_GET_ADDRESS); } }
public IHttpActionResult Update(User user) { try { // Assign id user.UserId = this.GetUserDataId(); // Update user this.IUserMgr.Update(user); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error updating user", ERROR_UPDATING_USER); } }
public IHttpActionResult Accept([FromUri] Guid invitationId) { try { // Update user this.InvitationWrapper.Accept(invitationId, this.GetUserDataId()); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error accepting invitation", ERROR_ACCEPTING_INVITATION); } }
public IHttpActionResult UpdatePassword([FromBody] string password) { try { // Update password this.UserWrapper.ChangePassword(this.GetUserDataId(), password); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error updating user password", ERROR_UPDATING_USER_PASSWORD); } }
public IHttpActionResult DownloadProfilePicture() { try { // User data id Guid userDataId = this.GetUserDataId(); // Return the response return(Ok(new GeneralResponse() { Error = false, Message = this.UserWrapper.DownloadProfilePhoto(userDataId) })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error downloading profile picture", ERROR_DOWNLOADING_PROFILE_PICTURE); } }
public IHttpActionResult Import(InvitationImportPrm invitationImportPrm) { try { // Update user this.InvitationWrapper.Import(invitationImportPrm.CollectionEmail, invitationImportPrm.EventId); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error accepting invitation", ERROR_REJECTING_INVITATION); } }
public IHttpActionResult Save(Car car) { try { car.UserId = this.GetUserDataId(); this.ICarMgr.Save(car); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error creating car", ERROR_CREATING_CAR); } }
public IHttpActionResult Update(Assistant assistant) { try { this.AssistantWrapper.UpdateOwner(assistant); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error updating assistant", ERROR_UPDATING_ASSISTANT); } }
public IHttpActionResult Create(Passenger passenger) { try { this.PassengerWrapper.Create(passenger, this.GetUserDataEmail(), this.GetUsername(), this.GetLastname()); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error creating passenger", ERROR_CREATING_PASSENGER); } }
public IHttpActionResult Create(Transport transport) { try { this.TransportWrapper.Create(transport, this.GetUserDataId()); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error creating transport", ERROR_CREATING_TRANSPORT); } }
public IHttpActionResult Deactivate([FromBody] Guid carId) { try { this.CarWrapper.Deactivate(carId, this.GetUserDataId()); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error deactivating car", ERROR_DEACTIVATING_CAR); } }
public IHttpActionResult Create(UserDepartmentCreatePrm userDepartmentCreatePrm) { try { this.UserDepartmentWrapper.Create(userDepartmentCreatePrm); // return the response return(Ok(new GeneralResponse() { Error = false, Message = "" })); } catch (ManagerException mex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, mex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = mex.Message })); } catch (WrapperException wex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_WARNING, wex); // Throw the exception return(Ok(new GeneralResponse() { Error = true, Message = wex.Message })); } catch (System.Exception ex) { // Save entry in log this.SystemLogWrapper.Register(SERVER, this.GetUserDataId(), SystemLogWrapper.TYPE_ERROR, ex); // Throw the exception throw ExceptionResponse.ThrowException("Error creating user department", ERROR_CREATING_USER_DEPARTMENT); } }