public string ApproveELoanRequestbyLoanId(string loanid, string Comment)
 {
     if (Request.Cookies["user"] != null && Request.Cookies["compid"] != null)
     {
         try
         {
             ESSWebService.CallContext callcont = new ESSWebService.CallContext();
             var compid   = Request.Cookies["compid"].Value;
             var username = Convert.ToInt64(Request.Cookies["user"].Value);
             ESSWebService.SDSLoanRequestServicesClient sdloanreq = new ESSWebService.SDSLoanRequestServicesClient();
             sdloanreq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
             sdloanreq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
             ESSWebService.LoanRequest _crloanreq = new ESSWebService.LoanRequest();
             _crloanreq = sdloanreq.getPendingWorkflowList(callcont, username).parmLoanRequestList.Where(x => x.LoanRequestId == loanid).FirstOrDefault();
             return(sdloanreq.Approve(callcont, _crloanreq.WorkflowItem, username, compid));
         }
         catch (Exception ex)
         {
             throw;
         }
     }
     else
     {
         RedirectToAction("Login", "Account");
         return("");
         // return _perinfo;
     }
 }
        public ActionResult SubmittedLoanRequest()
        {
            if (Request.Cookies["user"] != null && Request.Cookies["compid"] != null)
            {
                ESSWebService.CallContext callcont = new ESSWebService.CallContext();
                var compid   = Request.Cookies["compid"].Value;
                var username = Convert.ToInt64(Request.Cookies["user"].Value);
                ESSWebService.SDSLoanRequestServicesClient sdloanreq = new ESSWebService.SDSLoanRequestServicesClient();
                sdloanreq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
                sdloanreq.ClientCredentials.Windows.ClientCredential        = new NetworkCredential("webapp", "pass" + '"' + "word123");
                //sd.getPendingWorkflowList()
                // sd.Approve()
                //  sd.getAllleaveRequestList(callcont, username, compid).

                var ss = (from a in sdloanreq.getPendingWorkflowList(callcont, username).parmLoanRequestList
                          select new DTOLoans
                {
                    LoanRequestId = a.LoanRequestId,
                    LoanType = a.Loantype.ToString(),
                    LoanRequested = a.Loanvalue.ToString(),
                    MonthlyInstallment = a.MonthlyInstallment.ToString(),
                    NoofInstallment = a.NoOfInsatllment.ToString(),
                    Date = a.RequestDate.ToShortDateString(),
                    PersonalNumber = a.NameEn.Split('-')[0],
                    ReasonCode = a.ReasonCode,
                    Name = a.NameEn.Split('-')[1],
                    State = a.Workflowstatus.ToString(),
                    URL = "/Loan/ViewLoanbyRequestId?loanreqid=" + a.LoanRequestId,
                }).ToList();

                return(View(ss.OrderByDescending(x => x.LoanRequestId).ToList()));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
                // return _perinfo;
            }
        }