Esempio n. 1
0
        private bool AddSignatory(MemoSetup memoSetup)
        {
            bool   flag = true;
            string ApproverStaffName   = memoSetup.SignerDetails.ApproverStaffName;
            string ApproverStaffNumber = memoSetup.SignerDetails.ApproverStaffNumber;
            string ApproverGrade       = memoSetup.SignerDetails.ApproverGrade;
            string ApproverDept        = memoSetup.SignerDetails.ApproverDept;
            int?   GradeID             = memoSetup.SignerDetails.GradeID;
            int?   PayGroup_ID         = memoSetup.SignerDetails.PayGroup_ID;

            /**Check for null values**/
            if (String.IsNullOrEmpty(ApproverStaffName) || String.IsNullOrEmpty(ApproverStaffNumber) ||
                String.IsNullOrEmpty(ApproverGrade) || String.IsNullOrEmpty(ApproverDept) || GradeID == null ||
                PayGroup_ID == null)
            {
                TempData["ErrorMessage"] = "Please select a valid staff";
                flag = false;
            }
            else
            {
                /**Check if the staff already exists in the list**/
                if (memoSetup.SignerDetailsList != null && memoSetup.SignerDetailsList.Count > 0)
                {
                    bool dupStaff = memoSetup.SignerDetailsList.Exists(x => x.ApproverStaffNumber.ToUpper().Contains(ApproverStaffNumber));
                    if (dupStaff)
                    {
                        TempData["ErrorMessage"] = "Staff already exists in the list";
                        flag = false;
                    }
                }

                try {
                    SignerDetails signerDetails = new SignerDetails();
                    signerDetails.ApproverStaffName   = ApproverStaffName;
                    signerDetails.ApproverStaffNumber = ApproverStaffNumber;
                    signerDetails.ApproverGrade       = ApproverGrade;
                    signerDetails.ApproverDept        = ApproverDept;
                    signerDetails.GradeID             = GradeID;
                    signerDetails.PayGroup_ID         = PayGroup_ID;

                    TempData["newSignatory"] = signerDetails;
                } catch (Exception ex) {
                    TempData["ErrorMessage"] = ex.Message;
                    flag = false;
                }
            }
            return(flag);
        }
Esempio n. 2
0
        public List <SignerDetails> GetApprovers(string snos)
        {
            List <SignerDetails> signerDetails = new List <SignerDetails>();
            SignerDetails        _signerDetails;

            string[] approvers_ = snos.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.ApproverDept        = appr_[5];
                signerDetails.Add(_signerDetails);
            }

            return(signerDetails);
        }
Esempio n. 3
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));
            }
        }