Exemplo n.º 1
0
        private void UpdateTheRateExtendLock(int extendDays)
        {
            BLL.Company_Alerts bllComAlert = new Company_Alerts();
            BLL.LoanAlerts     bllAlert    = new LoanAlerts();
            BLL.Loans          bllLoans    = new BLL.Loans();
            Model.Loans        modelLoan   = new Model.Loans();

            modelLoan = bllLoans.GetModel(FileId);
            modelLoan.RateLockExpiration = OrgDate.AddDays(extendDays);

            bllLoans.Update(modelLoan);

            var comModel = bllComAlert.GetModel();
            //todo:确认此处是否这样查询LoanAlerts表中对应当前Loan的记录
            //此处应该只能查处一条数据
            var alertModelList = bllAlert.GetModelList(string.Format("FileId={0} AND AlertType={1}", FileId, "'Rate Lock'"));

            if (alertModelList.Count == 0)
            {
                return;
            }

            //if (extendDays < comModel.RateLockYellowDays || extendDays < comModel.RateLockRedDays)
            //{
            //    alertModelList[0].DueDate = OrgDate.AddDays(extendDays);
            //    bllAlert.Update(alertModelList[0]);
            //}
            //else if (extendDays > comModel.RateLockYellowDays || extendDays > comModel.RateLockRedDays)
            //{
            //    alertModelList[0].DueDate = OrgDate.AddDays(extendDays);
            //    bllAlert.Delete(alertModelList[0].LoanAlertId);
            //}

            PageCommon.WriteJs(this, "Update succeeded!", "window.parent.parent.location.href=window.parent.parent.location.href;parent.CloseCurrentWindowHandller();");
        }
Exemplo n.º 2
0
        /// <summary>
        /// Import Loans
        /// </summary>
        /// <param name="dr"></param>
        /// <returns></returns>
        private int ImportLoan(DataRow dr, int iFileID)
        {
            Loans bLoans = new Loans();

            Model.Loans mLoans = new Model.Loans();
            if (dtExcelData.Columns.Contains("Lien"))
            {
                mLoans.LienPosition = dr["Lien"] == DBNull.Value ? "" : dr["Lien"].ToString();
            }
            if (dtExcelData.Columns.Contains("Purpose of Loan"))
            {
                mLoans.Purpose = dr["Purpose of Loan"] == DBNull.Value ? "" : dr["Purpose of Loan"].ToString();
            }
            if (dtExcelData.Columns.Contains("Loan Amount"))
            {
                mLoans.LoanAmount = (dr["Loan Amount"] == DBNull.Value || dr["Loan Amount"].ToString() == "") ? 0 : Convert.ToDecimal(dr["Loan Amount"]);
            }
            if (dtExcelData.Columns.Contains("Appraised Value"))
            {
                mLoans.AppraisedValue = (dr["Appraised Value"] == DBNull.Value || dr["Appraised Value"].ToString() == "") ? 0 : Convert.ToDecimal(dr["Appraised Value"]);
            }
            if (dtExcelData.Columns.Contains("Sales Price"))
            {
                mLoans.SalesPrice = (dr["Sales Price"] == DBNull.Value || dr["Sales Price"].ToString() == "") ? 0 : Convert.ToDecimal(dr["Sales Price"]);
            }
            if (dtExcelData.Columns.Contains("Property Address"))
            {
                mLoans.PropertyAddr = dr["Property Address"] == DBNull.Value ? "" : dr["Property Address"].ToString();
            }
            if (dtExcelData.Columns.Contains("Property City"))
            {
                mLoans.PropertyCity = dr["Property City"] == DBNull.Value ? "" : dr["Property City"].ToString();
            }
            if (dtExcelData.Columns.Contains("Property State"))
            {
                mLoans.PropertyState = dr["Property State"] == DBNull.Value ? "" : dr["Property State"].ToString();
            }
            if (dtExcelData.Columns.Contains("Property Zip"))
            {
                mLoans.PropertyZip = dr["Property Zip"] == DBNull.Value ? "" : dr["Property Zip"].ToString();
            }
            mLoans.Status             = "Prospect";
            mLoans.ProspectLoanStatus = "Active";
            mLoans.Ranking            = "Hot";
            mLoans.Created            = DateTime.Now;
            mLoans.CreatedBy          = CurrUser.iUserID;
            mLoans.BranchID           = Convert.ToInt32(BranchId);
            mLoans.FileId             = iFileID;

            int iLoanID = bLoans.Add(mLoans);

            return(iLoanID);
        }
Exemplo n.º 3
0
        private void BindPage(int fileId)
        {
            BLL.Loans bllLoans = new BLL.Loans();

            Model.Loans  modelLoan  = new Model.Loans();
            BLL.Contacts bllContact = new BLL.Contacts();
            BLL.Users    bllUser    = new BLL.Users();

            modelLoan = bllLoans.GetModel(fileId);
            if (modelLoan != null && modelLoan.RateLockExpiration != null)
            {
                lblRateLockExp.Text = modelLoan.RateLockExpiration.Value.ToShortDateString();
                hfdExpDate.Value    = modelLoan.RateLockExpiration.Value.ToOADate().ToString();
            }

            lblCurrentState.Text = bllLoans.GetLoanStage(fileId);

            lblBorrower.Text = bllContact.GetBorrower(fileId);

            if (modelLoan != null)
            {
                lblEstCloseDate.Text = modelLoan.EstCloseDate != null?modelLoan.EstCloseDate.Value.ToShortDateString() : string.Empty;
            }

            lblCoborrower.Text = bllContact.GetCoBorrower(fileId);

            lblLoanOfficer.Text = bllUser.GetLoanOfficer(fileId);

            if (modelLoan != null)
            {
                lblPropertyAddress.Text = modelLoan.PropertyAddr + " " + modelLoan.PropertyCity + " " + modelLoan.PropertyState + " " + modelLoan.PropertyZip;
            }

            if (modelLoan != null && modelLoan.LoanAmount.HasValue)
            {
                lblLoanAmount.Text = "$" + string.Format("{0:N0}", modelLoan.LoanAmount.Value);
            }

            if (modelLoan != null && modelLoan.Rate.HasValue)
            {
                lblInterestRate.Text = modelLoan.Rate.Value.ToString("#.####") + "%";
            }

            lblLender.Text = bllLoans.GetLender(fileId);

            hfdFileId.Value = fileId.ToString();
        }
Exemplo n.º 4
0
        private void BindPage(int fileId, int noteId)
        {
            var bllLoans     = new Loans();
            var bllLoanNotes = new LoanNotes();
            var bllContact   = new Contacts();

            Model.Loans modelLoan = bllLoans.GetModel(fileId);
            if (modelLoan != null)
            {
                lblProperty.Text = modelLoan.PropertyAddr + " " + modelLoan.PropertyCity + " " + modelLoan.PropertyState +
                                   " " + modelLoan.PropertyZip;
            }

            var curUser = this.CurrUser;

            lblSender.Text   = curUser.sFirstName + " " + curUser.sLastName;
            lblBorrower.Text = bllContact.GetBorrower(fileId);

            if (noteId > 0)
            {
                Model.LoanNotes modelNotes = bllLoanNotes.GetModel(noteId);
                tbxNote.Text              = modelNotes.Note;
                lblSender.Text            = modelNotes.Sender;
                cbExternalViewing.Checked = modelNotes.ExternalViewing;

                #region 加载Condition信息

                DataTable LoanNotesInfo = bllLoanNotes.GetLoanNotesInfo(noteId);
                if (LoanNotesInfo.Rows.Count > 0)
                {
                    if (LoanNotesInfo.Rows[0]["LoanConditionId"] != DBNull.Value)
                    {
                        int iConditionID = Convert.ToInt32(LoanNotesInfo.Rows[0]["LoanConditionId"]);
                        BLL.LoanConditions LoanConditionsMgr = new BLL.LoanConditions();
                        DataTable          ConditionInfo     = LoanConditionsMgr.GetLoanConditionsInfo(iConditionID);
                        if (ConditionInfo.Rows.Count > 0)
                        {
                            this.lbCondition.Text = ConditionInfo.Rows[0]["CondName"].ToString();
                        }
                    }
                }

                #endregion
            }
        }
Exemplo n.º 5
0
        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;
            }
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string sTaskIDs = this.Request.QueryString["TaskIDs"].ToString();

            string sSendEmail = this.Request.QueryString["SendEmail"].ToString();

            string sLoanIDs         = this.Request.QueryString["LoanIDs"].ToString();
            string sErrorMsg        = string.Empty;
            string sEmailTemplateID = string.Empty;
            bool   bIsSuccess       = false;
            var    result           = "";
            string LoanClosed       = "No";
            string sGlobalLoanID    = "0";

            try
            {
                string[] TaskIDs = sTaskIDs.Split(",".ToCharArray());
                string[] LoanIDs = sLoanIDs.Split(",".ToCharArray());

                for (int i = 0; i < TaskIDs.Length; i++)
                {
                    int iTaskID          = Convert.ToInt32(TaskIDs[i]);
                    int iLoanID          = Convert.ToInt32(LoanIDs[i]);
                    int iEmailTemplateId = 0;
                    // if the task is client task
                    if (iLoanID == -1)
                    {
                        ProspectTasks bpTasks = new ProspectTasks();
                        bIsSuccess = bpTasks.ComplateSelProspectTask(iTaskID, this.CurrUser.iUserID, ref iEmailTemplateId);
                        if (bIsSuccess == false)
                        {
                            sErrorMsg = "Failed to CompleteTask.";
                            return;
                        }

                        if (iEmailTemplateId != 0)
                        {
                            //根据Lin 2011-02-28邮件,暂不增加发送邮件功能。
                            sEmailTemplateID = iEmailTemplateId.ToString();
                        }
                    }
                    else
                    {
                        #region complete task;
                        bIsSuccess    = LPWEBDAL.WorkflowManager.CompleteTask(iTaskID, this.CurrUser.iUserID, ref iEmailTemplateId);
                        sGlobalLoanID = iLoanID.ToString();
                        if (bIsSuccess == false)
                        {
                            sErrorMsg = "Failed to invoke WorkflowManager.CompleteTask.";
                            return;
                        }
                        if (iEmailTemplateId != 0 && sSendEmail == "OK")
                        {
                            sEmailTemplateID = iEmailTemplateId.ToString();
                            sErrorMsg        = SendEmail(iLoanID, iTaskID, iEmailTemplateId);
                        }
                        #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.";
                            continue;
                        }

                        #region invoke PointManager.UpdateStage()
                        BLL.Loans   loanMgr = new Loans();
                        Model.Loans loan    = loanMgr.GetModel(iLoanID); // if it's a prospect loan, don't update the Point file.
                        if (string.IsNullOrEmpty(loan.Status) || loan.Status.ToUpper() == "PROSPECT")
                        {
                            continue;
                        }

                        string sError = LoanTaskCommon.UpdatePointFileStage(iLoanID, this.CurrUser.iUserID, iLoanStageID);

                        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("\"", "\\\"");
                        }
                        if (WorkflowManager.IsLoanClosed(iLoanID))
                        {
                            LoanClosed = "Yes";
                        }
                        #endregion
                        #endregion
                    }
                }
                return;
            }
            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 + "\",\"TaskID\":\"" + sTaskIDs + "\",\"LoanID\":\"" + sGlobalLoanID + "\",\"LoanClosed\":\"" + LoanClosed + "\"}";
                }
                //result = "{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\",\"EmailTemplateID\":\"" + sEmailTemplateID + "\",\"LoanClosed\":\"" + LoanClosed + "\"}";
                else
                {
                    result = "{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sErrorMsg + "\"}";
                }
                this.Response.Write(result);
            }
        }