Beispiel #1
0
        public ActionResult GetApprovers(string WorkflowID, int RequestStageID)
        {
            string errorResult = "{{\"employee_number\":\"{0}\",\"name\":\"{1}\"}}";

            if (string.IsNullOrEmpty(WorkflowID))
            {
                errorResult = string.Format(errorResult, "Error", "Invalid entry detected");
                return(Content(errorResult, "application/json"));
            }

            var profile = (RequestStageID == 20) ? LINQCalls.getHRApproverNames(WorkflowID, RequestStageID):LINQCalls.getApproverNumbersToNames(WorkflowID, RequestStageID);

            if (profile == null || profile.Count() <= 0)
            {
                errorResult = string.Format(errorResult, null, "No approvers found for the entry");
                return(Content(errorResult, "application/json"));
            }
            else
            {
                return(Json(profile, JsonRequestBehavior.AllowGet));
            }
        }