コード例 #1
0
        // Given a PWAmodel, return bool reflecting if
        // the form was edited as all.
        public static bool wasPWAedited(PWAsubmission submission)
        {
            // Keys that could be edited
            var keyList = new List <string>();

            keyList.Add("clientName");
            keyList.Add("prime");
            keyList.Add("submissionDate");
            keyList.Add("providerName");
            keyList.Add("providerNum");
            keyList.Add("serviceAuthorized");
            keyList.Add("serviceGoal");
            keyList.Add("progressNotes");
            keyList.Add("employerSignDate");
            keyList.Add("employerSignature");
            keyList.Add("providerSignDate");
            keyList.Add("providerSignature");
            keyList.Add("authorization");
            keyList.Add("approval");
            keyList.Add("scpaName");
            keyList.Add("brokerage");
            keyList.Add("totalHours");
            keyList.Add("totalMiles");

            // Convert submission to JSON object
            string  jsonString = JsonConvert.SerializeObject(submission);
            JObject obj        = JObject.Parse(jsonString);

            // Iterate over obj with keys
            for (int i = 0; i < keyList.Count; i++)
            {
                // Exit early on first instance of true
                try
                {
                    string s = keyList[i];
                    bool   x = (bool)obj[s]["wasEdited"];
                    if (x == true)
                    {
                        return(true);
                    }
                }
                catch (Exception)
                {
                    continue;
                }
            }

            // Default case
            return(false);
        }
コード例 #2
0
        public IActionResult Submit(int id)
        {
            var stage = _context.Stagings.FirstOrDefault(m => m.Id == id);

            if (stage == null)
            {
                return(Json(new JsonResponse("not ready")));
            }
            var textractform = new TextractDocument.TextractDocument();

            foreach (var a in JArray.Parse(stage.ParsedTextractJSON))
            {
                var childform = new TextractDocument.TextractDocument();
                childform.FromJson(a);
                textractform.AddPages(childform);
            }
            var ts = AbstractFormObject.FromTextract(textractform, stage.formType);

            ts.id = id;

            var PWAForm = PWAsubmission.FromForm(ts, stage.formType);

            switch (stage.formType)
            {
            case AbstractFormObject.FormType.OR507_RELIEF:
                return(SubmitTimesheet((PWATimesheet)PWAForm));

            case AbstractFormObject.FormType.OR004_MILEAGE:
                return(SubmitMileage((PWAMileage)PWAForm));

            default:
                return(Json(new
                {
                    response = "invalid"
                }
                            ));
            }
        }