Beispiel #1
0
 public void Reject(StateApprovalModel model, string username)
 {
     try
     {
         _unitOfWork.BeginTransaction();
         var user = Mapper.Map<UserProfile, UserProfileItem>(_userProfileRepository.GetPersonalInformationByUserName(username));
         var processRefId = UtilityService.GetStateRefId(model.StateId);
         _approvalService.RejectProcess(user.Id, processRefId, user.WorkFlowRefId, model.Comment);
         _unitOfWork.Commit();
     }
     catch (Exception)
     {
         _unitOfWork.Rollback();
         throw;
     }
 }
Beispiel #2
0
 private string Approve(StateApprovalModel model, string approvedBy, string processRefId, State entity = null)
 {
     var user = _userProfileService.GetUserProfile(approvedBy);
     if (_approvalService.ApproveProcess(user.Id, processRefId, user.WorkFlowRefId, model.Comment) ==
         null)
      return   Approve(model.StateId, approvedBy);
     return null;
 }
Beispiel #3
0
 public IHttpActionResult RejectState(StateApprovalModel model)
 {
     try
     {
         _stateService.Reject(model, User.Identity.Name);
         return Ok();
     }
     catch (Exception)
     {
         return BadRequest();
     }
 }
Beispiel #4
0
 public string Approve(StateApprovalModel model, string username)
 {
     try
     {
         _unitOfWork.BeginTransaction();
         var entity = _repository.Find(model.StateId);
         if (entity.IsApproved)
             throw new EdLightException("Approval process has been competed!");
         var processRefId = UtilityService.GetStateRefId(model.StateId);
      var returnValue=   Approve(model, username, processRefId, entity);
         _unitOfWork.Commit();
         return returnValue;
     }
     catch (Exception)
     {
         _unitOfWork.Rollback();
         throw;
     }
 }
Beispiel #5
0
 public async Task<IHttpActionResult> ApproveState(StateApprovalModel model)
 {
     try
     {
        var username= _stateService.Approve(model, User.Identity.Name);
         if (!string.IsNullOrWhiteSpace(username))
         {
             var roles = new List<string> {RolesConstants.StateAdmin};
             var result = await CreateApplicationUser(username, roles);
         }
         return Ok();
     }
     catch (EdLightException ex)
     {
         return BadRequest(ex.Message);
     }
     catch (Exception)
     {
         return BadRequest();
     }
 }