コード例 #1
0
    protected void btnSyncNow_Click(object sender, EventArgs e)
    {
        if (lbPointFile.Text.Trim().Length <= 0 || System.IO.Path.GetFileName(lbPointFile.Text.Trim()).Length <= 0)
        {
            PageCommon.WriteJsEnd(this, "Cannot sync with Point, missing Point filename.", PageCommon.Js_RefreshSelf);
            return;
        }

        LPWeb.BLL.Company_Point bllCompanyPoint = new Company_Point();
        var    modCompayPoint = bllCompanyPoint.GetModel();
        string MasterSource   = modCompayPoint != null ? modCompayPoint.MasterSource : "Point";

        if (MasterSource.ToUpper() == "DataTrac".ToUpper() && sStatus.ToUpper() == "Processing".ToUpper())
        {
            PageCommon.WriteJsEnd(this, "Cannot sync an Active Loan with Point while the master data source is DataTrac.", PageCommon.Js_RefreshSelf);
            return;
        }

        ServiceManager sm = new ServiceManager();

        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            ImportLoansRequest req = new ImportLoansRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = this.CurrUser.iUserID;
            req.FileIds           = new int[1] {
                this.iLoanID
            };
            ImportLoansResponse respone = null;
            try
            {
                respone = service.ImportLoans(req);

                if (respone.hdr.Successful)
                {
                    PageCommon.WriteJsEnd(this, "Synched point file successfully.", PageCommon.Js_RefreshSelf);
                }
                else
                {
                    PageCommon.WriteJsEnd(this, "Failed to sync Point file, reason:" + respone.hdr.StatusInfo, PageCommon.Js_RefreshSelf);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                string sExMsg = string.Format("Exception happened when Sync Point File (FileID={0}): {1}", this.iLoanID, "Point Manager is not running.");
                LPLog.LogMessage(LogType.Logerror, sExMsg);
                PageCommon.WriteJsEnd(this, sExMsg, PageCommon.Js_RefreshSelf);
            }
            catch (Exception ex)
            {
                string sExMsg = string.Format("Exception happened when Sync Point File (FileID={0}): {1}", this.iLoanID, ex.Message);
                LPLog.LogMessage(LogType.Logerror, sExMsg);
                PageCommon.WriteJsEnd(this, sExMsg, PageCommon.Js_RefreshSelf);
            }
        }
    }
コード例 #2
0
ファイル: Service.cs プロジェクト: PulseCRM/Pulse
        public ImportLoansResponse ImportLoans(ImportLoansRequest req)
        {
            ImportLoansResponse resp = new ImportLoansResponse();

            resp.hdr            = new RespHdr();
            resp.hdr.Successful = true;

            return(resp);
        }
コード例 #3
0
    protected void btnSyncNow_Click(object sender, EventArgs e)
    {
        ImportLoansResponse respone = null;

        try
        {
            LPWeb.BLL.Loans loanMgr  = new LPWeb.BLL.Loans();
            string          sWhere   = " FileId IN(SELECT FileId FROM LoanContacts WHERE (ContactRoleId = 1 OR ContactRoleId = 2) AND ContactId = " + this.iContactID + ")";
            DataSet         ds       = loanMgr.GetList(sWhere);
            string          sFileIds = "";
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                sFileIds += (sFileIds == "") ? dr["FileId"].ToString() : ("," + dr["FileId"].ToString());
            }
            if (sFileIds == "")
            {
                //No loans
                PageCommon.WriteJsEnd(this, "Invalid FileId.", PageCommon.Js_RefreshSelf);
                return;
            }
            ServiceManager sm = new ServiceManager();
            using (LP2ServiceClient service = sm.StartServiceClient())
            {
                ImportLoansRequest req           = new ImportLoansRequest();
                string[]           selectedItems = sFileIds.Split(',');
                req.FileIds           = Array.ConvertAll(selectedItems, item => int.Parse(item));
                req.hdr               = new ReqHdr();
                req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
                req.hdr.UserId        = 5;

                respone = service.ImportLoans(req);
            }
        }
        catch (System.ServiceModel.EndpointNotFoundException)
        {
            string sExMsg = string.Format("Failed to sync with Point, reason: Point Manager is not running.");
            LPLog.LogMessage(LogType.Logerror, sExMsg);
            PageCommon.WriteJsEnd(this, sExMsg, PageCommon.Js_RefreshSelf);
        }
        catch (Exception ex)
        {
            string sExMsg = string.Format("Failed to sync with Point, error:{0}", ex.Message);
            LPLog.LogMessage(LogType.Logerror, sExMsg);
            PageCommon.WriteJsEnd(this, sExMsg, PageCommon.Js_RefreshSelf);
        }

        if (respone.hdr.Successful)
        {
            PageCommon.WriteJsEnd(this, "Synched successfully", PageCommon.Js_RefreshSelf);
        }
        else
        {
            PageCommon.WriteJsEnd(this, "Failed to sync with Point.", PageCommon.Js_RefreshSelf);
        }
    }
コード例 #4
0
    protected void lnkImport_Click(object sender, EventArgs e)
    {
        // 加载PointFiles信息
        LPWeb.Model.PointFiles PointFileInfo = this.GetPointFileInfo(this.iLoanID);
        if (PointFileInfo == null || string.IsNullOrEmpty(PointFileInfo.Name) || PointFileInfo.FolderId <= 0)
        {
            PageCommon.WriteJsEnd(this, "Unable to sync with Point, missing Point filename or Point Folder.", PageCommon.Js_RefreshSelf);
            return;
        }

        string sName     = PointFileInfo.Name;
        string sFolderId = PointFileInfo.FolderId.ToString();

        ServiceManager sm = new ServiceManager();

        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            ImportLoansRequest req = new ImportLoansRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = this.CurrUser.iUserID;
            req.FileIds           = new int[1] {
                this.iLoanID
            };
            ImportLoansResponse respone = null;
            try
            {
                respone = service.ImportLoans(req);

                if (respone.hdr.Successful)
                {
                    PageCommon.WriteJsEnd(this, "Synched with Point successfully.", PageCommon.Js_RefreshSelf);
                }
                else
                {
                    PageCommon.WriteJsEnd(this, "Failed to sync with Point, reason:" + respone.hdr.StatusInfo, PageCommon.Js_RefreshSelf);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                string sExMsg = string.Format("Failed to sync with Point, reason: Point Manager is not running.");
                LPLog.LogMessage(LogType.Logerror, sExMsg);
                PageCommon.WriteJsEnd(this, sExMsg, PageCommon.Js_RefreshSelf);
            }
            catch (Exception ex)
            {
                string sExMsg = string.Format("Failed to sync with Point, error: {0}", ex.Message);
                LPLog.LogMessage(LogType.Logerror, sExMsg);
                PageCommon.WriteJsEnd(this, sExMsg, PageCommon.Js_RefreshSelf);
            }
        }
    }
コード例 #5
0
    private bool ImportLoans(ref string errMsg)
    {
        ImportLoansRequest  req  = new ImportLoansRequest();
        ImportLoansResponse resp = new ImportLoansResponse();

        try
        {
            ServiceManager sm = new ServiceManager();
            using (LP2ServiceClient service = sm.StartServiceClient())
            {
                req.FileIds = new int[1] {
                    iFileID
                };
                req.hdr = new ReqHdr()
                {
                    UserId = loginUser.iUserID
                };

                resp = service.ImportLoans(req);

                if (resp == null || resp.hdr == null || !resp.hdr.Successful)
                {
                    errMsg = resp.hdr.StatusInfo;
                    return(false);
                }
                return(true);
            }
        }
        catch (System.ServiceModel.EndpointNotFoundException)
        {
            string sExMsg = string.Format("Failed to sync data from Point. Reason: Point Manager is not running.");
            LPLog.LogMessage(LogType.Logerror, sExMsg);
            errMsg = sExMsg;
            return(false);
        }
        catch (Exception ex)
        {
            string sExMsg = string.Format("error: {0}", ex.Message);
            LPLog.LogMessage(LogType.Logerror, sExMsg);

            errMsg = sExMsg;
            return(false);
        }
    }
コード例 #6
0
    /// <summary>
    /// Handles the Click event of the btnSync control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSync_Click(object sender, EventArgs e)
    {
        ServiceManager sm = new ServiceManager();

        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            ImportLoansResponse respone;
            try
            {
                var                selctedStr    = this.hfDeleteItems.Value;
                string[]           selectedItems = selctedStr.Split(',');
                ImportLoansRequest req           = new ImportLoansRequest();
                //req.PointFiles = selectedItems;//todo:check DataContract change
                req.FileIds           = Array.ConvertAll(selectedItems, item => int.Parse(item));
                req.hdr               = new ReqHdr();
                req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
                req.hdr.UserId        = 5;               //todo:check dummy data

                respone = service.ImportLoans(req);

                if (respone.hdr.Successful)
                {
                    PageCommon.WriteJsEnd(this, "Sync loan(s) Successfully", PageCommon.Js_RefreshSelf);
                }
                else
                {
                    PageCommon.WriteJsEnd(this, "Failed to sync loan(s).", PageCommon.Js_RefreshSelf);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException ee)
            {
                LPLog.LogMessage(ee.Message);
                PageCommon.AlertMsg(this, "Failed to sync loan(s), reason: Point Manager is not running.");
            }
            catch (Exception exception)
            {
                LPLog.LogMessage(exception.Message);
                PageCommon.WriteJsEnd(this, "Failed to sync loan(s).", PageCommon.Js_RefreshSelf);
            }
        }
    }
コード例 #7
0
    protected bool SyncNow(int iFileId)
    {
        SyncNow_Once = true;
        ServiceManager sm = new ServiceManager();

        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            ImportLoansRequest req = new ImportLoansRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken";
            req.hdr.UserId        = this.CurrUser.iUserID;
            req.FileIds           = new int[1] {
                iFileId
            };
            ImportLoansResponse respone = null;
            try
            {
                respone = service.ImportLoans(req);

                if (respone.hdr.Successful)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                return(false);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
    }
コード例 #8
0
        private string ImportLoansAndSubmitLoan(int iLoanID, string sProgram, string sType)
        {
            string         ReturnMessage = string.Empty;
            ServiceManager sm            = new ServiceManager();

            int[] FileIDs = new int[1];
            FileIDs.SetValue(iLoanID, 0);
            using (LP2ServiceClient service = sm.StartServiceClient())
            {
                ImportLoansRequest req = new ImportLoansRequest();
                req.hdr = new ReqHdr();
                req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
                req.hdr.UserId        = this.CurrUser.iUserID;
                req.FileIds           = FileIDs;

                ImportLoansResponse respone = null;
                try
                {
                    respone = service.ImportLoans(req);

                    if (respone.hdr.Successful)
                    {
                        ReturnMessage = string.Empty;
                    }
                    else
                    {
                        ReturnMessage = respone.hdr.StatusInfo;
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    string sExMsg = string.Format("Failed to ImportLoans, reason: ImportLoans Manager is not running.");
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }
                catch (Exception ex)
                {
                    string sExMsg = string.Format("Failed toImportLoans, error: {0}", ex.Message);
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }


                DT_SubmitLoanRequest reqDT = new DT_SubmitLoanRequest();
                reqDT.hdr = new ReqHdr();
                reqDT.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
                reqDT.hdr.UserId        = this.CurrUser.iUserID;
                reqDT.FileId            = iLoanID;
                reqDT.Loan_Program      = sProgram;
                reqDT.Originator_Type   = sType;

                DT_SubmitLoanResponse responeDT = null;
                try
                {
                    responeDT = service.DTSubmitLoan(reqDT);

                    if (responeDT.hdr.Successful)
                    {
                        ReturnMessage = string.Empty;
                    }
                    else
                    {
                        ReturnMessage = responeDT.hdr.StatusInfo;
                    }
                }
                catch (System.ServiceModel.EndpointNotFoundException)
                {
                    string sExMsg = string.Format("Failed to ImportLoans, reason: ImportLoans Manager is not running.");
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }
                catch (Exception ex)
                {
                    string sExMsg = string.Format("Failed to ImportLoans, error: {0}", ex.Message);
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }

                try
                {
                    LoanActivities       _bLoanActivities = new LoanActivities();
                    Model.LoanActivities _mLoanActivities = new Model.LoanActivities();
                    _mLoanActivities.FileId       = iLoanID;
                    _mLoanActivities.UserId       = this.CurrUser.iUserID;
                    _mLoanActivities.ActivityName = "The loan has been submitted to DataTrac by " + this.CurrUser.sFullName;
                    _mLoanActivities.ActivityTime = DateTime.Now;
                    int iNew = _bLoanActivities.Add(_mLoanActivities);
                }
                catch (Exception ex)
                {
                    string sExMsg = string.Format("Failed to Update LoanActivities, error: {0}", ex.Message);
                    LPLog.LogMessage(LogType.Logerror, sExMsg);

                    return(ReturnMessage);
                }

                return(ReturnMessage);
            }
        }