private void BindPoint(int FileID) { try { //btnExport.Enabled = false; PointFiles file = new PointFiles(); LPWeb.Model.PointFiles fileModel = new LPWeb.Model.PointFiles(); fileModel = file.GetModel(iFileID); if (fileModel == null) { return; } txbPointFileName.Text = fileModel.Name; PointFolders folder = new PointFolders(); LPWeb.Model.PointFolders folderModel = new LPWeb.Model.PointFolders(); folderModel = folder.GetModel(fileModel.FolderId); if (folderModel != null && folderModel.Name.Length > 0) { ddlPointFolder.Text = folderModel.Name; } if (txbPointFileName.Text.Length > 0 && ddlPointFolder.Text.Length > 0) { //btnExport.Enabled = true; } } catch { } }
private LPWeb.Model.PointFiles GetPointFileInfo(int iFileId) { PointFiles PointFilesMgr = new PointFiles(); LPWeb.Model.PointFiles PointFileInfo = PointFilesMgr.GetModel(this.iLoanID); return(PointFileInfo); }
private void BindPoint(int FileID) { try { //btnExport.Enabled = false; PointFiles file = new PointFiles(); LPWeb.Model.PointFiles fileModel = new LPWeb.Model.PointFiles(); fileModel = file.GetModel(iFileID); if (fileModel == null) { return; } txbPointFileName.Text = fileModel.Name; PointFolders folder = new PointFolders(); if (fileModel.FolderId > 0) { LPWeb.Model.PointFolders folderModel = new LPWeb.Model.PointFolders(); folderModel = folder.GetModel(fileModel.FolderId); if (folderModel != null && folderModel.Name.Length > 0) { ListItem item = new ListItem(folderModel.Name, folderModel.FolderId.ToString()); ddlPointFolder.Items.Insert(0, item); } ddlPointFolder.Enabled = false; } else if (ddlPointFolder.Items.Count > 1) { ddlPointFolder.Enabled = true; } if (txbPointFileName.Text.Length > 0 && ddlPointFolder.Text.Length > 0) { if (!txbPointFileName.Text.ToUpper().EndsWith(".PRS") && !txbPointFileName.Text.ToUpper().EndsWith(".BRW")) { //btnExport.Enabled = false; return; } string filename = System.IO.Path.GetFileName(txbPointFileName.Text); if (txbPointFileName.Text.ToUpper().EndsWith(".PRS")) { txbPointFileName.Text = @"\PROSPECT\" + filename; } else { txbPointFileName.Text = @"\BORROWER\" + filename; } ///btnExport.Enabled = true; } } catch (Exception ex) { LPLog.LogMessage(ex.Message); } }
protected void Page_Load(object sender, EventArgs e) { #region 校验页面参数 string sReturnUrl = "../Pipeline/ProspectPipelineSummaryLoan.aspx"; string sErrorMsg = "Failed to load this page: missing required query string."; // FileID bool bIsValid = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID); if (bIsValid == false) { PageCommon.WriteJsEnd(this, sErrorMsg, "window.parent.location.href='" + sReturnUrl + "'"); } string sFileID = this.Request.QueryString["FileID"]; this.hfFileID.Value = sFileID; try { this.iFileID = Convert.ToInt32(sFileID); } catch { } #endregion #region LoadbaseInfo loanInfo = bllLoans.GetModel(iFileID); if (loanInfo != null) { iBranchId = (loanInfo.BranchID == null) ? 0 : loanInfo.BranchID.Value; } pointFileInfo = bllPointFile.GetModel(iFileID); iPointFolderId = (pointFileInfo == null || pointFileInfo.FolderId <= 0) ? 0 : pointFileInfo.FolderId; if (iPointFolderId > 0) { pointFolderInfo = bllPointFolders.GetModel(pointFileInfo.FolderId); } #endregion if (!IsPostBack) { BindData(); } }
private bool UpdatePointNote(int fileId, DateTime dtNow, string senderName, out string err) { bool exported = false; err = string.Empty; try { LPWeb.BLL.PointFiles pfMgr = new PointFiles(); LPWeb.Model.PointFiles pfModel = pfMgr.GetModel(fileId); if (pfModel == null || pfModel.FolderId <= 0 || string.IsNullOrEmpty(pfModel.Name) || string.IsNullOrEmpty(pfModel.CurrentImage)) { exported = true; return(exported); } var req = new AddNoteRequest { FileId = fileId, Created = dtNow,//DateTime.Now, NoteTime = dtNow, Note = this.txtNote.Text.Trim(), Sender = senderName, hdr = new ReqHdr { UserId = this.CurrUser.iUserID } }; ServiceManager sm = new ServiceManager(); using (LP2ServiceClient client = sm.StartServiceClient()) { AddNoteResponse res = client.AddNote(req); exported = !res.hdr.Successful ? false : true; err = res.hdr.StatusInfo; } } catch (Exception ex) { return(exported); } return(exported); }
private string CompleteTask(int iLoanTaskId) { #region complete task string sErrorMsg = string.Empty; int iEmailTemplateId = 0; bool bIsSuccess = LPWeb.DAL.WorkflowManager.CompleteTask(iLoanTaskId, this.CurrUser.iUserID, ref iEmailTemplateId); if (bIsSuccess == false) { sErrorMsg = "Failed to invoke WorkflowManager.CompleteTask."; return(sErrorMsg); } #endregion #region update point file stage int iLoanStageID = 0; #region get loan task info LoanTasks LoanTaskManager = new LoanTasks(); DataTable LoanTaskInfo = LoanTaskManager.GetLoanTaskInfo(iLoanTaskId); if (LoanTaskInfo.Rows.Count == 0) { sErrorMsg = "Invalid task id."; return(sErrorMsg); } string sLoanStageID = LoanTaskInfo.Rows[0]["LoanStageId"].ToString(); if (sLoanStageID == string.Empty) { sErrorMsg = "Invalid loan stage id."; return(sErrorMsg); } iLoanStageID = Convert.ToInt32(sLoanStageID); #endregion if (WorkflowManager.StageCompleted(iLoanStageID) == true) { #region invoke PointManager.UpdateStage() //add by gdc 20111212 Bug #1306 LPWeb.BLL.PointFiles pfile = new PointFiles(); var model = pfile.GetModel(iLoanID); if (model != null && !string.IsNullOrEmpty(model.Name.Trim())) { #region UPdatePointFileStage WCF string sError = LoanTaskCommon.UpdatePointFileStage(iLoanID, this.CurrUser.iUserID, iLoanStageID); #endregion } #endregion } #endregion return(sErrorMsg); }
protected void Page_Load(object sender, EventArgs e) { #region 接收参数 // TaskID bool bIsValid = PageCommon.ValidateQueryString(this, "TaskID", QueryStringType.ID); if (bIsValid == false) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}"); return; } string sTaskID = this.Request.QueryString["TaskID"].ToString(); int iTaskID = Convert.ToInt32(sTaskID); // LoanID bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID); if (bIsValid == false) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}"); return; } string sLoanID = this.Request.QueryString["LoanID"].ToString(); int iLoanID = Convert.ToInt32(sLoanID); #endregion // json示例 // {"ExecResult":"Success","ErrorMsg":"","EmailTemplateID":"1", "LoanClosed":"Yes"} // {"ExecResult":"Failed","ErrorMsg":"执行数据库脚本时发生错误。"} string sErrorMsg = string.Empty; string sEmailTemplateID = string.Empty; bool bIsSuccess = false; string LoanClosed = "No"; var result = ""; try { #region complete task int iEmailTemplateId = 0; bIsSuccess = LPWeb.DAL.WorkflowManager.CompleteTask(iTaskID, this.CurrUser.iUserID, ref iEmailTemplateId); if (bIsSuccess == false) { sErrorMsg = "Failed to invoke WorkflowManager.CompleteTask."; return; } if (iEmailTemplateId != 0) { sEmailTemplateID = iEmailTemplateId.ToString(); } #endregion #region update point file stage int iLoanStageID = 0; #region get loan task info LoanTasks LoanTaskManager = new LoanTasks(); DataTable LoanTaskInfo = LoanTaskManager.GetLoanTaskInfo(iTaskID); if (LoanTaskInfo.Rows.Count == 0) { bIsSuccess = false; sErrorMsg = "Invalid task id."; return; } string sLoanStageID = LoanTaskInfo.Rows[0]["LoanStageId"].ToString(); if (sLoanStageID == string.Empty) { bIsSuccess = false; sErrorMsg = "Invalid loan stage id."; return; } iLoanStageID = Convert.ToInt32(sLoanStageID); #endregion bIsSuccess = true; if (!WorkflowManager.StageCompleted(iLoanStageID)) { sErrorMsg = "Completed task successfully."; return; } #region invoke PointManager.UpdateStage() //add by gdc 20111212 Bug #1306 LPWeb.BLL.PointFiles pfile = new PointFiles(); var model = pfile.GetModel(iLoanID); if (model != null && !string.IsNullOrEmpty(model.Name.Trim())) { #region check Point File Status first ServiceManager sm = new ServiceManager(); using (LP2ServiceClient service = sm.StartServiceClient()) { CheckPointFileStatusReq checkFileReq = new CheckPointFileStatusReq(); checkFileReq.hdr = new ReqHdr(); checkFileReq.hdr.UserId = CurrUser.iUserID; checkFileReq.hdr.SecurityToken = "SecurityToken"; checkFileReq.FileId = iLoanID; CheckPointFileStatusResp checkFileResp = service.CheckPointFileStatus(checkFileReq); if (checkFileResp == null || checkFileResp.hdr == null || !checkFileResp.hdr.Successful) { sErrorMsg = "Unable to get Point file status from Point Manager."; WorkflowManager.UnCompleteTask(iTaskID, CurrUser.iUserID); bIsSuccess = false; return; } if (checkFileResp.FileLocked) { sErrorMsg = checkFileResp.hdr.StatusInfo; WorkflowManager.UnCompleteTask(iTaskID, CurrUser.iUserID); bIsSuccess = false; return; } } #endregion #region UPdatePointFileStage WCF string sError = LoanTaskCommon.UpdatePointFileStage(iLoanID, this.CurrUser.iUserID, iLoanStageID); // the last one, sleep 1 second System.Threading.Thread.Sleep(1000); if (sError == string.Empty) // success { sErrorMsg = "Completed task successfully."; } else { sErrorMsg = "Completed task successfully but failed to update stage date in Point."; //sErrorMsg = "Failed to update point file stage: " + sError.Replace("\"", "\\\""); } #endregion } if (WorkflowManager.IsLoanClosed(iLoanID)) { LoanClosed = "Yes"; } return; #endregion } catch (System.ServiceModel.EndpointNotFoundException ee) { sErrorMsg = "Completed task successfully but failed to update stage date in Point."; return; } catch (Exception ex) { if (bIsSuccess) { sErrorMsg = "Completed task successfully but encountered an error:" + ex.Message; } else { sErrorMsg = "Failed to complete task, reason:" + ex.Message; } //sErrorMsg = "Exception happened when invoke WorkflowManager.CompleteTask: " + ex.ToString().Replace("\"", "\\\""); bIsSuccess = false; return; } finally { if (bIsSuccess) { result = "{\"ExecResult\":\"Success\",\"ErrorMsg\":\"" + sErrorMsg + "\",\"EmailTemplateID\":\"" + sEmailTemplateID + "\",\"TaskID\":\"" + sTaskID + "\",\"LoanClosed\":\"" + LoanClosed + "\"}"; } //result = "{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\",\"EmailTemplateID\":\"" + sEmailTemplateID + "\",\"LoanClosed\":\"" + LoanClosed + "\"}"; else { result = "{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}"; } this.Response.Write(result); } #endregion }
protected void Page_Load(object sender, EventArgs e) { #region 接收参数 // TaskID bool bIsValid = PageCommon.ValidateQueryString(this, "TaskID", QueryStringType.ID); if (bIsValid == false) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}"); this.Response.End(); } string sTaskID = this.Request.QueryString["TaskID"].ToString(); int iTaskID = Convert.ToInt32(sTaskID); // LoanID bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID); if (bIsValid == false) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}"); this.Response.End(); } string sLoanID = this.Request.QueryString["LoanID"].ToString(); int iLoanID = Convert.ToInt32(sLoanID); #endregion // json示例 // {"ExecResult":"Success","ErrorMsg":""} // {"ExecResult":"Failed","ErrorMsg":"执行数据库脚本时发生错误。"} string sErrorMsg = string.Empty; int iLoanStageID; bool StageCompleted = false; try { #region get loan task info LoanTasks LoanTaskManager = new LoanTasks(); DataTable LoanTaskInfo = LoanTaskManager.GetLoanTaskInfo(iTaskID); if (LoanTaskInfo.Rows.Count == 0) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Invalid task id.\"}"); return; } string sLoanStageID = LoanTaskInfo.Rows[0]["LoanStageId"].ToString(); if (sLoanStageID == string.Empty) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Invalid loan stage id.\"}"); return; } iLoanStageID = Convert.ToInt32(sLoanStageID); #endregion #region uncomplete task StageCompleted = WorkflowManager.StageCompleted(iLoanStageID); bool bIsSuccess = LPWeb.DAL.WorkflowManager.UnCompleteTask(iTaskID, this.CurrUser.iUserID); if (bIsSuccess == false) { this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Failed to invoke WorkflowManager.UnCompleteTask api.\"}"); return; } #endregion } catch (Exception ex) { sErrorMsg = "Failed to invoke Workflow Manager, reason:" + ex.Message; //sErrorMsg = "Exception happened when invoke WorkflowManager.UnCompleteTask: " + ex.ToString().Replace("\"", "\\\""); this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}"); return; } if (!StageCompleted) // if the stage was not completed prior to the un-complete { this.Response.Write("{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\"}"); return; } try { //add by gdc 20111212 Bug #1306 LPWeb.BLL.PointFiles pfile = new PointFiles(); var model = pfile.GetModel(iLoanID); if (model != null && !string.IsNullOrEmpty(model.Name.Trim())) { #region check Point File Status first //ServiceManager sm = new ServiceManager(); //using (LP2ServiceClient service = sm.StartServiceClient()) //{ // CheckPointFileStatusReq checkFileReq = new CheckPointFileStatusReq(); // checkFileReq.hdr = new ReqHdr(); // checkFileReq.hdr.UserId = CurrUser.iUserID; // checkFileReq.hdr.SecurityToken = "SecurityToken"; // checkFileReq.FileId = iLoanID; // int emailTemplateId = 0; // CheckPointFileStatusResp checkFileResp = service.CheckPointFileStatus(checkFileReq); // if (checkFileResp == null || checkFileResp.hdr == null || !checkFileResp.hdr.Successful) // { // sErrorMsg = "Unable to get Point file status from Point Manager."; // WorkflowManager.CompleteTask(iTaskID, CurrUser.iUserID, ref emailTemplateId); // this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}"); // return; // } // if (checkFileResp.FileLocked) // { // sErrorMsg = checkFileResp.hdr.StatusInfo; // WorkflowManager.CompleteTask(iTaskID, CurrUser.iUserID, ref emailTemplateId); // this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}"); // return; // } //} #endregion #region update point file stage string sError = LoanTaskCommon.UpdatePointFileStage(iLoanID, this.CurrUser.iUserID, iLoanStageID); // the last one, sleep 1 second System.Threading.Thread.Sleep(1000); if (sError == string.Empty) // success { this.Response.Write("{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\"}"); } else { sErrorMsg = "Un-completed task successfully but failed to update stage date in Point."; //sErrorMsg = "Uncomplete task successfully, but failed to update point file stage: " + sError.Replace("\"", "\\\""); this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}"); } #endregion } else { this.Response.Write("{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\"}"); } } catch (Exception ex) { sErrorMsg = "Un-completed task successfully but failed to update stage date in Point, reason:" + ex.Message; //sErrorMsg = "Uncomplete task successfully, but exception happened when update point stage: " + ex.ToString().Replace("\"", "\\\""); this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}"); } }
private bool SaveLocal(ref string errMsg) { if (!string.IsNullOrEmpty(FileName) && FileName.Length > 0 && !FileName.ToUpper().EndsWith(".PRS") && !FileName.ToUpper().EndsWith(".BRW")) { errMsg = "The filename must end with “.PRS” or “.BRW”. "; return(false); } try { #region Save BranchId Loans bllLoans = new Loans(); LPWeb.Model.Loans loanInfo = new LPWeb.Model.Loans(); loanInfo = bllLoans.GetModel(iFileID); if (loanInfo != null) { loanInfo.BranchID = BranchId; bllLoans.Update(loanInfo); } #endregion //Save Loan Officer #region Loan Officer LoanTeam bllLoanTeam = new LoanTeam(); Users bllUsers = new Users(); var loanOfficer = bllLoanTeam.GetLoanOfficer(iFileID); var loanOfficerId = bllLoanTeam.GetLoanOfficerID(iFileID); #region Loan Officer RolesID =loanOfficerRolesId Roles bllRoles = new Roles(); int loanOfficerRolesId = 3;//default; try { loanOfficerRolesId = bllRoles.GetModelList(" Name = 'Loan Officer' ").FirstOrDefault().RoleId; } catch { } #endregion if (LoanOfficerId != loanOfficerId) { var loanTeamInfo = bllLoanTeam.GetModel(iFileID, loanOfficerRolesId, loanOfficerId); if (loanTeamInfo == null) { loanTeamInfo = new LPWeb.Model.LoanTeam(); } else { bllLoanTeam.Delete(iFileID, loanOfficerRolesId, loanOfficerId); } loanTeamInfo.FileId = iFileID; loanTeamInfo.RoleId = loanOfficerRolesId; loanTeamInfo.UserId = LoanOfficerId; bllLoanTeam.Add(loanTeamInfo); } #endregion #region Local PointFile ----pointFileInfo and pointFolderInfo PointFiles bllPointFile = new PointFiles(); PointFolders bllPointFolders = new PointFolders(); LPWeb.Model.PointFiles pointFileInfo = bllPointFile.GetModel(iFileID); var IsAddPointFile = false; if (pointFileInfo == null) { IsAddPointFile = true; pointFileInfo = new LPWeb.Model.PointFiles(); } else { IsAddPointFile = false; } pointFileInfo.FileId = iFileID; if (FolderId > 0) { pointFileInfo.FolderId = FolderId; } if (FileName.Length > 0) { pointFileInfo.Name = FileName; } if (IsAddPointFile) { bllPointFile.Add(pointFileInfo); } else { bllPointFile.UpdateBase(pointFileInfo); } #endregion } catch (Exception ex) { errMsg = ex.Message; return(false); } return(true); }
private void BindPage(int fileId, int hisId) { BLL.Loans bllLoans = new BLL.Loans(); Model.Loans modelLoan = new Model.Loans(); BLL.Contacts bllContact = new BLL.Contacts(); BLL.Users bllUser = new BLL.Users(); BLL.PointImportHistory bllPointImportHistory = new PointImportHistory(); BLL.PointFiles bllPointFiles = new PointFiles(); BLL.PointFolders bllPointFolders = new PointFolders(); var dsList = new DataSet(); if (fileId > 0) { dsList = bllPointImportHistory.GetList(string.Format("FileId={0}", fileId)); } else if (hisId > 0) { dsList = bllPointImportHistory.GetList(string.Format("HistoryId={0}", hisId)); } if (dsList == null || dsList.Tables.Count == 0 || dsList.Tables[0].Rows.Count == 0) { PageCommon.AlertMsg(this, "There is no data in database."); return; } fileId = int.Parse(dsList.Tables[0].Rows[0]["FileId"].ToString()); hfdHisId.Value = fileId.ToString(); var modelPointFiles = bllPointFiles.GetModel(fileId); if (modelPointFiles != null) { var modelPointFolder = bllPointFolders.GetModel(modelPointFiles.FolderId); if (modelPointFolder != null) { lblPointFile.Text = modelPointFolder.Name + modelPointFiles.Name; } } lblBorrower.Text = bllContact.GetBorrower(fileId); lblLoanOfficer.Text = bllUser.GetLoanOfficer(fileId); // Start: get icon name by fileId, 2010-11-15 if (string.IsNullOrEmpty(imgSrc)) { string strSeverity = dsList.Tables[0].Rows[0]["Severity"].ToString().ToLower(); switch (strSeverity) { case "error": imgIcon.Src = "../images/loan/AlertError.png"; break; case "warning": imgIcon.Src = "../images/loan/AlertWarning.png"; break; default: imgIcon.Visible = false; break; } } else { imgIcon.Src = "../images/loan/" + imgSrc; } // End: get icon name by fileId, 2010-11-15 DateTime dt = DateTime.MinValue; DateTime.TryParse(dsList.Tables[0].Rows[0]["ImportTime"].ToString(), out dt); if (dt != DateTime.MinValue) { lblTime.Text = dt.ToString("MM/dd/yyyy hh:mm:ss"); } if (!string.IsNullOrEmpty(dsList.Tables[0].Rows[0]["Error"].ToString())) { string s1 = dsList.Tables[0].Rows[0]["Error"].ToString().Trim(); s1 = s1.Replace("<br/> ", "\r\n"); s1 = s1.Replace("<br/> ", "\r\n"); s1 = s1.Replace("<br/>", "\r\n"); tbxErrorMessages.Text = s1; } }