public string CreateLoanRequest(string reason,
                                 string loantype, string comment,
                                 string loanamount, string noofinstallment,
                                 string deductionistartdate)
 {
     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 sdsloanreq = new ESSWebService.SDSLoanRequestServicesClient();
         sdsloanreq.ClientCredentials.Windows.ClientCredential.Domain = "Soletechs";
         ESSWebService.LoanRequest _creloanreq = new ESSWebService.LoanRequest();
         sdsloanreq.ClientCredentials.Windows.ClientCredential = new NetworkCredential("webapp", "pass" + '"' + "word123");
         _creloanreq.Comments           = comment;
         _creloanreq.RequestDate        = DateTime.Now;
         _creloanreq.WorkerRecid        = username;
         _creloanreq.Loantype           = loantype == "-1" ? null : loantype;
         _creloanreq.Loanvalue          = Convert.ToDecimal(loanamount);
         _creloanreq.NoOfInsatllment    = Convert.ToInt32(noofinstallment);
         _creloanreq.MonthlyInstallment = Convert.ToDecimal(loanamount) / Convert.ToInt32(noofinstallment);
         _creloanreq.DeductionStartDate = new DateTime(Convert.ToInt32(deductionistartdate.Split('/')[2]), Convert.ToInt32(deductionistartdate.Split('/')[1]), Convert.ToInt32(deductionistartdate.Split('/')[0]));
         _creloanreq.ReasonCode         = reason == "-1" ? null : reason;
         string g = sdsloanreq.createLoanRequest(callcont, _creloanreq, compid);
         return(g);
     }
     else
     {
         RedirectToAction("Login", "Account");
         return("");
     }
 }
 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;
     }
 }