/// <summary> /// update Point file and move it to the closed loan/archived loan folder /// /// </summary> /// <param name="bComplete">true or false</param> /// <param name="sCompletedDate">if bComplete=true, sCompletedDate=DateTime.ToString() else string.Empty</param> /// <param name="iLoanID"></param> /// <param name="iLoginUserID"></param> /// <param name="sLoanStage"></param> /// <returns>error, if success, error=string.Empty</returns> public static string CloseLoan(int iLoanID, int iLoginUserID, int iFolderId) { string sError = string.Empty; try { ServiceManager sm = new ServiceManager(); using (LP2ServiceClient client = sm.StartServiceClient()) { DisposeLoanRequest req = new DisposeLoanRequest(); req.FileId = iLoanID; req.LoanStatus = "Closed"; req.NewFolderId = iFolderId; req.hdr = new ReqHdr(); req.hdr.UserId = iLoginUserID; req.StatusDate = DateTime.Now; DisposeLoanResponse response = client.DisposeLoan(req); if (response.hdr.Successful) { return("Moved the Point file to the selected folder successfully."); } else { return("Failed to move the Point file to the selected folder, reason:" + response.hdr.StatusInfo); } } } catch (System.ServiceModel.EndpointNotFoundException ee) { return("Failed to move the Point file, reason: Point Manager is not running."); } catch (Exception ex) { return("Failed to move the Point file, reason:" + ex.Message); } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDispose_Click(object sender, EventArgs e) { int nFileId = -1; if (!int.TryParse(this.hiSelectedLoan.Value, out nFileId)) { nFileId = -1; } if (nFileId == -1) { LPLog.LogMessage(LogType.Logerror, "Invalid file Id: " + this.hiSelectedLoan.Value); return; } int nFolderId = -1; if (!int.TryParse(this.hiSelectedFolderId.Value, out nFolderId)) { nFolderId = -1; } if (nFolderId == -1) { LPLog.LogMessage(LogType.Logerror, "Invalid folder Id: " + this.hiSelectedFolderId.Value); return; } try { ServiceManager sm = new ServiceManager(); using (LP2ServiceClient client = sm.StartServiceClient()) { DisposeLoanRequest req = new DisposeLoanRequest(); req.FileId = nFileId; req.LoanStatus = this.hiSelectedDisposal.Value; req.NewFolderId = nFolderId; req.hdr = new ReqHdr(); req.hdr.UserId = CurrUser.iUserID; req.StatusDate = DateTime.Now; DisposeLoanResponse response = client.DisposeLoan(req); if (response.hdr.Successful) { if (WorkflowManager.UpdateLoanStatus(nFileId, this.hiSelectedDisposal.Value, CurrUser.iUserID)) { BindLoanGrid(); LPLog.LogMessage(LogType.Loginfo, string.Format("Successfully update loan status, LoanId:{0}, to Status:{1}. ", nFileId, this.hiSelectedDisposal.Value)); } else { PageCommon.AlertMsg(this, "Failed to update loan status."); LPLog.LogMessage(LogType.Logerror, string.Format("Failed to update loan status, LoanId:{0}, to Status:{1}.", nFileId, this.hiSelectedDisposal.Value)); } } else { LPLog.LogMessage(LogType.Logerror, string.Format("Failed to move file:{0}", response.hdr.StatusInfo)); PageCommon.AlertMsg(this, response.hdr.StatusInfo); } } } catch (System.ServiceModel.EndpointNotFoundException ee) { LPLog.LogMessage(LogType.Logerror, string.Format("Faield to move file:{0}", ee.Message)); PageCommon.AlertMsg(this, "Failed to move the Point file, reason: Point Manager is not running."); } catch (Exception ex) { LPLog.LogMessage(LogType.Logerror, string.Format("Faield to move file:{0}", ex.Message)); PageCommon.AlertMsg(this, ex.Message); } }