public IActionResult PostFinancialForm([FromBody] PostFinancialFormParam param)
        {
            var form = param.Form;

            form.State = FormState.InProcess;
            _context.FinancialForms.Add(form);
            // workflow state should be at securityOk
            // move to financial
            var workflow = _context.WorkFlows.Where(u => u.Id == param.Form.WorkFlowId).Single();

            workflow.State = util.StateRoute[workflow.State].Next[1];
            var role = _context.Roles
                       .Where(r => r.RoleName == util.StateRoute[workflow.State].RoleName)
                       .Single();
            // send message to role
            var msg = new NotificationMessage
            {
                FormId   = form.Id,
                FormType = FormType.DeclarationForm,
                IsSolved = false,
                RoleId   = role.RoleId
            };

            _context.NotificationMessages.Add(msg);
            _context.SaveChanges();
            return(Ok());
        }
Exemplo n.º 2
0
        public IActionResult PostFinancialForm([FromBody] PostFinancialFormParam param)
        {
            _logger.LogInformation("post financial form, user:{1}", param.Form.UserName);
            var form = param.Form;

            form.State = FormState.InProcess;
            _context.FinancialForms.Add(form);
            _context.SaveChanges();
            // workflow state should be at securityOk
            // move to financial
            var workflow = _context.WorkFlows.Where(u => u.Id == param.Form.WorkFlowId).Single();

            workflow.State = util.StateRoute[workflow.State].Next[1];
            _logger.LogInformation("rolename: {1}, labid: {2}", util.StateRoute[workflow.State].RoleName, param.Form.LabId);
            var role = _context.Roles
                       .Where(r => r.RoleName == util.StateRoute[workflow.State].RoleName && r.LabId == param.Form.LabId)
                       .Single();
            // send message to role
            var msg = new NotificationMessage
            {
                FormId   = form.Id,
                FormType = FormType.FinancialForm,
                IsSolved = false,
                RoleId   = role.RoleId
            };

            _context.NotificationMessages.Add(msg);
            _context.SaveChanges();
            return(Ok());
        }
Exemplo n.º 3
0
 public IActionResult Financial([FromBody] PostFinancialFormParam param)
 {
     try
     {
         param.Form.SubmitTime = DateTime.Now;
         HttpWrapper.CallServiceByPost("/api/financial/apply",
                                       JsonSerializer.Serialize(param));
         return(Ok());
     }
     catch (Exception e)
     {
         _logger.LogError(e.Message);
         return(NotFound(e.Message));
     }
 }