Ejemplo n.º 1
0
    protected int CreateContactAndProspect(string sFirstName, string sLastName, string sEmail, string sType, string sPhone, string sDOB, string sSSN, int iUserID, string Purpose)
    {
        #region create new contact

        LPWeb.Model.Contacts ContactsModel = new LPWeb.Model.Contacts();
        ContactsModel.ContactId = 0;
        ContactsModel.FirstName = sFirstName;
        ContactsModel.LastName  = sLastName;
        ContactsModel.Email     = sEmail;

        if (sType == "Cell Phone")
        {
            ContactsModel.CellPhone     = sPhone;
            ContactsModel.HomePhone     = string.Empty;
            ContactsModel.BusinessPhone = string.Empty;
        }
        else if (sType == "Home Phone")
        {
            ContactsModel.CellPhone     = string.Empty;
            ContactsModel.HomePhone     = sPhone;
            ContactsModel.BusinessPhone = string.Empty;
        }
        else if (sType == "Work Phone")
        {
            ContactsModel.CellPhone     = string.Empty;
            ContactsModel.HomePhone     = string.Empty;
            ContactsModel.BusinessPhone = sPhone;
        }

        if (sDOB == string.Empty)
        {
            ContactsModel.DOB = null;
        }
        else
        {
            ContactsModel.DOB = Convert.ToDateTime(sDOB);
        }

        ContactsModel.SSN = sSSN;

        ContactsModel.MiddleName     = string.Empty;
        ContactsModel.NickName       = txtFirstName.Text.Trim();
        ContactsModel.Title          = string.Empty;
        ContactsModel.GenerationCode = string.Empty;
        ContactsModel.Fax            = string.Empty;
        ContactsModel.MailingAddr    = string.Empty;
        ContactsModel.MailingCity    = string.Empty;
        ContactsModel.MailingState   = string.Empty;
        ContactsModel.MailingZip     = string.Empty;

        #endregion

        #region create new prospect

        LPWeb.Model.Prospect ProspectModel = new LPWeb.Model.Prospect();

        ProspectModel.PreferredContact = sType;

        ProspectModel.Contactid  = 0;
        ProspectModel.Created    = DateTime.Now;
        ProspectModel.CreatedBy  = iUserID;
        ProspectModel.LeadSource = ddlLeadSource.SelectedValue.ToString() == "0" ? "" : this.ddlLeadSource.SelectedItem.Text;

        string sLoanOfficerID = ddlLoanOfficer.SelectedValue;
        iLoanOfficerID = 0;
        if (sLoanOfficerID == "-1" || sLoanOfficerID == "-2")
        {
            //Nobody
        }
        else if (sLoanOfficerID == "0")
        {
            //Lead Routing Engine
            try
            {
                ServiceManager sm = new ServiceManager();
                using (LP2ServiceClient client = sm.StartServiceClient())
                {
                    //invoke the WCF API GetNextLoanOfficer
                    LR_GetNextLoanOfficerReq req = new LR_GetNextLoanOfficerReq();
                    req.LeadSource           = ddlLeadSource.SelectedItem.Text;
                    req.Purpose              = Purpose;
                    req.ReqHdr               = new ReqHdr();
                    req.ReqHdr.UserId        = CurrUser.iUserID;
                    req.ReqHdr.SecurityToken = "SecurityToken";
                    LR_GetNextLoanOfficerResp response = client.LeadRouting_GetNextLoanofficer(req);
                    if (response.RespHdr.Successful)
                    {
                        iLoanOfficerID = response.NextLoanOfficerID;
                    }
                    else
                    {
                        Company_Lead_Sources LeadSourceMgr     = new Company_Lead_Sources();
                        DataTable            SelLeadSourceList = LeadSourceMgr.GetList("LeadSourceID='" + ddlLeadSource.SelectedValue + "'").Tables[0];
                        if (SelLeadSourceList != null && SelLeadSourceList.Rows.Count > 0)
                        {
                            iLoanOfficerID = SelLeadSourceList.Rows[0]["DefaultUserId"] == DBNull.Value ? 0 : Convert.ToInt32(SelLeadSourceList.Rows[0]["DefaultUserId"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Company_Lead_Sources LeadSourceMgr     = new Company_Lead_Sources();
                DataTable            SelLeadSourceList = LeadSourceMgr.GetList("LeadSourceID='" + ddlLeadSource.SelectedValue + "'").Tables[0];
                if (SelLeadSourceList != null && SelLeadSourceList.Rows.Count > 0)
                {
                    iLoanOfficerID = SelLeadSourceList.Rows[0]["DefaultUserId"] == DBNull.Value ? 0 : Convert.ToInt32(SelLeadSourceList.Rows[0]["DefaultUserId"]);
                }
            }
        }
        else
        {
            iLoanOfficerID = Convert.ToInt32(sLoanOfficerID);
        }


        ProspectModel.Loanofficer   = iLoanOfficerID;
        ProspectModel.ReferenceCode = string.Empty;
        ProspectModel.Status        = "Active";
        ProspectModel.CreditRanking = string.Empty;
        ProspectModel.Referral      = null;

        Prospect ProspectManager = new Prospect();

        int iContactId = ProspectManager.CreateContactAndProspect(ContactsModel, ProspectModel);


        #endregion

        return(iContactId);
    }
Ejemplo n.º 2
0
    protected int CreateLoan(int iContactId, decimal LoanAmount, string Purpose)
    {
        int iFolderId = 0;

        LPWeb.Model.LoanDetails LoanDetailsModel = new LPWeb.Model.LoanDetails();

        LoanDetailsModel.FileId             = 0;
        LoanDetailsModel.FolderId           = iFolderId;
        LoanDetailsModel.Status             = "Prospect";
        LoanDetailsModel.ProspectLoanStatus = "Active";

        LoanDetailsModel.BoID   = iContactId;
        LoanDetailsModel.CoBoID = 0;

        LoanDetailsModel.Created    = DateTime.Now;
        LoanDetailsModel.CreatedBy  = CurrUser.iUserID;
        LoanDetailsModel.Modifed    = DateTime.Now;
        LoanDetailsModel.ModifiedBy = CurrUser.iUserID;

        LoanDetailsModel.LoanAmount   = LoanAmount;
        LoanDetailsModel.EstCloseDate = null;
        LoanDetailsModel.Ranking      = string.Empty;
        LoanDetailsModel.UserId       = CurrUser.iUserID;

        string sLoanOfficerID = ddlLoanOfficer.SelectedValue;

        iLoanOfficerID = 0;
        if (sLoanOfficerID == "-1" || sLoanOfficerID == "-2")
        {
            //Nobody
        }
        else if (sLoanOfficerID == "0")
        {
            //Lead Routing Engine
            try
            {
                ServiceManager sm = new ServiceManager();
                using (LP2ServiceClient client = sm.StartServiceClient())
                {
                    //invoke the WCF API GetNextLoanOfficer
                    LR_GetNextLoanOfficerReq req = new LR_GetNextLoanOfficerReq();
                    req.LeadSource           = ddlLeadSource.SelectedItem.Text;
                    req.Purpose              = Purpose;
                    req.ReqHdr               = new ReqHdr();
                    req.ReqHdr.UserId        = CurrUser.iUserID;
                    req.ReqHdr.SecurityToken = "SecurityToken";
                    LR_GetNextLoanOfficerResp response = client.LeadRouting_GetNextLoanofficer(req);
                    if (response.RespHdr.Successful)
                    {
                        iLoanOfficerID = response.NextLoanOfficerID;
                    }
                    else
                    {
                        Company_Lead_Sources LeadSourceMgr     = new Company_Lead_Sources();
                        DataTable            SelLeadSourceList = LeadSourceMgr.GetList("LeadSourceID='" + ddlLeadSource.SelectedValue + "'").Tables[0];
                        if (SelLeadSourceList != null && SelLeadSourceList.Rows.Count > 0)
                        {
                            iLoanOfficerID = SelLeadSourceList.Rows[0]["DefaultUserId"] == DBNull.Value ? 0 : Convert.ToInt32(SelLeadSourceList.Rows[0]["DefaultUserId"]);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Company_Lead_Sources LeadSourceMgr     = new Company_Lead_Sources();
                DataTable            SelLeadSourceList = LeadSourceMgr.GetList("LeadSourceID='" + ddlLeadSource.SelectedValue + "'").Tables[0];
                if (SelLeadSourceList != null && SelLeadSourceList.Rows.Count > 0)
                {
                    iLoanOfficerID = SelLeadSourceList.Rows[0]["DefaultUserId"] == DBNull.Value ? 0 : Convert.ToInt32(SelLeadSourceList.Rows[0]["DefaultUserId"]);
                }
            }
        }
        else
        {
            iLoanOfficerID = Convert.ToInt32(sLoanOfficerID);
        }

        LoanDetailsModel.LoanOfficerId = iLoanOfficerID;
        LoanDetailsModel.Rate          = null;
        LoanDetailsModel.Program       = string.Empty;
        LoanDetailsModel.Purpose       = Purpose;
        LoanDetailsModel.Lien          = string.Empty;

        LoanDetailsModel.PropertyAddr  = string.Empty;
        LoanDetailsModel.PropertyCity  = string.Empty;
        LoanDetailsModel.PropertyState = string.Empty;
        LoanDetailsModel.PropertyZip   = string.Empty;

        LoanDetailsModel.FileName       = string.Empty;
        LoanDetailsModel.PropertyType   = string.Empty;
        LoanDetailsModel.HousingStatus  = string.Empty;
        LoanDetailsModel.IncludeEscrows = false;
        LoanDetailsModel.InterestOnly   = false;
        LoanDetailsModel.RentAmount     = 0;
        LoanDetailsModel.CoborrowerType = string.Empty;

        Loans LoansMgr = new Loans();

        int iFileID = LoansMgr.LoanDetailSaveFileId(LoanDetailsModel);

        return(iFileID);
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack == false)
        {
            #region  加载 ddlLeadSource
            Company_Lead_Sources LeadSourceManager = new Company_Lead_Sources();
            DataTable            LeadSourceList    = LeadSourceManager.GetList("1=1 order by LeadSource").Tables[0];

            DataRow NewLeadSourceRow = LeadSourceList.NewRow();
            NewLeadSourceRow["LeadSourceID"] = 0;
            NewLeadSourceRow["LeadSource"]   = "- select -";
            NewLeadSourceRow["Default"]      = DBNull.Value;

            LeadSourceList.Rows.InsertAt(NewLeadSourceRow, 0);

            this.ddlLeadSource.DataSource = LeadSourceList;
            this.ddlLeadSource.DataBind();
            // set default selected
            DataRow[] DefaultRowArray = LeadSourceList.Select("Default=1");
            if (DefaultRowArray.Length > 0)
            {
                string sLeadSource = DefaultRowArray[0]["LeadSourceID"].ToString();
                this.ddlLeadSource.SelectedValue = sLeadSource;
            }
            #endregion

            #region 加载 ddlLoanOfficer

            DataTable dtLoadOfficer = this.GetLoanOfficerList(CurrUser.iUserID);

            DataRow drNew = dtLoadOfficer.NewRow();
            //2014/1/16 CR072 Add the current user in the Loan Officer dropdown list
            if (dtLoadOfficer.Select("ID=" + CurrUser.iUserID.ToString()).Length < 1)
            {
                drNew["ID"]        = CurrUser.iUserID;
                drNew["Name"]      = CurrUser.sFullName;
                drNew["LastName"]  = CurrUser.sLastName;
                drNew["FirstName"] = CurrUser.sFirstName;
                dtLoadOfficer.Rows.InsertAt(drNew, 0);
            }
            drNew         = dtLoadOfficer.NewRow();
            drNew["ID"]   = 0;
            drNew["Name"] = "Lead Routing Engine";
            dtLoadOfficer.Rows.InsertAt(drNew, 0);

            drNew         = dtLoadOfficer.NewRow();
            drNew["ID"]   = -1;
            drNew["Name"] = "Unassigned";
            dtLoadOfficer.Rows.InsertAt(drNew, 0);

            drNew         = dtLoadOfficer.NewRow();
            drNew["ID"]   = -2;
            drNew["Name"] = "- select -";
            dtLoadOfficer.Rows.InsertAt(drNew, 0);

            ddlLoanOfficer.DataSource     = dtLoadOfficer;
            ddlLoanOfficer.DataTextField  = "Name";
            ddlLoanOfficer.DataValueField = "ID";
            //if (dtLoadOfficer.Select("ID=" + CurrUser.iUserID.ToString()).Length > 0)
            //{
            //    ddlLoanOfficer.SelectedValue = CurrUser.iUserID.ToString();
            //}
            //else
            //{
            ddlLoanOfficer.SelectedValue = "0";
            //}
            ddlLoanOfficer.DataBind();
            #endregion

            #region 加载ddlWorkflow

            Template_Workflow WflTempMgr   = new Template_Workflow();
            DataTable         WorkflowList = WflTempMgr.GetWorkflowTemplateList(" and WorkflowType='Prospect' and Enabled=1", "Name");
            this.ddlWorkflow.DataSource = WorkflowList;
            this.ddlWorkflow.DataBind();

            // set default selected
            DefaultRowArray = WorkflowList.Select("Default=1");
            if (DefaultRowArray.Length > 0)
            {
                string sWflTemplId = DefaultRowArray[0]["WflTemplId"].ToString();

                this.ddlWorkflow.SelectedValue = sWflTemplId;
            }

            #endregion

            #region 加载Marketing enrollment

            MailChimpLists MailChimpListsMgr = new MailChimpLists();

            DataTable MailChimpList = null;

            CheckRolePermistion(this.CurrUser.iUserID);

            if (_isAccessAllMailChimpList == true)
            {
                if (this.CurrUser.bIsCompanyExecutive == true)
                {
                    MailChimpList = MailChimpListsMgr.GetMailChimpList(" and 1=1 ", "Name");
                }
                else
                {
                    if (this.CurrUser.bIsBranchManager == true)
                    {
                        MailChimpList = MailChimpListsMgr.GetMailChimpList_BranchManager(this.CurrUser.iUserID);
                    }
                    else
                    {
                        MailChimpList = MailChimpListsMgr.GetMailChimpList(" and UserId=" + this.CurrUser.iUserID, "Name");
                    }
                }
            }
            else
            {
                MailChimpList = MailChimpListsMgr.GetMailChimpList(" and UserId=" + this.CurrUser.iUserID, "Name");
            }

            DataRow NewMarkingRow = MailChimpList.NewRow();
            NewMarkingRow["LID"]  = "";
            NewMarkingRow["Name"] = "-- select --";
            MailChimpList.Rows.InsertAt(NewMarkingRow, 0);

            this.ddlMarketing.DataSource = MailChimpList;
            this.ddlMarketing.DataBind();

            #endregion

            #region 加载ddlTaskList

            LeadTaskList LeadTaskListMgr = new LeadTaskList();

            string sOrderBy = string.Empty;
            if (this.CurrUser.SortTaskPickList == "S")
            {
                sOrderBy = "SequenceNumber";
            }
            else
            {
                sOrderBy = "TaskName";
            }

            DataTable LeadTaskList1 = LeadTaskListMgr.GetLeadTaskList(" and Enabled=1", sOrderBy);

            DataRow NewTaskRow = LeadTaskList1.NewRow();
            NewTaskRow["TaskName"]       = "-- select --";
            NewTaskRow["SequenceNumber"] = 0;
            NewTaskRow["Enabled"]        = "True";
            LeadTaskList1.Rows.InsertAt(NewTaskRow, 0);

            this.ddlTaskList.DataSource = LeadTaskList1;
            this.ddlTaskList.DataBind();

            #endregion

            // set default value
            this.txtDueDate.Text = DateTime.Now.ToString("MM/dd/yyyy");


            this.txtDueTime.Text = System.DateTime.Now.AddHours(2).ToString("HH:mm");


            this.txtReminderUser.Text    = this.CurrUser.sLastName + ", " + this.CurrUser.sFirstName;
            this.hdnReminderUserID.Value = this.CurrUser.iUserID.ToString();
        }
    }
Ejemplo n.º 4
0
        private void BindControlDataSource()
        {
            Company_Lead_Sources bCompany_Lead_Sources = new Company_Lead_Sources();
            DataSet   dsLeadSources = bCompany_Lead_Sources.GetAllList();
            DataTable dtLS          = new DataTable();

            if (dsLeadSources != null && dsLeadSources.Tables[0].Rows.Count > 0)
            {
                dtLS = dsLeadSources.Tables[0];
            }
            if (!dtLS.Columns.Contains("LeadSourceID"))
            {
                dtLS.Columns.Add("LeadSourceID");
            }
            if (!dtLS.Columns.Contains("LeadSource"))
            {
                dtLS.Columns.Add("LeadSource");
            }
            DataRow drls = dtLS.NewRow();

            drls["LeadSourceID"] = "-1";
            drls["LeadSource"]   = "- select a Lead Source -";
            dtLS.Rows.InsertAt(drls, 0);
            ddlLeadSource.DataSource = dtLS;
            ddlLeadSource.DataBind();

            Branches  bBranches = new Branches();
            DataTable dtBH      = null;

            if (CurrUser.bIsCompanyExecutive || CurrUser.bIsDivisionExecutive || CurrUser.bIsRegionExecutive)
            {
                dtBH = bBranches.GetBranchFilter_Executive(CurrUser.iUserID, 0, 0);
            }
            else
            if (CurrUser.bIsBranchManager)
            {
                dtBH = bBranches.GetBranchFilter_Branch_Manager(CurrUser.iUserID, 0, 0);
            }
            else
            {
                dtBH = bBranches.GetBranchFilter(CurrUser.iUserID, 0, 0);
            }

            if (dtBH != null)
            {
                DataRow drbh = dtBH.NewRow();
                drbh["BranchId"] = "-1";
                drbh["Name"]     = "- select a Branch -";
                dtBH.Rows.InsertAt(drbh, 0);
                ddlBranch.DataSource = dtBH;
                ddlBranch.DataBind();
            }

            Users bUsers = new Users();

            if (CurrUser.bIsBranchUser)
            {
                DataTable dt = bUsers.GetUserBranchInfo(CurrUser.iUserID.ToString());
                if (dt.Rows.Count > 0)
                {
                    ddlBranch.SelectedValue = Convert.ToInt32(dt.Rows[0]["BranchID"]).ToString();
                    ddlBranch.Enabled       = false;
                }
            }

            DataTable dtLO = bUsers.GetUserList(string.Format("And RoleName='{0}' and UserId={1}", "Loan Officer", CurrUser.iUserID));

            if (dtLO.Rows.Count > 0)
            {
                //CurrentUser is Loan Officer
                if (!dtLO.Columns.Contains("LoanOfficer"))
                {
                    dtLO.Columns.Add("LoanOfficer");
                }
                ddlLoanOfficer.DataSource     = dtLO;
                ddlLoanOfficer.DataTextField  = "LoanOfficer";
                ddlLoanOfficer.DataValueField = "UserID";
                ddlLoanOfficer.SelectedValue  = CurrUser.iUserID.ToString();
                ddlLoanOfficer.DataBind();
                ddlLoanOfficer.Enabled = false;
            }
        }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 检查必要参数

        bool bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID);
        if (bIsValid == false)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", "");
        }
        this.iLoanID = Convert.ToInt32(this.Request.QueryString["LoanID"]);

        #endregion

        #region 加载Loan Info

        string    sSql3    = "select l.*, pf.FolderId, pf.Name as FileName from Loans l inner join PointFiles pf on l.FileId=pf.FileId where l.FileId=" + this.iLoanID;
        DataTable LoanInfo = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql3);
        if ((LoanInfo == null) || (LoanInfo.Rows.Count == 0))
        {
            PageCommon.WriteJsEnd(this, string.Format("No Loan Info found for LoanID {0}.", iLoanID), "");
        }

        int    FolderId = 0;
        string FileName = string.Empty;
        FolderId = LoanInfo.Rows[0]["FolderId"] == DBNull.Value ? 0 : (int)LoanInfo.Rows[0]["FolderId"];
        FileName = LoanInfo.Rows[0]["FileName"] == DBNull.Value ? string.Empty : (string)LoanInfo.Rows[0]["FileName"];
        if (FolderId < 1 || string.IsNullOrEmpty(FileName))
        {
            lnkImport.Visible = false;
        }

        #endregion

        #region 权限验证
        //try
        //{
        //    if (this.CurrUser.userRole.Prospect.ToString().IndexOf('B') == -1)
        //    {
        //        this.btnModify.Disabled = true;
        //    }
        //    if (this.CurrUser.userRole.Prospect.ToString().IndexOf('K') == -1)
        //    {
        //        this.btnSendEmail.Disabled = true;
        //    }
        //    if (this.CurrUser.userRole.Prospect.ToString().IndexOf('F') == -1)
        //    {
        //        this.btnDispose.Disabled = true;
        //    }
        //    if (this.CurrUser.userRole.Prospect.ToString().IndexOf('C') == -1)
        //    {
        //        btnDelete.Enabled = false;
        //    }
        //    if (this.CurrUser.userRole.Prospect.ToString().IndexOf('G') == -1)
        //    {
        //        btnSyncNow.Enabled = false;
        //    }
        //}
        //catch (Exception exception)
        //{
        //    LPLog.LogMessage(exception.Message);
        //}


        if (this.CurrUser.userRole.ExportClients == true)
        {
            this.btnvCardExport.Enabled = true;
        }
        else
        {
            this.btnvCardExport.Enabled = false;
        }

        #endregion

        this.GetPostBackEventReference(this.lnkExport);

        if (this.IsPostBack == false)
        {
            #region 加载Lead Source列表

            Company_Lead_Sources LeadSourceManager = new Company_Lead_Sources();
            DataTable            LeadSourceList    = LeadSourceManager.GetList("1=1 order by LeadSource").Tables[0];

            DataRow NewLeadSourceRow = LeadSourceList.NewRow();
            NewLeadSourceRow["LeadSourceID"] = DBNull.Value;
            NewLeadSourceRow["LeadSource"]   = "-- select --";

            LeadSourceList.Rows.InsertAt(NewLeadSourceRow, 0);

            this.ddlLeadSource.DataSource = LeadSourceList;
            this.ddlLeadSource.DataBind();

            #endregion

            #region 加载Program列表

            Company_Loan_Programs ProgramMgr  = new Company_Loan_Programs();
            DataTable             ProgramList = ProgramMgr.GetList("1=1 order by LoanProgram").Tables[0];

            DataRow NewProgramRow = ProgramList.NewRow();
            NewProgramRow["LoanProgramID"] = DBNull.Value;
            NewProgramRow["LoanProgram"]   = "-- select --";

            ProgramList.Rows.InsertAt(NewProgramRow, 0);

            this.ddlProgram.DataSource = ProgramList;
            this.ddlProgram.DataBind();

            #endregion

            #region 加载Borrower Info

            DataTable BorrowerInfo = this.GetBorrowerInfo(this.iLoanID);

            #region 绑定Borrower信息
            if (BorrowerInfo.Rows.Count > 0)
            {
                string sFirstName    = BorrowerInfo.Rows[0]["FirstName"].ToString();
                string sLastName     = BorrowerInfo.Rows[0]["LastName"].ToString();
                string sBorrowerName = sLastName + ", " + sFirstName;
                this.hProspectName.InnerText = sBorrowerName;
                this.txtFirstName.Text       = sFirstName;
                this.txtLastName.Text        = sLastName;

                this.txtEmail.Text     = BorrowerInfo.Rows[0]["Email"].ToString();
                this.txtCellPhone.Text = BorrowerInfo.Rows[0]["CellPhone"].ToString();
                this.txtHomePhone.Text = BorrowerInfo.Rows[0]["HomePhone"].ToString();
                this.txtWorkPhone.Text = BorrowerInfo.Rows[0]["BusinessPhone"].ToString();
                this.txtBirthday.Text  = BorrowerInfo.Rows[0]["DOB"].ToString() == "" ? "" : Convert.ToDateTime(BorrowerInfo.Rows[0]["DOB"]).ToString("MM/dd/yyyy");

                this.lbFirstName.Text = BorrowerInfo.Rows[0]["FirstName"].ToString();
                this.lbLastName.Text  = BorrowerInfo.Rows[0]["LastName"].ToString();
                this.lbEmail.Text     = BorrowerInfo.Rows[0]["Email"].ToString();
                this.lbCellPhone.Text = BorrowerInfo.Rows[0]["CellPhone"].ToString();
                this.lbHomePhone.Text = BorrowerInfo.Rows[0]["HomePhone"].ToString();
                this.lbWorkPhone.Text = BorrowerInfo.Rows[0]["BusinessPhone"].ToString();
                this.lbBirthday.Text  = BorrowerInfo.Rows[0]["DOB"].ToString() == "" ? "" : Convert.ToDateTime(BorrowerInfo.Rows[0]["DOB"]).ToString("MM/dd/yyyy");
            }
            #endregion

            if (BorrowerInfo.Rows.Count > 0)
            {
                string sContactID = BorrowerInfo.Rows[0]["ContactId"].ToString();


                #region 加载Prospect Info

                string    sSqlx0       = "select * from Prospect where ContactId=" + sContactID;
                DataTable ProspectInfo = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSqlx0);

                #region 绑定Prospect信息

                if (ProspectInfo.Rows.Count > 0)
                {
                    // Lead Source
                    if (ProspectInfo.Rows[0]["LeadSource"] != DBNull.Value)
                    {
                        this.ddlLeadSource.SelectedValue = ProspectInfo.Rows[0]["LeadSource"].ToString();

                        this.lbLeadSource.Text = ProspectInfo.Rows[0]["LeadSource"].ToString();
                    }

                    // Referral Source (Prospect.Referral)
                    if (ProspectInfo.Rows[0]["Referral"] != DBNull.Value)
                    {
                        int      iReferralID    = Convert.ToInt32(ProspectInfo.Rows[0]["Referral"]);
                        Contacts ContactManager = new Contacts();
                        this.txtReferralSource.Text = ContactManager.GetContactName(iReferralID);
                        this.hdnReferralID.Value    = iReferralID.ToString();

                        this.lbReferralSource.Text = ContactManager.GetContactName(iReferralID);
                    }
                }

                #endregion

                #endregion
            }
            #endregion

            #region 绑定Lead信息

            if (LoanInfo.Rows[0]["Purpose"] != DBNull.Value)
            {
                this.ddlPurpose.SelectedValue = LoanInfo.Rows[0]["Purpose"].ToString();

                this.lbPurpose.Text = LoanInfo.Rows[0]["Purpose"].ToString();
            }

            if (LoanInfo.Rows[0]["LoanType"] != DBNull.Value)
            {
                this.ddlType.SelectedValue = LoanInfo.Rows[0]["LoanType"].ToString();

                this.lbType.Text = LoanInfo.Rows[0]["LoanType"].ToString();
            }

            if (LoanInfo.Rows[0]["Program"] != DBNull.Value)
            {
                this.ddlProgram.SelectedValue = LoanInfo.Rows[0]["Program"].ToString();

                this.lbProgram.Text = LoanInfo.Rows[0]["Program"].ToString();
            }

            this.txtAmount.Text = LoanInfo.Rows[0]["LoanAmount"].ToString() == "" ? "" : Convert.ToDecimal(LoanInfo.Rows[0]["LoanAmount"]).ToString("n0");
            this.txtRate.Text   = LoanInfo.Rows[0]["Rate"].ToString() == "" ? "" : Convert.ToDecimal(LoanInfo.Rows[0]["Rate"]).ToString("n3");

            this.lbAmount.Text = LoanInfo.Rows[0]["LoanAmount"].ToString() == "" ? "" : Convert.ToDecimal(LoanInfo.Rows[0]["LoanAmount"]).ToString("n0");
            this.lbRate.Text   = LoanInfo.Rows[0]["Rate"].ToString() == "" ? "" : Convert.ToDecimal(LoanInfo.Rows[0]["Rate"]).ToString("n3") + "%";

            #endregion
        }

        #region Codes for Stage Progress Bar

        DataTable StageProgressData = this.GetStageProgressData(this.iLoanID);
        this.rptStageProgressItems.DataSource = StageProgressData;
        this.rptStageProgressItems.DataBind();

        #endregion

        #region 获取当前Point Folder的BranchID

        string    sSqlx        = "select b.BranchId,b.name from PointFiles as a inner join PointFolders as b on a.FolderId = b.FolderId where a.FileId=" + this.iLoanID;
        DataTable BranchIDInfo = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSqlx);
        if (BranchIDInfo.Rows.Count > 0 && BranchIDInfo.Rows[0]["BranchId"].ToString() != "" && BranchIDInfo.Rows[0]["BranchId"].ToString() != "0")
        {
            this.hdnBranchID.Value = BranchIDInfo.Rows[0]["BranchId"].ToString();
        }
        else
        {
            sSqlx = "select BranchID from Loans where FileId=" + this.iLoanID;
            DataTable dtLoan = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSqlx);
            if (dtLoan.Rows.Count > 0 && dtLoan.Rows[0]["BranchID"].ToString() != "" && dtLoan.Rows[0]["BranchID"].ToString() != "0")
            {
                this.hdnBranchID.Value = dtLoan.Rows[0]["BranchID"].ToString();
            }
            else
            {
                sSqlx = "SELECT TOP 1 BranchID FROM Groups WHERE GroupId IN(SELECT GroupID FROM GroupUsers WHERE UserID IN(SELECT UserId FROM LoanTeam WHERE FileId = " + this.iLoanID + " AND RoleId =(SELECT RoleId FROM Roles WHERE [Name]='Loan Officer')))";
                DataTable dtGroup = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSqlx);
                if (dtGroup.Rows.Count > 0 && dtGroup.Rows[0]["BranchID"].ToString() != "" && dtGroup.Rows[0]["BranchID"].ToString() != "0")
                {
                    this.hdnBranchID.Value = dtGroup.Rows[0]["BranchID"].ToString();
                }
            }
        }

        #endregion

        #region 加载Point File Info

        string    sSql7         = "Select top 1 * from dbo.lpvw_GetPointFileInfo where FileId=" + this.iLoanID;
        DataTable PointFileInfo = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql7);

        string sHasPointFile = "False";
        if (PointFileInfo.Rows.Count > 0)
        {
            string sPointFilePath = PointFileInfo.Rows[0]["Path"].ToString();
            string sFolderID      = PointFileInfo.Rows[0]["FolderId"].ToString();

            if (sPointFilePath != string.Empty || sFolderID != string.Empty)
            {
                sHasPointFile = "True";
            }
        }

        this.hdnHasPointFile.Value = sHasPointFile;

        #endregion

        #region Context Menu

        if (LoanInfo.Rows.Count > 0)
        {
            string sProspectLoanStatus = LoanInfo.Rows[0]["ProspectLoanStatus"].ToString();

            //加载 ArchiveLeadStatus

            ArchiveLeadStatus ArchiveLeadStatusMgr  = new ArchiveLeadStatus();
            DataSet           ArchiveLeadStatusList = ArchiveLeadStatusMgr.GetList("isnull([Enabled],0)=1 order by LeadStatusName");

            #region Build Sub Menu Item

            StringBuilder sbSubMenuItems = new StringBuilder();
            if (ArchiveLeadStatusList.Tables[0].Rows.Count > 0)
            {
                sbSubMenuItems.AppendLine("<ul>");
                foreach (DataRow dr in ArchiveLeadStatusList.Tables[0].Rows)
                {
                    string sLeadStatusName1 = dr["LeadStatusName"].ToString();
                    string sLeadStatusName2 = dr["LeadStatusName"].ToString().Replace("'", "\\'");
                    sbSubMenuItems.AppendLine("<li><a href=\"\" onclick=\"ChangeStatus('" + sLeadStatusName2 + "'); return false;\">" + sLeadStatusName1 + "</a></li>");
                }
                sbSubMenuItems.AppendLine("</ul>");
            }

            #endregion

            StringBuilder sbMenuItems = new StringBuilder();
            if (sProspectLoanStatus.ToLower() == "active")
            {
                sbMenuItems.AppendLine("<li><a href=\"\" onclick=\"return false;\">Archive</a>" + sbSubMenuItems + "</li>");
                sbMenuItems.AppendLine("<li><a href=\"\" onclick=\"ChangeStatus('Convert'); return false;\">Convert to Loan</a></li>");
            }

            this.ltrChangeStatusMenuItems.Text = sbMenuItems.ToString();
        }

        #endregion

        #region Actions

        LoanTasks LoanTasksMgr = new LoanTasks();

        DataTable LastTaskInfo = LoanTasksMgr.GetLoanTaskList(1, " and FileId=" + this.iLoanID + " and Completed is not null", " order by Completed desc");
        DataTable NextTaskInfo = LoanTasksMgr.GetLoanTaskList(1, " and FileId=" + this.iLoanID + " and Completed is null", " order by LoanTaskId asc");

        if (LastTaskInfo.Rows.Count == 0 && NextTaskInfo.Rows.Count == 0)
        {
            this.divActions.Visible = false;
        }
        else
        {
            if (LastTaskInfo.Rows.Count == 0)
            {
                this.trLastAction.Visible = false;
            }
            else
            {
                this.ltrLastTaskName.Text = LastTaskInfo.Rows[0]["Name"].ToString();
                this.ltrLastDueDate.Text  = LastTaskInfo.Rows[0]["Due"] == DBNull.Value ? string.Empty : Convert.ToDateTime(LastTaskInfo.Rows[0]["Due"].ToString()).ToLongDateString();
                this.ltrLastDueTime.Text  = LastTaskInfo.Rows[0]["DueTime"] == DBNull.Value ? string.Empty : TimeSpan.Parse(LastTaskInfo.Rows[0]["DueTime"].ToString()).ToString();
            }


            if (NextTaskInfo.Rows.Count == 0)
            {
                this.trNextAction.Visible = false;
            }
            else
            {
                this.ltrNextTaskName.Text = NextTaskInfo.Rows[0]["Name"].ToString();
                this.ltrNextDueDate.Text  = NextTaskInfo.Rows[0]["Due"] == DBNull.Value ? string.Empty : Convert.ToDateTime(NextTaskInfo.Rows[0]["Due"].ToString()).ToLongDateString();
                this.ltrNextDueTime.Text  = NextTaskInfo.Rows[0]["DueTime"] == DBNull.Value ? string.Empty : TimeSpan.Parse(NextTaskInfo.Rows[0]["DueTime"].ToString()).ToString();

                // hidden fields
                this.hdnNextTaskID.Value        = NextTaskInfo.Rows[0]["LoanTaskId"].ToString();
                this.hdnNextTaskOwnerID.Value   = NextTaskInfo.Rows[0]["Owner"].ToString();
                this.hdnLoginUserID.Value       = this.CurrUser.iUserID.ToString();
                this.hdnCompleteOtherTask.Value = this.CurrUser.userRole.MarkOtherTaskCompl == true ? "True" : "False";
                this.hdnLoanStatus.Value        = LoanInfo.Rows[0]["Status"].ToString();
            }
        }

        #endregion
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 检查页面参数

        // CloseDialogCodes
        bool bIsValid = PageCommon.ValidateQueryString(this, "CloseDialogCodes", QueryStringType.String);
        if (bIsValid == false)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", "window.parent.location.href=window.parent.location.href");
        }
        this.sCloseDialogCodes = this.Request.QueryString["CloseDialogCodes"].ToString() + ";";

        // RefreshCodes
        bIsValid = PageCommon.ValidateQueryString(this, "RefreshCodes", QueryStringType.String);
        if (bIsValid == false)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", "window.parent.location.href=window.parent.location.href");
        }
        this.sRefreshCodes = this.Request.QueryString["RefreshCodes"].ToString() + ";";
        if (PageCommon.ValidateQueryString(this, "RefreshCodes", QueryStringType.String))
        {
            this.sRefreshTabCodes = this.Request.QueryString["RefreshTab"].ToString().Trim() == "" ? "" : (this.Request.QueryString["RefreshTab"].ToString().Trim() + ";");
        }

        // ProspectID
        bIsValid = PageCommon.ValidateQueryString(this, "ProspectID", QueryStringType.ID);
        if (bIsValid == false)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", this.sCloseDialogCodes);
        }
        this.iProspectID = Convert.ToInt32(this.Request.QueryString["ProspectID"]);

        #endregion

        //权限验证
        if (_curLoginUser.userRole.Prospect.ToString().IndexOf('H') == -1) // UpdatePoint
        {
            btnUpdatePoint.Enabled = false;
        }

        #region 加载Contact信息

        Contacts  ContactManager = new Contacts();
        DataTable ContactInfo    = null;
        try
        {
            ContactInfo = ContactManager.GetContactInfo(this.iProspectID);
        }
        catch (Exception ex)
        {
            string sExMsg = string.Format("Exception happened when get contact info (ContactID={0}): {1}", this.iProspectID, ex.Message);
            LPLog.LogMessage(LogType.Logerror, ex.Message);
            PageCommon.WriteJsEnd(this, "Exception happened when get contact info.", this.sCloseDialogCodes);
        }

        if (ContactInfo.Rows.Count == 0)
        {
            PageCommon.WriteJsEnd(this, "Invalid contact id.", this.sCloseDialogCodes);
        }

        #endregion

        #region 加载Prospect信息

        Prospect  ProspectManager = new Prospect();
        DataTable ProspectInfo    = null;
        try
        {
            ProspectInfo = ProspectManager.GetProspectInfo(this.iProspectID);
        }
        catch (Exception ex)
        {
            string sExMsg = string.Format("Exception happened when get prospect info (ContactID={0}): {1}", this.iProspectID, ex.Message);
            LPLog.LogMessage(LogType.Logerror, ex.Message);
            PageCommon.WriteJsEnd(this, "Exception happened when get prospect info.", this.sCloseDialogCodes);
        }

        if (ProspectInfo.Rows.Count == 0)
        {
            PageCommon.WriteJsEnd(this, "Invalid prospect id.", this.sCloseDialogCodes);
        }



        #region 加载Create By

        Users  UserManager = new Users();
        string sCreatedBy  = ProspectInfo.Rows[0]["CreatedBy"].ToString();
        int    iCreatedBy  = 0; //Convert.ToInt32(sCreatedBy);

        if (sCreatedBy != string.Empty)
        {
            iCreatedBy = Convert.ToInt32(sCreatedBy);
            DataTable CreatedByInfo = UserManager.GetUserInfo(iCreatedBy);
            if (CreatedByInfo.Rows.Count == 0)
            {
                this.lbCreatedBy.Text = string.Empty;
            }
            else
            {
                this.lbCreatedBy.Text = CreatedByInfo.Rows[0]["LastName"].ToString() + ", " + CreatedByInfo.Rows[0]["FirstName"].ToString();
            }
        }
        else
        {
            this.lbCreatedBy.Text = string.Empty;
        }

        #endregion

        #region 加载Create By

        string sModifiedBy = ProspectInfo.Rows[0]["ModifiedBy"].ToString();

        if (sModifiedBy != string.Empty)
        {
            DataTable ModifiedByInfo = UserManager.GetUserInfo(Convert.ToInt32(sModifiedBy));
            if (ModifiedByInfo.Rows.Count == 0)
            {
                this.lbModifiedBy.Text = string.Empty;
            }
            else
            {
                this.lbModifiedBy.Text = ModifiedByInfo.Rows[0]["LastName"].ToString() + ", " + ModifiedByInfo.Rows[0]["FirstName"].ToString();
            }
        }
        else
        {
            this.lbModifiedBy.Text = string.Empty;
        }

        #endregion

        #endregion

        // Old Status
        this.hdnOldStatus.Value = ProspectInfo.Rows[0]["Status"].ToString();

        if (this.IsPostBack == false)
        {
            USStates.Init(ddlState);
            #region 加载Loan Officer列表

            DataTable LoanOfficerList = this.GetLoanOfficerList(iCreatedBy);
            this.ddlLoanOfficer.DataSource = LoanOfficerList;
            this.ddlLoanOfficer.DataBind();

            #endregion

            #region 加载Lead Source列表

            Company_Lead_Sources LeadSourceManager = new Company_Lead_Sources();
            DataTable            LeadSourceList    = LeadSourceManager.GetList("1=1 order by LeadSource").Tables[0];

            DataRow NewLeadSourceRow = LeadSourceList.NewRow();
            NewLeadSourceRow["LeadSourceID"] = DBNull.Value;
            NewLeadSourceRow["LeadSource"]   = "-- select --";

            LeadSourceList.Rows.InsertAt(NewLeadSourceRow, 0);

            this.ddlLeadSource.DataSource = LeadSourceList;
            this.ddlLeadSource.DataBind();

            #endregion

            #region 绑定Prospect数据

            // Loan Officer
            this.ddlLoanOfficer.SelectedValue = ProspectInfo.Rows[0]["LoanOfficer"].ToString();

            hfLoanOfficer.Value          = ProspectInfo.Rows[0]["LoanOfficer"].ToString();
            this.txtRefCode.Text         = ProspectInfo.Rows[0]["ReferenceCode"].ToString();
            this.ddlStatus.SelectedValue = ProspectInfo.Rows[0]["Status"].ToString();
            ListItem item = this.ddlCreditRanking.Items.FindByValue(string.Format("{0}", ProspectInfo.Rows[0]["CreditRanking"]));
            if (null != item)
            {
                this.ddlCreditRanking.ClearSelection();
                item.Selected = true;
            }
            item = this.ddlPreferredContact.Items.FindByValue(string.Format("{0}", ProspectInfo.Rows[0]["PreferredContact"]));
            if (null != item)
            {
                this.ddlPreferredContact.ClearSelection();
                item.Selected = true;
            }
            this.ddlLeadSource.SelectedValue = ProspectInfo.Rows[0]["LeadSource"].ToString();

            this.lbCreatedOn.Text = ProspectInfo.Rows[0]["Created"].ToString();

            this.lbModifiedOn.Text = ProspectInfo.Rows[0]["Modifed"].ToString();

            //Get referral contact name
            int iReferralId = 0;
            if (ProspectInfo.Rows[0]["Referral"].ToString() != "" && int.TryParse(ProspectInfo.Rows[0]["Referral"].ToString(), out iReferralId))
            {
                this.txbReferral.Text    = ContactManager.GetContactName(iReferralId);
                this.hdnReferralID.Value = iReferralId.ToString();
            }

            #endregion

            #region 绑定Contact数据

            this.txtFirstName.Text      = ContactInfo.Rows[0]["FirstName"].ToString();
            this.txtMiddleName.Text     = ContactInfo.Rows[0]["MiddleName"].ToString();
            this.txtLastName.Text       = ContactInfo.Rows[0]["LastName"].ToString();
            this.ddlTitle.SelectedValue = ContactInfo.Rows[0]["Title"].ToString();
            this.txtGenerationCode.Text = ContactInfo.Rows[0]["GenerationCode"].ToString();
            this.txtSSN.Text            = ContactInfo.Rows[0]["SSN"].ToString();
            this.txtHomePhone.Text      = ContactInfo.Rows[0]["HomePhone"].ToString();
            this.txtCellPhone.Text      = ContactInfo.Rows[0]["CellPhone"].ToString();
            this.txtBizPhone.Text       = ContactInfo.Rows[0]["BusinessPhone"].ToString();
            this.txtFax.Text            = ContactInfo.Rows[0]["Fax"].ToString();
            this.txtAddress.Text        = ContactInfo.Rows[0]["MailingAddr"].ToString();
            this.txtCity.Text           = ContactInfo.Rows[0]["MailingCity"].ToString();
            this.ddlState.SelectedValue = ContactInfo.Rows[0]["MailingState"].ToString();
            this.txtZip.Text            = ContactInfo.Rows[0]["MailingZip"].ToString();
            this.txtEmail.Text          = ContactInfo.Rows[0]["Email"].ToString();
            if (ContactInfo.Rows[0]["DOB"] == DBNull.Value)
            {
                this.txtDOB.Text = string.Empty;
            }
            else
            {
                this.txtDOB.Text = Convert.ToDateTime(ContactInfo.Rows[0]["DOB"]).ToShortDateString();
            }
            this.txtExperianScore.Text  = ContactInfo.Rows[0]["Experian"].ToString();
            this.txtTransUnitScore.Text = ContactInfo.Rows[0]["TransUnion"].ToString();
            this.txtEquifaxScore.Text   = ContactInfo.Rows[0]["Equifax"].ToString();



            #endregion
        }
    }