Пример #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"));
            }

            string approvers = new LINQCalls().getMemoApproverNames(WorkflowID, RequestStageID);

            if (approvers == null || approvers == "")
            {
                errorResult = string.Format(errorResult, null, "No approvers found for the entry");
                return(Content(errorResult, "application/json"));
            }
            else
            {
                //20090022$ESOGBUE IKECHUKWU P$14$205$SEA|20110326$KALU NNANNA I$15$248$EA
                List <SignerDetails> signerDetails = new List <SignerDetails>();
                SignerDetails        _signerDetails;
                string[]             approvers_ = approvers.Split('|');
                foreach (string str in approvers_)
                {
                    _signerDetails = new SignerDetails();
                    string[] appr_ = str.Split('$');

                    _signerDetails.ApproverStaffNumber = appr_[0];
                    _signerDetails.ApproverStaffName   = appr_[1];
                    _signerDetails.GradeID             = Int32.Parse(appr_[2]);
                    _signerDetails.PayGroup_ID         = Int32.Parse(appr_[3]);
                    _signerDetails.ApproverGrade       = appr_[4];
                    signerDetails.Add(_signerDetails);
                }

                return(Json(signerDetails.ToArray(), JsonRequestBehavior.AllowGet));
            }
        }