Exemplo n.º 1
0
    public void BindData()
    {
        LPWeb.BLL.PointFolders bllPF = new LPWeb.BLL.PointFolders();

        var list = bllPF.GetList(" BranchId= " + BranchID.ToString() + " AND Enabled=1 AND LoanStatus=6 ");

        ddlFolder.DataSource     = list;
        ddlFolder.DataTextField  = "Name";
        ddlFolder.DataValueField = "FolderId";
        ddlFolder.DataBind();

        if (FileId != 0)
        {
            LPWeb.BLL.PointFiles   bllPointfiles = new LPWeb.BLL.PointFiles();
            LPWeb.Model.PointFiles model         = bllPointfiles.GetModel(FileId);
            if (model != null)
            {
                txbFilename.Text        = model.Name;
                ddlFolder.SelectedValue = model.FolderId.ToString();
            }
            else
            {
                PageCommon.RegisterJsMsg(this.Page, "Missing required query string.", "Cancel();");
            }
        }
    }
Exemplo n.º 2
0
    private void BindPoint(int FileID)
    {
        try
        {
            //btnExport.Enabled = false;
            PointFiles             file      = new PointFiles();
            LPWeb.Model.PointFiles fileModel = new LPWeb.Model.PointFiles();
            fileModel = file.GetModel(iFileID);

            if (fileModel == null)
            {
                return;
            }
            txbPointFileName.Text = fileModel.Name;

            PointFolders             folder      = new PointFolders();
            LPWeb.Model.PointFolders folderModel = new LPWeb.Model.PointFolders();
            folderModel = folder.GetModel(fileModel.FolderId);
            if (folderModel != null && folderModel.Name.Length > 0)
            {
                ddlPointFolder.Text = folderModel.Name;
            }
            if (txbPointFileName.Text.Length > 0 && ddlPointFolder.Text.Length > 0)
            {
                //btnExport.Enabled = true;
            }
        }
        catch
        { }
    }
    private LPWeb.Model.PointFiles GetPointFileInfo(int iFileId)
    {
        PointFiles PointFilesMgr = new PointFiles();

        LPWeb.Model.PointFiles PointFileInfo = PointFilesMgr.GetModel(this.iLoanID);

        return(PointFileInfo);
    }
Exemplo n.º 4
0
    private void BindPoint(int FileID)
    {
        try
        {
            //btnExport.Enabled = false;
            PointFiles             file      = new PointFiles();
            LPWeb.Model.PointFiles fileModel = new LPWeb.Model.PointFiles();
            fileModel = file.GetModel(iFileID);

            if (fileModel == null)
            {
                return;
            }
            txbPointFileName.Text = fileModel.Name;
            PointFolders folder = new PointFolders();
            if (fileModel.FolderId > 0)
            {
                LPWeb.Model.PointFolders folderModel = new LPWeb.Model.PointFolders();
                folderModel = folder.GetModel(fileModel.FolderId);
                if (folderModel != null && folderModel.Name.Length > 0)
                {
                    ListItem item = new ListItem(folderModel.Name, folderModel.FolderId.ToString());
                    ddlPointFolder.Items.Insert(0, item);
                }
                ddlPointFolder.Enabled = false;
            }
            else
            if (ddlPointFolder.Items.Count > 1)
            {
                ddlPointFolder.Enabled = true;
            }

            if (txbPointFileName.Text.Length > 0 && ddlPointFolder.Text.Length > 0)
            {
                if (!txbPointFileName.Text.ToUpper().EndsWith(".PRS") &&
                    !txbPointFileName.Text.ToUpper().EndsWith(".BRW"))
                {
                    //btnExport.Enabled = false;
                    return;
                }
                string filename = System.IO.Path.GetFileName(txbPointFileName.Text);
                if (txbPointFileName.Text.ToUpper().EndsWith(".PRS"))
                {
                    txbPointFileName.Text = @"\PROSPECT\" + filename;
                }
                else
                {
                    txbPointFileName.Text = @"\BORROWER\" + filename;
                }
                ///btnExport.Enabled = true;
            }
        }
        catch (Exception ex)
        {
            LPLog.LogMessage(ex.Message);
        }
    }
Exemplo n.º 5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        var filename = txbFilename.Text.Trim();

        if (string.IsNullOrEmpty(filename) ||
            (!filename.ToUpper().EndsWith(".PRS") && !filename.ToUpper().EndsWith(".BRW")))
        {
            PageCommon.AlertMsg(this.Page, "You have to specify a valid Point filename that ends with \".PRS\" or \".BRW\".");
            return;
        }
        if (string.IsNullOrEmpty(filename) ||
            filename.ToUpper().Replace(".PRS", "").Trim().Length == 0 || filename.ToUpper().Replace(".BRW", "").Trim().Length == 0)
        {
            PageCommon.AlertMsg(this.Page, "You have to specify a valid Point filename.");
            return;
        }

        if (filename.ToUpper().EndsWith(".PRS"))
        {
            filename = "PROSPECT\\" + filename;
        }
        else if (filename.ToUpper().EndsWith(".BRW"))
        {
            filename = "BORROWER\\" + filename;
        }
        else
        {
            return;
        }


        LPWeb.BLL.PointFiles bllPointfiles = new LPWeb.BLL.PointFiles();

        LPWeb.Model.PointFiles modelPointfile = new LPWeb.Model.PointFiles();

        if (FileId == 0)
        {
            modelPointfile.FolderId = Convert.ToInt32(ddlFolder.SelectedValue);
            modelPointfile.Name     = filename;

            bllPointfiles.Add(modelPointfile);
        }
        else
        {
            modelPointfile = bllPointfiles.GetModel(FileId);

            if (modelPointfile == null)
            {
                return;
            }
            modelPointfile.FolderId = Convert.ToInt32(ddlFolder.SelectedValue);
            modelPointfile.Name     = filename;

            bllPointfiles.UpdateBase(modelPointfile);
        }
        PageCommon.RegisterJsMsg(this.Page, "", " Cancel();");
    }
    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);
            }
        }
    }
Exemplo n.º 7
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.PointFiles> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.PointFiles> modelList = new List <LPWeb.Model.PointFiles>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.PointFiles model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.PointFiles();
                    if (dt.Rows[n]["FileId"].ToString() != "")
                    {
                        model.FileId = int.Parse(dt.Rows[n]["FileId"].ToString());
                    }
                    if (dt.Rows[n]["FolderId"].ToString() != "")
                    {
                        model.FolderId = int.Parse(dt.Rows[n]["FolderId"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    if (dt.Rows[n]["FirstImported"].ToString() != "")
                    {
                        model.FirstImported = DateTime.Parse(dt.Rows[n]["FirstImported"].ToString());
                    }
                    if (dt.Rows[n]["LastImported"].ToString() != "")
                    {
                        model.LastImported = DateTime.Parse(dt.Rows[n]["LastImported"].ToString());
                    }
                    if (dt.Rows[n]["Success"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Success"].ToString() == "1") || (dt.Rows[n]["Success"].ToString().ToLower() == "true"))
                        {
                            model.Success = true;
                        }
                        else
                        {
                            model.Success = false;
                        }
                    }
                    model.CurrentImage  = dt.Rows[n]["CurrentImage"].ToString();
                    model.PreviousImage = dt.Rows[n]["PreviousImage"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 校验页面参数

        string sReturnUrl = "../Pipeline/ProspectPipelineSummaryLoan.aspx";
        string sErrorMsg  = "Failed to load this page: missing required query string.";

        // FileID
        bool bIsValid = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID);
        if (bIsValid == false)
        {
            PageCommon.WriteJsEnd(this, sErrorMsg, "window.parent.location.href='" + sReturnUrl + "'");
        }
        string sFileID = this.Request.QueryString["FileID"];
        this.hfFileID.Value = sFileID;
        try
        {
            this.iFileID = Convert.ToInt32(sFileID);
        }
        catch { }
        #endregion

        #region LoadbaseInfo
        loanInfo = bllLoans.GetModel(iFileID);

        if (loanInfo != null)
        {
            iBranchId = (loanInfo.BranchID == null) ? 0 : loanInfo.BranchID.Value;
        }

        pointFileInfo = bllPointFile.GetModel(iFileID);

        iPointFolderId = (pointFileInfo == null || pointFileInfo.FolderId <= 0) ? 0 : pointFileInfo.FolderId;

        if (iPointFolderId > 0)
        {
            pointFolderInfo = bllPointFolders.GetModel(pointFileInfo.FolderId);
        }
        #endregion

        if (!IsPostBack)
        {
            BindData();
        }
    }
Exemplo n.º 9
0
    private bool UpdatePointNote(int fileId, DateTime dtNow, string senderName, out string err)
    {
        bool exported = false;

        err = string.Empty;
        try
        {
            LPWeb.BLL.PointFiles   pfMgr   = new PointFiles();
            LPWeb.Model.PointFiles pfModel = pfMgr.GetModel(fileId);
            if (pfModel == null || pfModel.FolderId <= 0 || string.IsNullOrEmpty(pfModel.Name) || string.IsNullOrEmpty(pfModel.CurrentImage))
            {
                exported = true;
                return(exported);
            }
            var req = new AddNoteRequest
            {
                FileId   = fileId,
                Created  = dtNow,//DateTime.Now,
                NoteTime = dtNow,
                Note     = this.txtNote.Text.Trim(),
                Sender   = senderName,
                hdr      = new ReqHdr
                {
                    UserId = this.CurrUser.iUserID
                }
            };
            ServiceManager sm = new ServiceManager();
            using (LP2ServiceClient client = sm.StartServiceClient())
            {
                AddNoteResponse res = client.AddNote(req);
                exported = !res.hdr.Successful ? false : true;
                err      = res.hdr.StatusInfo;
            }
        }
        catch (Exception ex)
        {
            return(exported);
        }
        return(exported);
    }
Exemplo n.º 10
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void UpdateBase(LPWeb.Model.PointFiles model)
 {
     dal.UpdateBase(model);
 }
Exemplo n.º 11
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LPWeb.Model.PointFiles model)
 {
     return(dal.Add(model));
 }
Exemplo n.º 12
0
    private bool SaveLocal(ref string errMsg)
    {
        if (!string.IsNullOrEmpty(FileName) && FileName.Length > 0 && !FileName.ToUpper().EndsWith(".PRS") && !FileName.ToUpper().EndsWith(".BRW"))
        {
            errMsg = "The filename must end with “.PRS” or “.BRW”. ";
            return(false);
        }

        try
        {
            #region Save BranchId
            Loans             bllLoans = new Loans();
            LPWeb.Model.Loans loanInfo = new LPWeb.Model.Loans();
            loanInfo = bllLoans.GetModel(iFileID);
            if (loanInfo != null)
            {
                loanInfo.BranchID = BranchId;
                bllLoans.Update(loanInfo);
            }
            #endregion

            //Save Loan Officer

            #region Loan Officer

            LoanTeam bllLoanTeam   = new LoanTeam();
            Users    bllUsers      = new Users();
            var      loanOfficer   = bllLoanTeam.GetLoanOfficer(iFileID);
            var      loanOfficerId = bllLoanTeam.GetLoanOfficerID(iFileID);

            #region Loan Officer RolesID   =loanOfficerRolesId
            Roles bllRoles           = new Roles();
            int   loanOfficerRolesId = 3;//default;
            try
            {
                loanOfficerRolesId = bllRoles.GetModelList(" Name = 'Loan Officer' ").FirstOrDefault().RoleId;
            }
            catch { }
            #endregion

            if (LoanOfficerId != loanOfficerId)
            {
                var loanTeamInfo = bllLoanTeam.GetModel(iFileID, loanOfficerRolesId, loanOfficerId);

                if (loanTeamInfo == null)
                {
                    loanTeamInfo = new LPWeb.Model.LoanTeam();
                }
                else
                {
                    bllLoanTeam.Delete(iFileID, loanOfficerRolesId, loanOfficerId);
                }
                loanTeamInfo.FileId = iFileID;
                loanTeamInfo.RoleId = loanOfficerRolesId;
                loanTeamInfo.UserId = LoanOfficerId;


                bllLoanTeam.Add(loanTeamInfo);
            }

            #endregion

            #region Local PointFile  ----pointFileInfo and  pointFolderInfo

            PointFiles   bllPointFile    = new PointFiles();
            PointFolders bllPointFolders = new PointFolders();


            LPWeb.Model.PointFiles pointFileInfo = bllPointFile.GetModel(iFileID);
            var IsAddPointFile = false;
            if (pointFileInfo == null)
            {
                IsAddPointFile = true;
                pointFileInfo  = new LPWeb.Model.PointFiles();
            }
            else
            {
                IsAddPointFile = false;
            }

            pointFileInfo.FileId = iFileID;
            if (FolderId > 0)
            {
                pointFileInfo.FolderId = FolderId;
            }
            if (FileName.Length > 0)
            {
                pointFileInfo.Name = FileName;
            }


            if (IsAddPointFile)
            {
                bllPointFile.Add(pointFileInfo);
            }
            else
            {
                bllPointFile.UpdateBase(pointFileInfo);
            }

            #endregion
        }
        catch (Exception ex)
        {
            errMsg = ex.Message;
            return(false);
        }
        return(true);
    }
Exemplo n.º 13
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        #region get user input

        string   sFirstName = this.txtFirstName.Text.Trim();
        string   sLastName  = this.txtLastName.Text.Trim();
        string   sEmail     = this.txtEmail.Text.Trim();
        string   sCellPhone = this.txtCellPhone.Text.Trim();
        string   sHomePhone = this.txtHomePhone.Text.Trim();
        string   sWorkPhone = this.txtWorkPhone.Text.Trim();
        string   sDOB       = this.txtBirthday.Text.Trim();
        DateTime DOB;
        DateTime DT = DateTime.Today;
        DT = DateTime.Today.AddYears(-18);

        if (sDOB != string.Empty)
        {
            if (DateTime.TryParse(sDOB, out DOB) == false)
            {
                PageCommon.AlertMsg(this, "Date of Birth is not a valid date format.");
                return;
            }
            if (DOB > DT)
            {
                PageCommon.AlertMsg(this, "Date of Birth should be 18 years old.");
                return;
            }
        }

        string sLeadSource = string.Empty;
        if (this.ddlLeadSource.SelectedIndex != 0)
        {
            sLeadSource = this.ddlLeadSource.SelectedValue;
        }

        string sReferralID = this.hdnReferralID.Value;
        string sPurpose    = this.ddlPurpose.SelectedValue;
        string sLoanType   = this.ddlType.SelectedValue;
        string sProgram    = string.Empty;
        if (this.ddlProgram.SelectedIndex != 0)
        {
            sProgram = this.ddlProgram.SelectedValue;
        }

        string  sAmount = this.txtAmount.Text.Trim();
        decimal dAmount = 0;
        if (sAmount != string.Empty)
        {
            Decimal da = 0;
            if (Decimal.TryParse(sAmount, out da) == false)
            {
                PageCommon.AlertMsg(this, "Amount is not a valid value.");
                return;
            }

            if (da > 9999999999999)
            {
                PageCommon.AlertMsg(this, "Amount is not a valid value.");
                return;
            }

            dAmount = da;
        }
        string  sRate = this.txtRate.Text.Trim();
        decimal dRate = 0;
        if (sRate != string.Empty)
        {
            dRate = Convert.ToDecimal(sRate);
        }

        #endregion

        #region update Loans

        Loans LoansMgr = new Loans();
        LoansMgr.UpldateLoanInfo(this.iLoanID, sPurpose, sLoanType, sProgram, sAmount, sRate);

        #endregion

        #region update Contacts and Prospect

        // get borrower info
        DataTable BorrowerInfo = this.GetBorrowerInfo(this.iLoanID);
        if (BorrowerInfo.Rows.Count > 0)
        {
            int iBorrowerID = Convert.ToInt32(BorrowerInfo.Rows[0]["ContactId"]);

            Contacts ContactsMgr = new Contacts();
            ContactsMgr.UpdateContactProspectInfo(iBorrowerID, sFirstName, sLastName, sEmail, sCellPhone, sHomePhone, sWorkPhone, sDOB, sLeadSource, sReferralID);
        }

        #endregion

        #region WCF API UploadLoanInfo

        // 加载PointFiles信息
        LPWeb.Model.PointFiles PointFileInfo = this.GetPointFileInfo(this.iLoanID);
        if (PointFileInfo != null && !string.IsNullOrEmpty(PointFileInfo.Name))
        {
            string sName     = PointFileInfo.Name;
            string sFolderId = PointFileInfo.FolderId.ToString();

            if (sName != string.Empty && sFolderId != string.Empty)
            {
                string sError  = string.Empty;
                bool   bResult = this.UploadLoanInfo(this.iLoanID, true, this.CurrUser.iUserID, out sError);

                if (bResult == false)
                {
                    PageCommon.WriteJsEnd(this, "Saved successfully, but failed to invoke API UploadLoanInfo: " + sError, PageCommon.Js_RefreshSelf);
                    return;
                }
            }
        }

        #endregion

        // success
        PageCommon.WriteJsEnd(this, "Saved successfully.", PageCommon.Js_RefreshSelf);
    }