示例#1
0
        private void BindPointFoldersSelection()
        {
            PointFolders folder = new PointFolders();

            try
            {
                string  strWhere = string.Format(" BranchID is null or BranchID = {0} order by [Name] asc ", iBranchID);
                DataSet ds       = folder.GetList(strWhere);
                if (ds == null || ds.Tables.Count < 1 || ds.Tables[0].Rows.Count < 1)
                {
                    //ds=null;
                }

                gridPointFolderSelectionList.AutoGenerateColumns = false;
                gridPointFolderSelectionList.DataSource          = ds.Tables[0];
                gridPointFolderSelectionList.DataBind();
            }
            catch
            { }
        }
示例#2
0
    private int GetFolderID(string FolderName)
    {
        int FolderID = 0;

        try
        {
            PointFolders folder = new PointFolders();
            DataSet      ds     = folder.GetList(" [Name] = '" + FolderName + "' AND [Enabled] = 1");
            if (ds == null || ds.Tables.Count < 1 || ds.Tables[0].Rows.Count < 1)
            {
                FolderID = 0;
            }
            else
            {
                FolderID = int.Parse(ds.Tables[0].Rows[0]["FolderID"].ToString());
            }
        }
        catch
        { }
        return(FolderID);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 校验页面参数

        this.sCloseDialogCodes = this.Request.QueryString["CloseDialogCodes"].ToString() + ";";

        string sMissing = "Missing required qurey string.";

        #region Action
        if (this.Request.QueryString["Action"] == null)
        {
            PageCommon.WriteJsEnd(this, sMissing, sCloseDialogCodes);
        }
        this.sAction = this.Request.QueryString["Action"].ToString();

        if (this.Request.QueryString["detail"] != null)
        {
            sParaForDetail = this.Request.QueryString["detail"].ToString();
        }


        //CR60
        Company_Point             CPMgr   = new Company_Point();
        LPWeb.Model.Company_Point CPModel = CPMgr.GetModel();
        //check if Company_Point.Enable_MultiBranchFolders=true
        //select FolderId, [Name] from PointFolders where (LoanStatus=<selected loan/lead status>) order by [Name] asc
        bool bMultBranchFolder = false;
        if (CPModel.Enable_MultiBranchFolders == true)
        {
            bMultBranchFolder = true;
        }

        if (this.Request.QueryString["ContactID"] == null)
        {
            //if (this.sAction != "Cancel" && this.sAction != "Convert"
            //&& this.sAction != "Suspend" && this.sAction != "Resume" && this.sAction != "Bad" && this.sAction != "Lost")
            //{
            //    PageCommon.WriteJsEnd(this, "Invalid query string.", sCloseDialogCodes);
            //}
        }
        else
        {
            // 如果传入ContactID,只允许Suspend/Bad/Lost操作
            if (this.sAction != "Suspend" && this.sAction != "Bad" && this.sAction != "Lost")
            {
                PageCommon.WriteJsEnd(this, "Invalid query string.", sCloseDialogCodes);
            }
        }

        #endregion

        if (this.Request.QueryString["ContactID"] == null)  // from Prospect Loan Detail→Dispose
        {
            // LoanID
            bool bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID);
            if (bIsValid == false)
            {
                PageCommon.WriteJsEnd(this, sMissing, sCloseDialogCodes);
            }
            this.iLoanID = Convert.ToInt32(this.Request.QueryString["LoanID"]);

            // BranchID
            bIsValid  = PageCommon.ValidateQueryString(this, "BranchID", QueryStringType.ID);
            iBranchID = 0;
            if (bIsValid)
            {
                //PageCommon.WriteJsEnd(this, sMissing, sCloseDialogCodes);
                this.iBranchID = Convert.ToInt32(this.Request.QueryString["BranchID"]);
            }
        }
        else  // From Prospect Detail Popup→Update Point
        {
            // ContactID
            bool bIsValid = PageCommon.ValidateQueryString(this, "ContactID", QueryStringType.ID);
            if (bIsValid == false)
            {
                PageCommon.WriteJsEnd(this, sMissing, sCloseDialogCodes);
            }
            this.iContactID = Convert.ToInt32(this.Request.QueryString["ContactID"]);

            #region Get FileIDs and BranchIDs associated to ContactID

            string sSql0 = "select a.FileId, c.BranchId from LoanContacts as a inner join PointFiles as b on a.FileId=b.FileId "
                           + "inner join PointFolders as c on b.FolderId = c.FolderId "
                           + "where ContactId=" + this.iContactID + " and (ContactRoleId=dbo.lpfn_GetBorrowerRoleId() or ContactRoleId=dbo.lpfn_GetCoBorrowerRoleId())";

            this.LoanList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql0);

            #endregion

            #region Build BranchIDs

            foreach (DataRow LoanRow in this.LoanList.Rows)
            {
                string sBranchID = LoanRow["BranchID"].ToString();
                if (this.sBranchIDs == string.Empty)
                {
                    this.sBranchIDs = sBranchID;
                }
                else
                {
                    this.sBranchIDs += "," + sBranchID;
                }
            }

            #endregion
        }

        #region Bug 882 若FIleName为空,不显示Point文件夹列表,更新状态,直接关闭
        sFileName = LoansManager.GetProspectFileNameInfo(this.iLoanID);

        if (sFileName == "" && this.sAction != "Convert")
        {
            #region call Workflow API: bool UpdateProspectLoanStatus(int LoanId, string newLoanStatus)
            this.form1.Visible = false;
            this.Visible       = false;
            try
            {
                string sError_UpdateProspectLoanStatus = string.Empty;
                if (this.sAction == "Resume***Active")
                {
                    this.sAction = "Active";
                }
                sError_UpdateProspectLoanStatus = WorkflowManager.UpdateProspectLoanStatus(this.iLoanID, this.sAction, this.CurrUser.iUserID);

                if (sError_UpdateProspectLoanStatus != string.Empty)
                {
                    string sFailedMsg = string.Format("Failed to update lead status (FileID={0}): {1}", this.iLoanID, sError_UpdateProspectLoanStatus);
                    // LPLog.LogMessage(LogType.Logerror, sFailedMsg);
                    PageCommon.WriteJsEnd(this, sFailedMsg, sCloseDialogCodes);
                    //PageCommon.WriteJsEnd(this, sFailedMsg, PageCommon.Js_RefreshSelf);
                }
            }
            catch (Exception ex)
            {
                string sExMsg = string.Format("Failed to dispose of the lead, status (FileID={0}): {1}", this.iLoanID, ex.Message);
                // LPLog.LogMessage(LogType.Logerror, sExMsg);

                throw;
            }

            #endregion

            PageCommon.WriteJsEnd(this, "Disposed of the lead successfully.", "window.parent.location.href=window.parent.location.href;");
        }
        #endregion

        #endregion

        #region 加载Point Folder List

        string sWhere = "1=1";
        if (iBranchID <= 0 && iLoanID > 0)
        {
            string SqlCmd = string.Format("Select BranchId from Loans where FileId={0}", iLoanID);
            object obj    = LPWeb.DAL.DbHelperSQL.GetSingle(SqlCmd);
            iBranchID = obj == null ? 0 : (int)obj;
            if (iBranchID <= 0)
            {
                string SqlCmd_01     = string.Format("Select dbo.[lpfn_GetLoanOfficerID]({0})", iLoanID);
                object obj_01        = LPWeb.DAL.DbHelperSQL.GetSingle(SqlCmd_01);
                int    LoanOfficerId = obj_01 == null ? 0 : (int)obj_01;
                if (LoanOfficerId > 0)
                {
                    string SqlCmd_02 = string.Format("Select b.BranchId from GroupUsers bu inner join Branches b on bu.GroupId=b.GroupId where bu.UserId={0} ", LoanOfficerId);
                    object obj_02    = LPWeb.DAL.DbHelperSQL.GetSingle(SqlCmd_02);
                    iBranchID = obj_02 == null ? 0 : (int)obj_02;
                }
            }
        }
        //if (iBranchID <= 0)
        //{
        //    PageCommon.WriteJsEnd(this, "Cannot find the branch for the selected lead; no Point folders found.", sCloseDialogCodes);
        //}
        if (this.Request.QueryString["ContactID"] == null)
        {
            #region  入LoanID和BranchID
            if (bMultBranchFolder == false)
            {
                if (iBranchID > 0)
                {
                    sWhere += " and BranchId=" + this.iBranchID;
                }
            }
            if (sAction == "Convert")  // 特殊
            {
                sWhere += " and LoanStatus=1 and Enabled=1";
            }
            else if (sAction == "Resume***Active")
            {
                sWhere += " and LoanStatus=6 and Enabled=1 "; // sWhere1; bug 970 应弹出“Prospect“的文件夹列表(PointFolders.LoanStatus=6)
            }
            else
            {
                sWhere += " and LoanStatus=8 "; // sWhere1;
            }

            #endregion
        }
        else // 传入ContactID
        {
            // Suspend/Bad/Lost 筛选条件相同
            if (bMultBranchFolder == false)
            {
                if (!string.IsNullOrEmpty(this.sBranchIDs))
                {
                    sWhere += " and BranchId in (" + this.sBranchIDs + ") ";
                }
            }

            sWhere += " and LoanStatus<>1 and LoanStatus<>6 ";
        }
        PointFolders PointFolderManager  = new PointFolders();
        string       orderby             = "  Order By Name ";
        DataTable    PointFolderListData = PointFolderManager.GetList(sWhere + orderby).Tables[0];
        if (PointFolderListData.Rows.Count == 0)
        {
            this.form1.Visible = false;
            this.Visible       = false;
            string folderType = string.IsNullOrEmpty(this.sAction) || this.sAction.Trim().ToUpper() != "CONVERT" ? "Archived Leads " : "Active Loans";
            string err        = string.Format("No {0} folder available.", folderType);
            PageCommon.WriteJsEnd(this, err, sCloseDialogCodes);
        }
        this.gridPointFolderList.DataSource = PointFolderListData;
        this.gridPointFolderList.DataBind();

        #endregion

        #region If Company_Point.MasterSource=’DataTrac’
        Company_Point _bCompany_Point = new Company_Point();
        DataTable     dt = _bCompany_Point.GetCompany_PointInfo();
        if (dt.Rows.Count > 0)
        {
            sShowSubmitLoanPopup = dt.Rows[0]["MasterSource"].ToString() == "DataTrac" ? "1" : "0";
        }
        #endregion

        #region sFileName

        sFileName = LoansManager.GetProspectFileNameInfo(this.iLoanID);

        #endregion
    }
示例#4
0
    private void BindOther()
    {
        if (iBranchId == 0 && !string.IsNullOrEmpty(ddlBranch.SelectedValue))
        {
            iBranchId = Convert.ToInt32(ddlBranch.SelectedValue);
        }

        #region Loan Officer

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

        if (!string.IsNullOrEmpty(loanOfficer))
        {
            ddlLoanOfficer.DataTextField  = "text";
            ddlLoanOfficer.DataValueField = "value";
            ddlLoanOfficer.DataSource     = new ListItemCollection()
            {
                new ListItem()
                {
                    Selected = true, Text = loanOfficer, Value = loanOfficerId.ToString()
                }
            };
            ddlLoanOfficer.DataBind();
        }
        else
        {
            if (iBranchId > 0)
            {
                ddlLoanOfficer.DataTextField  = "UserName";
                ddlLoanOfficer.DataValueField = "UserId";
                //ddlLoanOfficer.DataSource = bllUsers.GetAllUsers(loanInfo.BranchID.Value);
                ddlLoanOfficer.DataSource = bllUsers.GetAllUsers(iBranchId);
                ddlLoanOfficer.DataBind();
            }
            else
            {
                if (loginUser.sRoleName == "Executive")
                {
                    ddlLoanOfficer.DataTextField  = "UserName";
                    ddlLoanOfficer.DataValueField = "UserId";
                    ddlLoanOfficer.DataSource     = bllUsers.GetUserListByBranches_Executive(loginUser.iUserID);
                    ddlLoanOfficer.DataBind();
                }
                else if (loginUser.bIsBranchManager || loginUser.bIsBranchUser)
                {
                    ddlLoanOfficer.DataTextField  = "UserName";
                    ddlLoanOfficer.DataValueField = "UserId";
                    ddlLoanOfficer.DataSource     = bllUsers.GetUserListByUserBranches(loginUser.iUserID);
                    ddlLoanOfficer.DataBind();
                }
            }

            if (ddlLoanOfficer.Items.Count > 0 && loanOfficerId != 0)
            {
                ddlLoanOfficer.SelectedValue = loanOfficerId.ToString();
                //ddlLoanOfficer.SelectedIndex = 0;
            }
        }

        #endregion

        #region FolderName
        ddlFolderName.Enabled = true;
        //if (pointFileInfo.FolderId != 0)
        //{
        //    ddlFolderName.DataTextField = "text";
        //    ddlFolderName.DataValueField = "value";
        //    ddlFolderName.DataSource = new ListItemCollection() { new ListItem() { Text = pointFolderInfo.Name, Value = pointFolderInfo.FolderId.ToString(), Selected = true } };
        //    ddlFolderName.DataBind();
        //    //ddlFolderName.Enabled = false;
        //}
        //else

        //CR60 ADD
        Company_Point bllcomPoint = new Company_Point();
        //LPWeb.BLL.ArchiveLeadStatus bllLeadStatus = new ArchiveLeadStatus();
        LPWeb.Model.Company_Point comPointInfo = bllcomPoint.GetModel();

        //int leadStatus = 0;
        //LPWeb.Model.ArchiveLeadStatus statusInfo = bllLeadStatus.GetModelList(" LeadStatusName ='" + loanInfo.ProspectLoanStatus + "'").FirstOrDefault();
        //if (statusInfo != null && statusInfo.LeadStatusName == loanInfo.ProspectLoanStatus)
        //{
        //    leadStatus = statusInfo.LeadStatusId;
        //}

        if (comPointInfo != null && comPointInfo.Enable_MultiBranchFolders)
        {
            ddlFolderName.DataTextField  = "Name";
            ddlFolderName.DataValueField = "FolderId";
            ddlFolderName.DataSource     = bllPointFolders.GetList(" [Enabled] = 1 AND  (BranchID IS NOT NULL)  AND (LoanStatus= 8 ) order by [Name] asc");
            ddlFolderName.DataBind();
        }
        else
        {
            #region CR60前绑定逻辑
            if (iBranchId > 0 || Convert.ToInt32(ddlBranch.SelectedValue) > 0)
            {
                if (loanInfo.ProspectLoanStatus == "Active")
                {
                    ddlFolderName.DataTextField  = "Name";
                    ddlFolderName.DataValueField = "FolderId";
                    ddlFolderName.DataSource     = bllPointFolders.GetList(" [Enabled] = 1 AND BranchId = " + iBranchId + " AND LoanStatus  = 6  order by Name");
                    ddlFolderName.DataBind();
                }
                else
                {
                    ddlFolderName.DataTextField  = "Name";
                    ddlFolderName.DataValueField = "FolderId";
                    ddlFolderName.DataSource     = bllPointFolders.GetList(" [Enabled] = 1 AND BranchId = " + iBranchId + " AND LoanStatus  = 8  order by Name");
                    ddlFolderName.DataBind();
                }
            }
            else
            {
                string whereStr = " [Enabled] = 1 ";
                if (loanInfo.ProspectLoanStatus == "Active")
                {
                    whereStr += " AND LoanStatus  = 6 ";
                }
                else
                {
                    whereStr += " AND LoanStatus  = 8 ";
                }

                if (loginUser.bIsCompanyExecutive)
                {
                    whereStr += " AND BranchId IN (select BranchId from dbo.lpfn_GetUserBranches_Executive(" + loginUser.iUserID + "))";
                }
                else if (loginUser.bIsBranchManager)
                {
                    whereStr += " AND BranchId IN (select BranchId from dbo.lpfn_GetUserBranches_Branch_Manager(" + loginUser.iUserID + "))";
                }
                else
                {
                    whereStr += " AND BranchId IN (select BranchId from dbo.lpfn_GetUserBranches(" + loginUser.iUserID + "))";
                }

                whereStr += " order by Name ";

                ddlFolderName.DataTextField  = "Name";
                ddlFolderName.DataValueField = "FolderId";
                ddlFolderName.DataSource     = bllPointFolders.GetList(whereStr);
                ddlFolderName.DataBind();
            }
            #endregion
        }


        if (ddlFolderName.Items.Count > 0 && iPointFolderId > 0)
        {
            ddlFolderName.SelectedValue = iPointFolderId.ToString();
            //ddlFolderName.SelectedIndex = 0;
        }

        #endregion
    }