コード例 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.LoanContacts> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.LoanContacts> modelList = new List <LPWeb.Model.LoanContacts>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.LoanContacts model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.LoanContacts();
                    if (dt.Rows[n]["FileId"].ToString() != "")
                    {
                        model.FileId = int.Parse(dt.Rows[n]["FileId"].ToString());
                    }
                    if (dt.Rows[n]["ContactRoleId"].ToString() != "")
                    {
                        model.ContactRoleId = int.Parse(dt.Rows[n]["ContactRoleId"].ToString());
                    }
                    if (dt.Rows[n]["ContactId"].ToString() != "")
                    {
                        model.ContactId = int.Parse(dt.Rows[n]["ContactId"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (this.CurrentFileId == 0)
        {
            return;
        }
        int ContactID = 0;

        LPWeb.Model.Contacts model = new LPWeb.Model.Contacts();
        try
        {
            ContactID = int.Parse(hfdContactID.Value);
            Contacts contact = new Contacts();
            model = contact.GetModel(ContactID);
        }
        catch
        { }

        ServiceManager sm = new ServiceManager();

        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            ReassignContactRequest req = new ReassignContactRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = CurrentUser.iUserID;
            ReassignContactInfo        cInfo = new ReassignContactInfo();
            List <ReassignContactInfo> cList = new List <ReassignContactInfo>();
            cInfo.FileId        = this.CurrentFileId;//todo:check dummy data
            cInfo.ContactRoleId = int.Parse(ddlContactRole.SelectedValue);
            cInfo.NewContactId  = ContactID;
            cList.Add(cInfo);
            req.reassignContacts = cList.ToArray();
            ReassignContactResponse respone = null;
            try
            {
                respone = service.ReassignContact(req);
                if (respone.hdr.Successful)
                {
                    LPWeb.Model.LoanContacts lcModel = new LPWeb.Model.LoanContacts();
                    lcModel.FileId        = CurrentFileId;
                    lcModel.ContactRoleId = cInfo.ContactRoleId;
                    lcModel.ContactId     = ContactID;

                    LPWeb.Model.LoanContacts oldlcModel = new LPWeb.Model.LoanContacts();
                    oldlcModel.FileId        = CurrentFileId;
                    oldlcModel.ContactRoleId = oldRoleID;
                    oldlcModel.ContactId     = oldContactID;

                    LPWeb.BLL.LoanContacts lc = new LoanContacts();

                    lc.Reassign(oldlcModel, lcModel, req.hdr.UserId);
                    try
                    {
                        PageCommon.WriteJsEnd(this, "Reassigned contact successfully", PageCommon.Js_RefreshParent);
                    }
                    catch
                    { }
                }
                else
                {
                    try
                    {
                        PageCommon.WriteJsEnd(this, String.Format("Failed to reassign contact: reason: {0}.", respone.hdr.StatusInfo), PageCommon.Js_RefreshSelf);
                    }
                    catch
                    { }
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                LPLog.LogMessage(ex.Message);
                PageCommon.WriteJsEnd(this, "Failed to reassign contact: reason, Point Manager is not running. ", PageCommon.Js_RefreshSelf);
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);
                PageCommon.WriteJsEnd(this, String.Format("Failed to reassign contact, reason: {0}", exception.Message), PageCommon.Js_RefreshSelf);
            }
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // json示例
        // {"ExecResult":"Success","ErrorMsg":""}
        // {"ExecResult":"Failed","ErrorMsg":"错误信息"}

        int iFileID        = 0;
        int iContactID     = 0;
        int iContactRoleID = 0;

        int iCurrrentUserID = this.CurrUser.iUserID;

        #region 校验页面参数

        bool bIsValid = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            this.Response.End();
        }
        string sFileID = this.Request.QueryString["FileID"];
        iFileID = Convert.ToInt32(sFileID);

        bIsValid = PageCommon.ValidateQueryString(this, "ContactID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            this.Response.End();
        }
        string sContactID = this.Request.QueryString["ContactID"];
        iContactID = Convert.ToInt32(sContactID);

        bIsValid = PageCommon.ValidateQueryString(this, "ContactRoleID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"Missing required query string.\"}");
            this.Response.End();
        }
        string sContactRoleID = this.Request.QueryString["ContactRoleID"];
        iContactRoleID = Convert.ToInt32(sContactRoleID);

        #endregion

        #region 调用ReassignContact

        ServiceManager sm = new ServiceManager();
        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            #region Build ReassignContactRequest

            ReassignContactRequest req = new ReassignContactRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = this.CurrUser.iUserID;

            List <ReassignContactInfo> ContactList = new List <ReassignContactInfo>();

            ReassignContactInfo ContactInfo = new ReassignContactInfo();
            ContactInfo.FileId        = iFileID;
            ContactInfo.ContactRoleId = iContactRoleID;
            ContactInfo.NewContactId  = iContactID;
            ContactList.Add(ContactInfo);

            req.reassignContacts = ContactList.ToArray();

            #endregion

            #region invoke ReassignContact

            bool   bSuccess = false;
            string sError   = string.Empty;
            try
            {
                ReassignContactResponse respone = service.ReassignContact(req);
                bSuccess = respone.hdr.Successful;

                if (bSuccess == false)
                {
                    sError = "Failed to assign contact, reason:" + respone.hdr.StatusInfo;
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                bSuccess = false;
                sError   = "Failed to assign contact: Point Manager is not running.";

                LPLog.LogMessage(ex.Message);
            }
            catch (Exception exception)
            {
                bSuccess = false;
                sError   = "Failed to assign contact. Exception: " + exception.Message;

                LPLog.LogMessage(exception.Message);
            }
            finally
            {
                if (bSuccess == false)
                {
                    this.Response.Write("{\"ExecResult\":\"Failed\",\"ErrorMsg\":\"" + sError + "\"}");
                    this.Response.End();
                }
            }

            #endregion
        }

        #endregion

        #region Reassign Loan Contact

        LPWeb.Model.LoanContacts lcModel = new LPWeb.Model.LoanContacts();
        lcModel.FileId        = iFileID;
        lcModel.ContactRoleId = iContactRoleID;
        lcModel.ContactId     = iContactID;

        LPWeb.Model.LoanContacts oldlcModel = new LPWeb.Model.LoanContacts();
        oldlcModel.FileId        = iFileID;
        oldlcModel.ContactRoleId = 0;
        oldlcModel.ContactId     = 0;

        LPWeb.BLL.LoanContacts LoanContacts1 = new LPWeb.BLL.LoanContacts();
        LoanContacts1.Reassign(oldlcModel, lcModel, iCurrrentUserID);

        #endregion

        this.Response.Write("{\"ExecResult\":\"Success\",\"ErrorMsg\":\"\"}");
        this.Response.End();
    }
コード例 #4
0
    private int Save_LoanDetail()
    {
        ReassignProspect();

        #region gdc crm33
        int    iContactCoBoId = string.IsNullOrEmpty(hdnCoBorrowerID.Value) ? 0 : Convert.ToInt32(hdnCoBorrowerID.Value);
        string CBname         = txtCBFirstname.Text + txtCBMiddlename.Text + txtCBLastname.Text;

        if ((CBname != hdnCoBorrowerName.Value.Trim() || iContactCoBoId == 0) && !string.IsNullOrEmpty(CBname))
        {
            LPWeb.Model.Contacts contactRecCoBo = new LPWeb.Model.Contacts();
            Contacts             contactsbll    = new Contacts();//gdc crm33
            contactRecCoBo.ContactId  = 0;
            contactRecCoBo.FirstName  = txtCBFirstname.Text.Trim();
            contactRecCoBo.MiddleName = txtCBMiddlename.Text.Trim();
            contactRecCoBo.LastName   = txtCBLastname.Text.Trim();

            iContactCoBoId = contactsbll.AddClient(contactRecCoBo);//gdc crm33

            #region CoBo to loanContacts  gdc crm33
            LPWeb.BLL.LoanContacts loanContactsBll = new LoanContacts();


            LPWeb.BLL.ContactRoles contactRolesbll = new ContactRoles();
            int contactRoleID   = 0;
            var contactRoleList = contactRolesbll.GetModelList(" Name = 'CoBorrower' ");
            if (contactRoleList != null && contactRoleList.Count > 0 && contactRoleList.FirstOrDefault() != null)
            {
                contactRoleID = contactRoleList.FirstOrDefault().ContactRoleId;
            }

            if (contactRoleID != 0)
            {
                LPWeb.Model.LoanContacts loanContactModel = new LPWeb.Model.LoanContacts();
                loanContactModel.FileId        = iFileID;
                loanContactModel.ContactRoleId = contactRoleID;
                loanContactModel.ContactId     = iContactCoBoId;

                loanContactsBll.Add(loanContactModel);
            }

            #endregion
        }
        #endregion

        LPWeb.Model.LoanDetails model = new LPWeb.Model.LoanDetails();
        model.FileId = iFileID;
        if (ddlBorrower.Items.Count < 1)
        {
            model.BoID = 0;
        }
        else
        {
            model.BoID = int.Parse(ddlBorrower.SelectedValue);
        }
        //if (ddlCoBorrower.Items.Count < 1)
        //{
        //    model.CoBoID = 0;
        //}
        //else
        //{
        //    model.CoBoID = int.Parse(ddlCoBorrower.SelectedValue);
        //}

        if (iContactCoBoId != 0)
        {
            model.CoBoID = iContactCoBoId;
        }


        model.Created    = DateTime.Now;
        model.CreatedBy  = loginUser.iUserID;
        model.Modifed    = DateTime.Now;
        model.ModifiedBy = loginUser.iUserID;
        if (txbAmount.Text.Trim().Length < 1)
        {
            model.LoanAmount = 0;
        }
        else
        {
            model.LoanAmount = decimal.Parse(txbAmount.Text.Trim());
        }

        if (txbEstimatedDate.Text.Trim().Length > 5)
        {
            model.EstCloseDate = DateTime.Parse(txbEstimatedDate.Text.Trim());
        }
        else
        {
            model.EstCloseDate = DateTime.Parse("1900-1-1");
        }
        if (ddlRanking.SelectedIndex >= 0)
        {
            model.Ranking = ddlRanking.SelectedValue;
        }
        model.UserId = CurrUser.iUserID;
        if (ddlLoanOfficer.Items.Count < 1)
        {
            model.LoanOfficerId = 0;
        }
        else
        {
            model.LoanOfficerId = int.Parse(ddlLoanOfficer.SelectedValue);
        }
        if (txbInterestRate.Text.Trim().Length < 1)
        {
            model.Rate = 0;
        }
        else
        {
            model.Rate = decimal.Parse(txbInterestRate.Text.Trim());
        }

        if (ddlLoanProgram.SelectedIndex == 0)
        {
            model.Program = "";
        }
        else
        {
            model.Program = ddlLoanProgram.SelectedItem.Text;
        }
        if (ddlPurpose.SelectedIndex == 0)
        {
            model.Purpose = "";
        }
        else
        {
            model.Purpose = ddlPurpose.SelectedItem.Text.Trim();
        }

        model.Lien          = ddlLienPosition.SelectedItem.Value.Trim();
        model.PropertyAddr  = txbPropertyAddress.Text.Trim();
        model.PropertyCity  = txbCity.Text.Trim();
        model.PropertyState = ddlState.SelectedValue;
        model.PropertyZip   = txbZip.Text.Trim();
        if (ddlPointFolder.Items.Count < 1)
        {
            model.FolderId = 0;
        }
        else
        {
            model.FolderId = int.Parse(ddlPointFolder.SelectedValue);
        }
        model.FileName           = txbPointFileName.Text.Trim();
        model.Status             = "Prospect";
        model.ProspectLoanStatus = "Active";

        model.PropertyType   = txbPropetyType.Text.Trim();
        model.HousingStatus  = txbHousingStatus.Text.Trim();
        model.IncludeEscrows = cbIncludeEscrows.Checked;
        model.InterestOnly   = cbInterestOnly.Checked;
        model.RentAmount     = string.IsNullOrEmpty(txbRentAmount.Text.Trim()) ? 0 : Convert.ToDecimal(txbRentAmount.Text.Trim());
        model.CoborrowerType = txbCoborrowerType.Text.Trim();
        iFileID = loan.LoanDetailSaveFileId(model);


        #region Referral
        LPWeb.Model.Prospect modelProspect = new LPWeb.Model.Prospect();

        LPWeb.BLL.Prospect bllProspect = new Prospect();
        modelProspect = bllProspect.GetModel(iContactID);

        modelProspect.LeadSource = ddlLeadSource.SelectedValue; //gdc CR40

        int referralIDNew = string.IsNullOrEmpty(hdnReferralID.Value.Trim()) ? 0 : Convert.ToInt32(hdnReferralID.Value.Trim());

        if (referralIDNew > 0 && referralIDNew.ToString() != modelProspect.Referral.ToString())
        {
            int referralIDOld = modelProspect.Referral == null ? 0 : Convert.ToInt32(modelProspect.Referral);

            modelProspect.Referral = referralIDNew;

            #region Referral to loanContacts  gdc crm33
            LPWeb.BLL.LoanContacts loanContactsBll = new LoanContacts();

            LPWeb.BLL.ContactRoles contactRolesbll = new ContactRoles();
            int refrralRoleID    = 0;
            var referralRoleList = contactRolesbll.GetModelList(" Name = 'Referral' ");
            if (referralRoleList != null && referralRoleList.Count > 0 && referralRoleList.FirstOrDefault() != null)
            {
                refrralRoleID = referralRoleList.FirstOrDefault().ContactRoleId;
            }

            if (refrralRoleID != 0)
            {
                LPWeb.Model.LoanContacts loanContactModel = new LPWeb.Model.LoanContacts();
                loanContactModel.FileId        = iFileID;
                loanContactModel.ContactRoleId = refrralRoleID;
                loanContactModel.ContactId     = referralIDNew;

                loanContactsBll.Add(loanContactModel);
            }

            #endregion


            #region Del Old loanContacts

            try
            {
                if (referralIDOld > 0)
                {
                    loanContactsBll.Delete(iFileID, refrralRoleID, referralIDOld);
                }
            }
            catch { }

            #endregion
        }

        bllProspect.Update(modelProspect); //gdc CR40

        #endregion

        return(iFileID);
    }
コード例 #5
0
    protected void btnSelect_Click(object sender, EventArgs e)
    {
        int iNewContactID = Convert.ToInt32(this.hdnSelContactID.Value);

        #region 加载LoanContacts

        string    sSql       = "select * from LoanContacts where ContactID=" + this.iDelContactID;
        DataTable RefLoanIDs = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql);

        #endregion

        #region 调用PointManager.ReassignContactRequest

        ServiceManager sm = new ServiceManager();
        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            #region Build ReassignContactRequest

            ReassignContactRequest req = new ReassignContactRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = this.CurrUser.iUserID;

            List <ReassignContactInfo> ContactList = new List <ReassignContactInfo>();
            foreach (DataRow RefLoanRow in RefLoanIDs.Rows)
            {
                int iFileID        = Convert.ToInt32(RefLoanRow["FileId"]);
                int iContactRoleID = Convert.ToInt32(RefLoanRow["ContactRoleId"]);

                ReassignContactInfo ContactInfo = new ReassignContactInfo();
                ContactInfo.FileId        = iFileID;
                ContactInfo.ContactRoleId = iContactRoleID;
                ContactInfo.NewContactId  = iNewContactID;
                ContactList.Add(ContactInfo);
            }
            req.reassignContacts = ContactList.ToArray();

            #endregion

            ReassignContactResponse respone = null;
            try
            {
                respone = service.ReassignContact(req);

                if (respone.hdr.Successful)
                {
                    foreach (DataRow RefLoanRow in RefLoanIDs.Rows)
                    {
                        int iFileID        = Convert.ToInt32(RefLoanRow["FileId"]);
                        int iContactRoleID = Convert.ToInt32(RefLoanRow["ContactRoleId"]);

                        #region Reassign Loan Contact

                        LPWeb.Model.LoanContacts lcModel = new LPWeb.Model.LoanContacts();
                        lcModel.FileId        = iFileID;
                        lcModel.ContactRoleId = iContactRoleID;
                        lcModel.ContactId     = iNewContactID;

                        LPWeb.Model.LoanContacts oldlcModel = new LPWeb.Model.LoanContacts();
                        oldlcModel.FileId        = iFileID;
                        oldlcModel.ContactRoleId = iContactRoleID;
                        oldlcModel.ContactId     = this.iDelContactID;

                        LPWeb.BLL.LoanContacts lc = new LoanContacts();
                        lc.Reassign(oldlcModel, lcModel, req.hdr.UserId);

                        #endregion

                        #region delete contact

                        Contacts bllContact = new Contacts();
                        int      iUserType  = 0;
                        if (this.CurrUser.bIsCompanyExecutive)
                        {
                            iUserType = 0;
                        }
                        else if (this.CurrUser.bIsBranchManager)
                        {
                            iUserType = 1;
                        }
                        else
                        {
                            iUserType = 2;
                        }
                        bllContact.PartnerContactsDelete(this.iDelContactID, CurrUser.iUserID, iUserType);

                        #endregion
                    }

                    PageCommon.WriteJsEnd(this, "Deleted contact successfully", PageCommon.Js_RefreshParent);
                }
                else
                {
                    PageCommon.WriteJsEnd(this, String.Format("Failed to reassign contact: reason: {0}.", respone.hdr.StatusInfo), PageCommon.Js_RefreshSelf);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ex)
            {
                LPLog.LogMessage(ex.Message);
                PageCommon.WriteJsEnd(this, "Failed to reassign contact: reason, Point Manager is not running. ", PageCommon.Js_RefreshSelf);
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);
                PageCommon.WriteJsEnd(this, String.Format("Failed to reassign contact, reason: {0}", exception.Message), PageCommon.Js_RefreshSelf);
            }
        }

        #endregion
    }
コード例 #6
0
 public void Reassign(LPWeb.Model.LoanContacts oldModel, LPWeb.Model.LoanContacts model, int UserId)
 {
     dal.Reassign(oldModel, model, UserId);
 }
コード例 #7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LPWeb.Model.LoanContacts model)
 {
     dal.Update(model);
 }
コード例 #8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(LPWeb.Model.LoanContacts model)
 {
     dal.Add(model);
 }