Пример #1
0
        /// <summary>
        ///  Import LoanContacts
        /// </summary>
        /// <param name="iFileId"></param>
        /// <param name="iContactID"></param>
        /// <param name="RoleID"></param>
        private void ImportLoanContacts(int iFileId, int iContactID, int RoleID)
        {
            LoanContacts bLoanContacts = new LoanContacts();

            Model.LoanContacts mLoanContacts = new Model.LoanContacts();
            mLoanContacts.FileId        = iFileId;
            mLoanContacts.ContactId     = iContactID;
            mLoanContacts.ContactRoleId = RoleID;
            bLoanContacts.Add(mLoanContacts);
        }
Пример #2
0
        /// <summary>
        /// Link button click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnLink_Click(object sender, EventArgs e)
        {
            string sLoanIds  = this.hdLoanIds.Value;
            string sLinkType = this.hdLinkType.Value;
            int    iLinkType = 1;

            if (sLoanIds.Length < 1)
            {
                return;
            }

            try
            {
                LPWeb.BLL.ContactRoles contactRoles = new LPWeb.BLL.ContactRoles();
                DataSet dsRole = contactRoles.GetList("Name='" + sLinkType + "'");
                if (dsRole.Tables.Count > 0 && dsRole.Tables[0].Rows.Count > 0)
                {
                    iLinkType = Convert.ToInt32(dsRole.Tables[0].Rows[0]["ContactRoleId"].ToString());
                }
                LPWeb.BLL.LoanContacts loanContact = new LPWeb.BLL.LoanContacts();
                foreach (string sLoanID in sLoanIds.Split(','))
                {
                    if (sLoanID.Trim() == "")
                    {
                        continue;
                    }
                    int iLoanID       = 0;
                    int iOldContactID = 0;
                    if (sLoanID == "" || Int32.TryParse(sLoanID, out iLoanID) == false)
                    {
                        continue;
                    }
                    DataSet dsloancontact = loanContact.GetList("FileId=" + sLoanID + " AND ContactRoleId=" + iLinkType.ToString());
                    if (dsloancontact.Tables.Count > 0 && dsloancontact.Tables[0].Rows.Count > 0)
                    {
                        iOldContactID = Convert.ToInt32("0" + dsloancontact.Tables[0].Rows[0]["ContactId"].ToString());
                    }
                    LPWeb.Model.LoanContacts modelOld = loanContact.GetModel(iLoanID, iLinkType, iOldContactID);
                    if (modelOld == null)
                    {
                        modelOld           = new Model.LoanContacts();
                        modelOld.ContactId = 0;
                    }
                    LPWeb.Model.LoanContacts model = new LPWeb.Model.LoanContacts();
                    model.FileId        = iLoanID;
                    model.ContactRoleId = iLinkType;
                    model.ContactId     = this.iProspectID;
                    loanContact.Reassign(modelOld, model, 0);

                    ServiceManager sm = new ServiceManager();
                    using (LP2ServiceClient service = sm.StartServiceClient())
                    {
                        UpdateBorrowerRequest req = new UpdateBorrowerRequest();
                        req.hdr = new ReqHdr();
                        req.hdr.SecurityToken = "SecurityToken";
                        req.hdr.UserId        = this.CurrUser.iUserID;
                        req.ContactId         = model.ContactId;

                        UpdateBorrowerResponse respone = null;

                        try
                        {
                            respone = service.UpdateBorrower(req);
                        }
                        catch (System.ServiceModel.EndpointNotFoundException)
                        {
                            string sExMsg = string.Format("Exception happened when  Update loan (ContactId={0}): {1}", model.ContactId, "Point Manager is not running.");
                            LPLog.LogMessage(LogType.Logerror, sExMsg);
                        }
                        catch (Exception ex)
                        {
                            string sExMsg = string.Format("Exception happened when  Update loan (ContactId={0}): {1}", model.ContactId, ex.Message);
                            LPLog.LogMessage(LogType.Logerror, sExMsg);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LPLog.LogMessage(LogType.Logdebug, ex.ToString());
                PageCommon.WriteJsEnd(this, "Failed to link the selected loans.", this.sCloseDialogCodes + this.sRefreshCodes);
            }

            this.hdLoanIds.Value  = string.Empty;
            this.hdLinkType.Value = string.Empty;

            // success
            PageCommon.WriteJsEnd(this, "Link the selected loans successfully.", this.sCloseDialogCodes + this.sRefreshCodes);
        }