Exemple #1
0
 public void Reject(LgaApprovalModel model, string username)
 {
     try
     {
         _unitOfWork.BeginTransaction();
         var user = Mapper.Map<UserProfile, UserProfileItem>(_userProfileRepository.GetPersonalInformationByUserName(username));
         var processRefId = UtilityService.GetLgaRefId((int) model.LgaId);
         _approvalService.RejectProcess(user.Id, processRefId, user.WorkFlowRefId, model.Comment);
         _unitOfWork.Commit();
     }
     catch (Exception)
     {
         _unitOfWork.Rollback();
         throw;
     }
 }
Exemple #2
0
 private string Approve(LgaApprovalModel model, string approvedBy, string processRefId, Lga entity = null)
 {
      
     var user = _userProfileService.GetUserProfile(approvedBy);
     if (_approvalService.ApproveProcess(user.Id, processRefId, user.WorkFlowRefId, model.Comment) ==
         null)
         return Approve((int) model.LgaId, (int)model.StateId, approvedBy);
     return null;
 }
Exemple #3
0
 public IHttpActionResult RejectLga(LgaApprovalModel model)
 {
     try
     {
         _lgaService.Reject(model, User.Identity.Name);
         return Ok();
     }
     catch (Exception)
     {
         return BadRequest();
     }
 }
Exemple #4
0
 public string Approve(LgaApprovalModel model, string username)
 {
     try
     {
         _unitOfWork.BeginTransaction();
         var entity = _repository.Find(model.LgaId);
         if ((bool) entity.IsApproved)
             throw new EdLightException("Approval process has been competed!");
         var processRefId = UtilityService.GetLgaRefId((int) model.LgaId);
         var returnValue = Approve(model, username, processRefId, entity);
         _unitOfWork.Commit();
         return returnValue;
     }catch (Exception)
     {
         _unitOfWork.Rollback();
         throw;
     }
 }
Exemple #5
0
 public async Task<IHttpActionResult> ApproveLga(LgaApprovalModel model)
 {
     try
     {
         var username = _lgaService.Approve(model, User.Identity.Name);
         return Ok();
     }
     catch (EdLightException ex)
     {
         return BadRequest(ex.Message);
     }
     catch (Exception)
     {
         return BadRequest();
     }
 }