Ejemplo n.º 1
0
 public IActionResult ReturnChemicals([FromBody] ReturnChemicalParam param)
 {
     try
     {
         HttpWrapper.CallServiceByPost("/api/claim/return",
                                       JsonSerializer.Serialize(param));
         return(Ok());
     }
     catch (Exception e)
     {
         _logger.LogError(e.Message);
         return(NotFound(e.Message));
     }
 }
Ejemplo n.º 2
0
 public IActionResult RejectFinancial([FromBody] SolveFormParam param)
 {
     try
     {
         HttpWrapper.CallServiceByPost("/api/financial/reject",
                                       JsonSerializer.Serialize(param));
         return(Ok());
     }
     catch (Exception e)
     {
         _logger.LogError(e.Message);
         return(NotFound(e.Message));
     }
 }
Ejemplo n.º 3
0
 public IActionResult Destroy([FromBody] Chemical chemical)
 {
     _logger.LogInformation("destroy chemical id: {1}", chemical.ChemicalId);
     try
     {
         var response = HttpWrapper.CallServiceByPost("/api/entity/chemical/discard",
                                                      JsonSerializer.Serialize(chemical));
         return(Ok());
     }
     catch (Exception)
     {
         return(NotFound("try again"));
     }
 }
Ejemplo n.º 4
0
 public IActionResult Declear([FromBody] PostDeclarationFormParam param)
 {
     try
     {
         param.Form.SubmitTime = DateTime.Now;
         HttpWrapper.CallServiceByPost("/api/declaration/apply",
                                       JsonSerializer.Serialize(param));
         return(Ok());
     }
     catch (Exception e)
     {
         _logger.LogError(e.Message);
         return(NotFound(e.Message));
     }
 }
Ejemplo n.º 5
0
 public IActionResult Claim([FromBody] PostClaimFormParam param)
 {
     _logger.LogInformation("Post claim form. formid: {formid}", param.Form.Id);
     _logger.LogInformation("With {count} chemicals.", param.Chemicals.Count);
     try
     {
         param.Form.SubmitTime = DateTime.Now;
         HttpWrapper.CallServiceByPost("/api/claim/apply",
                                       JsonSerializer.Serialize(param));
         return(Ok());
     }
     catch (Exception e)
     {
         _logger.LogError(e.Message);
         return(NotFound(e.Message));
     }
 }
Ejemplo n.º 6
0
        public IActionResult ReadStatusChange([FromBody] NotifyUpdateParam param)
        {
            var certification = HttpContext.Request.Headers["certification"];

            if (UserRoleCache.TryGetUserRole(certification, out var userRole))
            {
                param.UserId = userRole.User.UserId;
                try
                {
                    var response = HttpWrapper.CallServiceByPost("/api/entity/notify",
                                                                 JsonSerializer.Serialize(param));
                    return(Ok());
                }
                catch (Exception)
                {
                    return(NotFound("try again"));
                }
            }
            return(Unauthorized());
        }
Ejemplo n.º 7
0
 public IActionResult RejectDeclear([FromBody] SolveFormParam param)
 {
     if (UserRoleCache.TryGetUserRole(HttpContext.Request.Headers["certification"], out UserRoleResult result))
     {
         if (!result.Roles.Exists(r => r.LabId == param.LabId))
         {
             return(Unauthorized());
         }
     }
     try
     {
         HttpWrapper.CallServiceByPost("/api/declaration/reject",
                                       JsonSerializer.Serialize(param));
         return(Ok());
     }
     catch (Exception e)
     {
         _logger.LogError(e.Message);
         return(NotFound(e.Message));
     }
 }