示例#1
0
    private void ValidateButtonStatus()
    {
        var loan = new LPWeb.BLL.Loans().GetModel(CurrentFileId);

        if (!string.IsNullOrEmpty(loan.Status) && loan.Status != "Processing")
        {
            btnSave.Enabled = false;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        string sProspectID = string.Empty;

        #region 校验页面参数

        bool bIsValid  = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID);
        bool bIsValid1 = PageCommon.ValidateQueryString(this, "ContactID", QueryStringType.ID);

        if (bIsValid == false && bIsValid1 == false)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", string.Empty);
        }
        #region CR48

        if (Request.QueryString["FileID"] == null && Request.QueryString["ContactID"] == null)
        {
            sProspectID = "0";
            iProspectID = 0;
        }
        else if (Request.QueryString["FileID"] == null && Request.QueryString["ContactID"] != null)
        {
            sProspectID = Request.QueryString["ContactID"].ToString();
            if (Int32.TryParse(Request.QueryString["ContactID"].ToString(), out iProspectID) == false)
            {
                iProspectID = 0;
                sProspectID = "0";
            }
        }
        else
        {
            var             sFileId  = Request.QueryString["FileID"].ToString();
            LPWeb.BLL.Loans bllLoans = new LPWeb.BLL.Loans();
            this.iProspectID         = bllLoans.GetBorrowerID(Convert.ToInt32(sFileId)).Value;
            sProspectID              = this.iProspectID.ToString();
            this.hdnBorrowerID.Value = sProspectID;
        }
        #endregion

        #endregion

        #region 加载ContactMailCampaign列表

        string sSql = "select a.*, b.Name as MailChimpCampaignName, c.Name as MailChimpListName, d.LastName +', '+ d.FirstName as AddedByName "
                      + "from ContactMailCampaign as a "
                      + "left outer join MailChimpCampaigns as b on a.CID=b.CID "
                      + "left outer join MailChimpLists as c on a.LID=c.LID "
                      + "left outer join Users as d on a.AddedBy=d.UserId "
                      + "where ContactId=" + this.iProspectID;
        DataTable ContactMailCampaignList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql);

        this.gridContactMailCampaignList.DataSource = ContactMailCampaignList;
        this.gridContactMailCampaignList.DataBind();

        #endregion
    }
示例#3
0
    private string SendEmail(int ContactID, int UserID, byte[] EmailBody)
    {
        string         ReturnMessage = string.Empty;
        ServiceManager sm            = new ServiceManager();

        LPWeb.BLL.Loans _bLoan = new LPWeb.BLL.Loans();
        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            SendEmailRequest req = new SendEmailRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = this.CurrUser.iUserID;
            req.EmailBody         = EmailBody;
            req.EmailSubject      = string.Format("Loan Status Report for {0}'s loan", _bLoan.GetLoanBorrowerName(iLoanID));
            req.UserId            = this.CurrUser.iUserID;
            if (ContactID > 0)
            {
                req.ToContactIds = new int[1] {
                    ContactID
                };
            }
            if (UserID > 0)
            {
                req.ToUserIds = new int[1] {
                    UserID
                };
            }
            SendEmailResponse respone = null;
            try
            {
                respone = service.SendEmail(req);

                if (respone.resp.Successful)
                {
                    ReturnMessage = string.Empty;
                }
                else
                {
                    ReturnMessage = respone.resp.StatusInfo;
                }
            }
            catch (System.ServiceModel.EndpointNotFoundException)
            {
                string sExMsg = string.Format("Failed to send email, reason: Email Manager is not running.");
                LPLog.LogMessage(LogType.Logerror, sExMsg);
            }
            catch (Exception ex)
            {
                string sExMsg = string.Format("Failed to send email, error: {0}", ex.Message);
                LPLog.LogMessage(LogType.Logerror, sExMsg);
            }

            return(ReturnMessage);
        }
    }
示例#4
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);
        }
    }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 检查必要参数

        bool bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID);
        if (bIsValid == false)
        {
            this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing", "$('#divContainer').hide();alert('Missing required query string.');window.parent.CloseDialog_AddRule();", true);
            return;
        }

        this.iLoanID = Convert.ToInt32(this.Request.QueryString["LoanID"]);

        //Get rule num by loan id
        LPWeb.BLL.LoanRules loanRulesMgr = new LPWeb.BLL.LoanRules();
        System.Data.DataSet ds           = loanRulesMgr.GetList(" Fileid=" + this.iLoanID.ToString());
        int iRuleCount = ds.Tables[0].Rows.Count;
        this.hdnAddRuleNum.Value = (20 - iRuleCount).ToString();

        #endregion

        #region 初始化Rule列表
        this.RuleSqlDataSource.ConnectionString = LPWeb.DAL.DbHelperSQL.connectionString;

        string sSql = "select * from Template_Rules where Enabled=1 and RuleId not in (select RuleId from LoanRules where Fileid=" + this.iLoanID.ToString() + " and RuleId is not null)"
                      + " AND RuleScope = 0 AND (LoanTarget = 0 OR LoanTarget = 2)";

        //
        //Check prospect loan
        if (iLoanID != 0)
        {
            LPWeb.BLL.Loans   loanMgr   = new LPWeb.BLL.Loans();
            LPWeb.Model.Loans loanModel = loanMgr.GetModel(iLoanID);
            if (loanModel.Status.Trim().ToLower() == "prospect")
            {
                this.hdnProspectLoan.Value = "true";
                sSql = "SELECT * FROM Template_Rules WHERE Enabled=1 AND RuleId NOT IN (SELECT RuleId FROM LoanRules WHERE Fileid=" + this.iLoanID.ToString() + " AND RuleId IS NOT NULL)"
                       + " AND RuleScope = 0 AND (LoanTarget = 1 OR LoanTarget = 2)";
            }
        }

        this.RuleSqlDataSource.SelectCommand = sSql;
        this.gridRuleList.DataBind();

        #endregion
    }
示例#6
0
    private string SendLSREmail(int ContactID, string ContactEmail, string ContactName, int UserID, string UserEmail, string UserName, bool External, Dictionary <string, byte[]> Attachments)
    {
        string         ReturnMessage = string.Empty;
        ServiceManager sm            = new ServiceManager();

        LPWeb.BLL.Loans _bLoan = new LPWeb.BLL.Loans();
        using (LP2ServiceClient service = sm.StartServiceClient())
        {
            SendLSRRequest req = new SendLSRRequest();
            req.hdr = new ReqHdr();
            req.hdr.SecurityToken = "SecurityToken"; //todo:check dummy data
            req.hdr.UserId        = this.CurrUser.iUserID;
            req.FileId            = iLoanID;
            req.TemplReportId     = GetTemplReportId();
            req.External          = External;
            req.Attachments       = Attachments;

            if (ContactID > 0)
            {
                req.ToContactId       = ContactID;
                req.ToContactEmail    = ContactEmail;
                req.ToContactUserName = ContactName;
            }
            if (UserID > 0)
            {
                req.ToUserId       = UserID;
                req.ToUserEmail    = UserEmail;
                req.ToUserUserName = UserName;
            }

            req.LoanAutoEmailid = SaveLoanAutoEmailid(req.FileId, req.TemplReportId, req.ToContactId, req.ToUserId, req.External);

            SendLSRResponse respone = null;
            try
            {
                respone = service.SendLSR(req);

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

            return(ReturnMessage);
        }
    }
示例#7
0
    private void CheckLoanStatus()
    {
        LPWeb.BLL.Loans loanMgr = new LPWeb.BLL.Loans();

        this.hdnActiveLoan.Value = loanMgr.IsActiveLoan(iLoanID) == true ? "True" : "False";
    }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // 获取当前用户信息
        this.CurrentUser    = new LoginUser();
        this.iCurrentUserID = CurrentUser.iUserID;

        #region 页面重定向

        if (this.CurrentUser.sRoleName == "Executive" || this.CurrentUser.sRoleName == "Branch Manager")
        {
            try
            {
                this.Response.Redirect("DashBoardHome2.aspx");
            }
            catch
            {
            }
        }

        #endregion

        #region Get User Home Profile

        LPWeb.BLL.UserHomePref   UserHomePref1 = new LPWeb.BLL.UserHomePref();
        LPWeb.Model.UserHomePref UserHomePref2 = UserHomePref1.GetModel(this.iCurrentUserID);

        #endregion

        #region 角色权限-显示控制

        #region 设置是否显示Alert

        if (this.CurrentUser.userRole.OverdueTaskAlerts == true)
        {
            this.AlertWebPart1.Visible = true;
        }
        else
        {
            this.AlertWebPart1.Visible = false;
        }

        // User Home Profile
        if (UserHomePref2 != null)
        {
            if (UserHomePref2.OverDueTaskAlert == true)
            {
                this.AlertWebPart1.Visible = true;
            }
            else
            {
                this.AlertWebPart1.Visible = false;
            }
        }

        #endregion

        #region 设置是否显示Email Inbox

        if (this.CurrentUser.userRole.ExchangeInbox == true)
        {
            this.divEmailInbox.Visible = true;
        }
        else
        {
            this.divEmailInbox.Visible = false;
        }

        // User Home Profile
        if (UserHomePref2 != null)
        {
            if (UserHomePref2.ExchangeInbox == true)
            {
                this.divEmailInbox.Visible = true;
            }
            else
            {
                this.divEmailInbox.Visible = false;
            }
        }

        #endregion

        #region 设置是否显示Company Announcement

        //if (this.CurrentUser.userRole.Announcements == true)
        //{
        //    this.divCompanyAnn.Visible = true;
        //}
        //else
        //{
        //    this.divCompanyAnn.Visible = false;
        //}

        //// User Home Profile
        //if (UserHomePref2 != null)
        //{
        //    if (UserHomePref2.Announcements == true)
        //    {
        //        this.divCompanyAnn.Visible = true;
        //    }
        //    else
        //    {
        //        this.divCompanyAnn.Visible = false;
        //    }
        //}

        #endregion

        #region 设置是否显示Calendar

        if (this.CurrentUser.userRole.ExchangeCalendar == true)
        {
            this.divCalendar.Visible = true;
        }
        else
        {
            this.divCalendar.Visible = false;
        }

        // User Home Profile
        if (UserHomePref2 != null)
        {
            if (UserHomePref2.ExchangeCalendar == true)
            {
                this.divCalendar.Visible = true;
            }
            else
            {
                this.divCalendar.Visible = false;
            }
        }

        #endregion

        #region 设置是否显示User Goals

        if (this.CurrentUser.userRole.GoalsChart == true)
        {
            this.divUserGoals.Visible = true;
        }
        else
        {
            this.divUserGoals.Visible = false;
        }

        // User Home Profile
        if (UserHomePref2 != null)
        {
            if (UserHomePref2.GoalsChart == true)
            {
                this.divUserGoals.Visible = true;
            }
            else
            {
                this.divUserGoals.Visible = false;
            }
        }

        #endregion

        #region 设置是否显示Pipeline Summary

        if (this.CurrentUser.userRole.PipelineChart == true)
        {
            this.divPipelineAnalysis.Visible = true;
        }
        else
        {
            this.divPipelineAnalysis.Visible = false;
        }

        // User Home Profile
        if (UserHomePref2 != null)
        {
            if (UserHomePref2.PipelineChart == true)
            {
                this.divPipelineAnalysis.Visible = true;
            }
            else
            {
                this.divPipelineAnalysis.Visible = false;
            }
        }

        #endregion

        #region 设置是否显示filter

        if (this.divPipelineAnalysis.Visible == false &&
            this.divUserGoals.Visible == false)
        {
            this.divFilters.Visible = false;
        }

        #endregion

        #region UserHomePref.DashboardLastCompletedStages

        // StageFilter
        string sStageFilter = string.Empty;
        this.ddlStageFilter.Value = "CurrentStages";
        sStageFilter = "CurrentStages";

        if (UserHomePref2 != null && UserHomePref2.DashboardLastCompletedStages != null && UserHomePref2.DashboardLastCompletedStages == 1)
        {
            this.ddlStageFilter.Value = "LastCompletedStages";
            sStageFilter = "LastCompletedStages";
        }

        #endregion

        #region Quick Lead Form

        if (this.CurrentUser.QuickLeadForm == true)
        {
            this.divQuickLead.Visible = true;
        }
        else
        {
            this.divQuickLead.Visible = false;
        }

        #endregion

        #endregion

        string sErrorMsg = "Invalid query string, be ignored.";

        #region 获取页面参数

        int    iRegionID   = 0;
        int    iDivisionID = 0;
        string sRegionID   = string.Empty;
        string sDivisionID = string.Empty;

        string sBranchID = string.Empty;
        string sDateType = string.Empty;
        string sFromDate = string.Empty;
        string sToDate   = string.Empty;

        // Template_Stage.WorkflowType = Loan.Status
        string sWorkflowType = string.Empty;

        #region RegionID

        if (this.Request.QueryString["Region"] != null)
        {
            #region get region id

            string sRegionID_Encode = this.Request.QueryString["Region"].ToString();
            string sRegionID_Decode = Encrypter.Base64Decode(sRegionID_Encode);

            if (sRegionID_Decode == sRegionID_Encode)
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }
            bool IsValid = Regex.IsMatch(sRegionID_Decode, @"^(-)?\d+$");
            if (IsValid == false)
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }

            sRegionID = sRegionID_Decode;
            iRegionID = Convert.ToInt32(sRegionID_Decode);

            #endregion
        }

        #endregion

        #region DivisionID

        if (this.Request.QueryString["Division"] != null)
        {
            #region get division id

            string sDivisionID_Encode = this.Request.QueryString["Division"].ToString();
            string sDivisionID_Decode = Encrypter.Base64Decode(sDivisionID_Encode);

            if (sDivisionID_Decode == sDivisionID_Encode)
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }
            bool IsValid = Regex.IsMatch(sDivisionID_Decode, @"^(-)?\d+$");
            if (IsValid == false)
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }

            sDivisionID = sDivisionID_Decode;
            iDivisionID = Convert.ToInt32(sDivisionID_Decode);

            #endregion
        }

        #endregion

        #region BranchID

        if (this.Request.QueryString["Branch"] != null)
        {
            string sBranch_Encode = this.Request.QueryString["Branch"].ToString();
            sBranchID = Encrypter.Base64Decode(sBranch_Encode);
            if (sBranch_Encode == sBranchID)
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }
            bool IsValid = Regex.IsMatch(sBranchID, @"^(-)?\d+$");
            if (IsValid == false)
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }
        }

        #endregion

        #region Date Type

        if (this.Request.QueryString["DateType"] != null)
        {
            string sDateType_Encode = this.Request.QueryString["DateType"].ToString();
            sDateType = Encrypter.Base64Decode(sDateType_Encode);
            if (sDateType != "CloseDate" && sDateType != "OpenDate")
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }
        }
        else
        {
            sDateType = "CloseDate";
        }

        #endregion

        #region FromDate

        if (this.Request.QueryString["FromDate"] != null)
        {
            string sFromDate_Encode = this.Request.QueryString["FromDate"].ToString();
            sFromDate = Encrypter.Base64Decode(sFromDate_Encode);
            if (sFromDate_Encode == sFromDate)
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }
        }

        #endregion

        #region ToDate

        if (this.Request.QueryString["ToDate"] != null)
        {
            string sToDate_Encode = this.Request.QueryString["ToDate"].ToString();
            sToDate = Encrypter.Base64Decode(sToDate_Encode);
            if (sToDate_Encode == sToDate)
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }
        }

        #endregion

        #region Workflow Type

        if (this.Request.QueryString["WorkflowType"] != null)
        {
            string sWorkflowType_Encode = this.Request.QueryString["WorkflowType"].ToString();
            sWorkflowType = Encrypter.Base64Decode(sWorkflowType_Encode);
            if (sWorkflowType != "Processing" && sWorkflowType != "Prospect" && sWorkflowType != "Archived")
            {
                PageCommon.WriteJsEnd(this, sErrorMsg, "window.location.href = window.location.pathname");
            }
        }
        else
        {
            sWorkflowType = "Processing";
        }

        #endregion

        #region StageFilter

        if (this.Request.QueryString["StageFilter"] != null)
        {
            sStageFilter = this.Request.QueryString["StageFilter"].ToString();

            if (sStageFilter != "CurrentStages")
            {
                sStageFilter = "LastCompletedStages";
            }
        }

        #endregion


        #endregion

        #region load filters

        DataSet OrganFilters = PageCommon.GetOrganFilter(iRegionID, iDivisionID);

        // region filter
        DataTable RegionListData = OrganFilters.Tables["Regions"];
        this.ddlRegions.DataSource = RegionListData;
        this.ddlRegions.DataBind();

        // division filter
        DataTable DivisionListData = OrganFilters.Tables["Divisions"];
        this.ddlDivisions.DataSource = DivisionListData;
        this.ddlDivisions.DataBind();

        // branch filter
        DataTable BranchListData = OrganFilters.Tables["Branches"];
        this.ddlBranches.DataSource = BranchListData;
        this.ddlBranches.DataBind();

        #endregion

        #region Build Search Conditions

        string sWhere = string.Empty;

        // Loans.Status
        if (sWorkflowType == "Archived")
        {
            sWhere += " and (b.Status!='Processing') and (b.Status!='Prospect')";
            //CR063 : Remove the “Suspended” status in the list of the “Archived Loans” status
            sWhere += " AND (b.Status != 'Suspended')";
        }
        else
        {
            sWhere += " and (b.Status='" + sWorkflowType + "')";
        }

        if (sWorkflowType == "Prospect")
        {
            sWhere += " and (b.ProspectLoanStatus='Active')";
        }

        if (sRegionID != string.Empty)
        {
            sWhere += " and (a.RegionID = " + sRegionID + ")";
        }

        if (sDivisionID != string.Empty)
        {
            sWhere += " and (a.DivisionID = " + sDivisionID + ")";
        }

        if (sBranchID != string.Empty)
        {
            sWhere += " and (a.BranchID = " + sBranchID + ")";
        }

        if (sDateType != string.Empty)
        {
            #region FromDate and ToDate

            DateTime?FromDate = null;
            DateTime?ToDate   = null;

            if (sFromDate != string.Empty)
            {
                DateTime FromDate1;
                bool     IsDate1 = DateTime.TryParse(sFromDate, out FromDate1);
                if (IsDate1 == true)
                {
                    FromDate = FromDate1;
                }
            }

            if (sToDate != string.Empty)
            {
                DateTime ToDate1;
                bool     IsDate2 = DateTime.TryParse(sToDate, out ToDate1);
                if (IsDate2 == true)
                {
                    ToDate = ToDate1;
                }
            }

            string sFiledName = string.Empty;
            if (sDateType == "CloseDate")
            {
                sFiledName = "b.LastStageComplDate";
            }
            else
            {
                sFiledName = "b.LastStageComplDate";
            }

            sWhere += SqlTextBuilder.BuildDateSearchCondition(sFiledName, FromDate, ToDate);

            #endregion
        }

        #endregion

        #region Pipeline Summary

        #region get stage template list

        // loan manager
        LPWeb.BLL.Loans LoanManager = new LPWeb.BLL.Loans();

        if (sWorkflowType == "Archived")
        {
            #region init LoanAnalysisData

            this.LoanAnalysisData = new DataTable();
            this.LoanAnalysisData.Columns.Add("StageName", typeof(string));
            this.LoanAnalysisData.Columns.Add("StageAlias", typeof(string));
            this.LoanAnalysisData.Columns.Add("Href", typeof(string));
            this.LoanAnalysisData.Columns.Add("Amount", typeof(decimal));
            this.LoanAnalysisData.Columns.Add("LoanCounts", typeof(int)); //gdc CR40

            DataRow ClosedRow = this.LoanAnalysisData.NewRow();
            ClosedRow["StageName"]  = "Closed";
            ClosedRow["StageAlias"] = "Closed";
            ClosedRow["Href"]       = string.Empty;
            ClosedRow["Amount"]     = decimal.Zero;
            ClosedRow["LoanCounts"] = decimal.Zero;//gdc CR40
            this.LoanAnalysisData.Rows.Add(ClosedRow);

            DataRow CanceledRow = this.LoanAnalysisData.NewRow();
            CanceledRow["StageName"]  = "Canceled";
            CanceledRow["StageAlias"] = "Canceled";
            CanceledRow["Href"]       = string.Empty;
            CanceledRow["Amount"]     = decimal.Zero;
            CanceledRow["LoanCounts"] = decimal.Zero;//gdc CR40
            this.LoanAnalysisData.Rows.Add(CanceledRow);

            DataRow DeniedRow = this.LoanAnalysisData.NewRow();
            DeniedRow["StageName"]  = "Denied";
            DeniedRow["StageAlias"] = "Denied";
            DeniedRow["Href"]       = string.Empty;
            DeniedRow["Amount"]     = decimal.Zero;
            DeniedRow["LoanCounts"] = decimal.Zero;//gdc CR40
            this.LoanAnalysisData.Rows.Add(DeniedRow);

            //CR063 : Remove the “Suspended” status in the list of the “Archived Loans” status
            //DataRow SuspendedRow = this.LoanAnalysisData.NewRow();
            //SuspendedRow["StageName"] = "Suspended";
            //SuspendedRow["StageAlias"] = "Suspended";
            //SuspendedRow["Href"] = string.Empty;
            //SuspendedRow["Amount"] = decimal.Zero;
            //SuspendedRow["LoanCounts"] = decimal.Zero;//gdc CR40
            //this.LoanAnalysisData.Rows.Add(SuspendedRow);

            #endregion

            #region 添加Uncategorized分类

            DataRow UncategorizedRow = this.LoanAnalysisData.NewRow();
            UncategorizedRow["StageName"]  = "Uncategorized";
            UncategorizedRow["StageAlias"] = "Uncategorized";
            UncategorizedRow["Href"]       = string.Empty;
            UncategorizedRow["Amount"]     = decimal.Zero;
            UncategorizedRow["LoanCounts"] = decimal.Zero;//gdc CR40

            this.LoanAnalysisData.Rows.Add(UncategorizedRow);

            #endregion
        }
        else
        {
            string sSql2 = "select Name as StageName, Alias as StageAlias, '' as Href, 0.00 as Amount,0 as LoanCounts  from Template_Stages "
                           + "where WorkflowType=@WorkflowType and [Enabled]=1 order by SequenceNumber";
            SqlCommand SqlCmd2 = new SqlCommand(sSql2);
            DbHelperSQL.AddSqlParameter(SqlCmd2, "@WorkflowType", sWorkflowType);
            this.LoanAnalysisData = DbHelperSQL.ExecuteDataTable(SqlCmd2);

            #region 如果Lead,添加Uncategorized分类

            if (sWorkflowType == "Prospect")
            {
                DataRow NewStageTempRow = this.LoanAnalysisData.NewRow();
                NewStageTempRow["StageName"]  = "Uncategorized";
                NewStageTempRow["StageAlias"] = "Uncategorized";
                NewStageTempRow["Href"]       = string.Empty;
                NewStageTempRow["Amount"]     = decimal.Zero;
                NewStageTempRow["LoanCounts"] = decimal.Zero; //gdc CR40

                this.LoanAnalysisData.Rows.Add(NewStageTempRow);
            }

            #endregion
        }

        #endregion

        #region get user loan list

        string sStageField = string.Empty;

        if (sStageFilter == "CurrentStages")
        {
            sStageField = "b.Stage";
        }
        else
        {
            sStageField = "b.LastCompletedStage";
        }

        //string sSqlx1 = string.Format("select {0} as Stage, b.Amount as Amount from lpfn_GetUserLoans2({1}, {2}) as a inner join V_ProcessingPipelineInfo as b on a.LoanID = b.FileId ", sStageField, iCurrentUserID, (this.CurrentUser.bAccessOtherLoans)?1:0)
        //              + "where (1=1) " + sWhere;
        string sSqlx1 = "select " + sStageField + " as Stage, b.Amount as Amount from lpfn_GetUserLoans(" + this.iCurrentUserID + ") as a inner join V_ProcessingPipelineInfo as b on a.LoanID = b.FileId "
                        + "where (1=1) " + sWhere;
        DataTable UserLoanList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSqlx1);

        #endregion

        #region set Amount and Href
        foreach (DataRow LoanAnaylysisRow in this.LoanAnalysisData.Rows)
        {
            string sStageName  = LoanAnaylysisRow["StageName"].ToString();
            string sStageAlias = LoanAnaylysisRow["StageAlias"] == DBNull.Value ? LoanAnaylysisRow["StageName"].ToString() : LoanAnaylysisRow["StageAlias"].ToString();
            if (sStageName == "Uncategorized")
            {
                #region Amount

                string sSqlx10 = string.Empty;
                if (sWorkflowType == "Prospect")
                {
                    sSqlx10 = "select isnull(SUM(b.Amount),0.00) as TotalAmount,count(1) as Total  from lpfn_GetUserLoans(" + this.iCurrentUserID + ") as a inner join V_ProcessingPipelineInfo as b on a.LoanID=b.FileId "
                              + "where (select COUNT(1) from LoanStages where FileId=a.LoanID)=0 " + sWhere;
                }
                else if (sWorkflowType == "Archived")
                {
                    //string sWhere10 = sWhere.Replace(" and (b.Status!='Processing') and (b.Status!='Prospect')", " and b.Status='Uncategorized Archive'");
                    //CR063 : Remove the “Suspended” status in the list of the “Archived Loans” status
                    string sWhere10 = sWhere.Replace(" and (b.Status!='Processing') and (b.Status!='Prospect') AND (b.Status != 'Suspended')", " and b.Status='Uncategorized Archive'");

                    sSqlx10 = "select isnull(SUM(b.Amount),0.00) as TotalAmount,count(1) as Total   from lpfn_GetUserLoans(" + this.iCurrentUserID + ") as a inner join V_ProcessingPipelineInfo as b on a.LoanID=b.FileId "
                              + "where 1=1 " + sWhere10;
                }

                //object oSum = LPWeb.DAL.DbHelperSQL.ExecuteScalar(sSqlx10);
                //decimal dSum = oSum == DBNull.Value ? decimal.Zero : Convert.ToDecimal(oSum);
                //LoanAnaylysisRow["Amount"] = dSum;


                decimal dSum  = 0;
                int     Total = 0;

                var dt = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSqlx10);
                if (dt.Rows.Count > 0)
                {
                    dSum  = dt.Rows[0]["TotalAmount"] == DBNull.Value ? decimal.Zero : Convert.ToDecimal(dt.Rows[0]["TotalAmount"]);
                    Total = dt.Rows[0]["Total"] == DBNull.Value ? 0 : Convert.ToInt32(dt.Rows[0]["Total"]);
                }

                LoanAnaylysisRow["Amount"]     = dSum;
                LoanAnaylysisRow["LoanCounts"] = Total;

                #endregion

                #region Href

                string sPipelineUrl = string.Empty;
                if (sWorkflowType == "Prospect")
                {
                    string sAliasString = this.BuildQueryString_PipelineSummary(sRegionID, sDivisionID, sBranchID, sDateType, sFromDate, sToDate, sWorkflowType, sStageAlias, sStageFilter);
                    sPipelineUrl = "Pipeline/ProspectPipelineSummaryLoan.aspx?q=" + Encrypter.Base64Encode(sAliasString);
                }
                else if (sWorkflowType == "Archived")
                {
                    string sAliasString = this.BuildQueryString_PipelineSummary(sRegionID, sDivisionID, sBranchID, sDateType, sFromDate, sToDate, sStageAlias, string.Empty, sStageFilter);
                    sPipelineUrl = "Pipeline/ProcessingPipelineSummary.aspx?q=" + Encrypter.Base64Encode(sAliasString);
                }

                LoanAnaylysisRow["Href"] = sPipelineUrl;

                #endregion
            }
            else
            {
                #region Amount

                object oLoanAmount = null;
                //oLoanAmount = UserLoanList.Compute("Sum(Amount)", "Stage='" + sStageName + "'");
                oLoanAmount = UserLoanList.Compute("Sum(Amount)", "Stage='" + sStageAlias + "'");

                //gdc CR40
                object oLoanTotal = null;
                oLoanTotal = UserLoanList.Compute("Count(Amount)", "Stage='" + sStageAlias + "'");


                decimal dLoanAmount = decimal.Zero;
                int     iLoanTotal  = 0;

                if ((oLoanAmount != null) && (oLoanAmount != DBNull.Value))
                {
                    dLoanAmount = Convert.ToDecimal(oLoanAmount, null);
                }

                //gdc CR40
                if ((oLoanTotal != null) && (oLoanTotal != DBNull.Value))
                {
                    iLoanTotal = Convert.ToInt32(oLoanTotal, null);
                }

                LoanAnaylysisRow["Amount"]     = dLoanAmount;
                LoanAnaylysisRow["LoanCounts"] = iLoanTotal; //gdc CR40
                #endregion

                #region Href

                string sPipelineUrl = string.Empty;
                if (sWorkflowType == "Processing")
                {
                    string sAliasString = this.BuildQueryString_PipelineSummary(sRegionID, sDivisionID, sBranchID, sDateType, sFromDate, sToDate, sWorkflowType, sStageAlias, sStageFilter);
                    sPipelineUrl = "Pipeline/ProcessingPipelineSummary.aspx?q=" + Encrypter.Base64Encode(sAliasString);
                }
                else if (sWorkflowType == "Prospect")
                {
                    string sAliasString = this.BuildQueryString_PipelineSummary(sRegionID, sDivisionID, sBranchID, sDateType, sFromDate, sToDate, sWorkflowType, sStageAlias, sStageFilter);
                    sPipelineUrl = "Pipeline/ProspectPipelineSummaryLoan.aspx?q=" + Encrypter.Base64Encode(sAliasString);
                }
                else if (sWorkflowType == "Archived")
                {
                    string sAliasString = this.BuildQueryString_PipelineSummary(sRegionID, sDivisionID, sBranchID, sDateType, sFromDate, sToDate, sStageAlias, string.Empty, sStageFilter);
                    sPipelineUrl = "Pipeline/ProcessingPipelineSummary.aspx?q=" + Encrypter.Base64Encode(sAliasString);
                }

                string sHref = sPipelineUrl;
                LoanAnaylysisRow["Href"] = sHref;

                #endregion
            }
        }
        #endregion

        this.rptLoanAnalysis.DataSource = this.LoanAnalysisData;
        this.rptLoanAnalysis.DataBind();
        #endregion

        #region peter's codes

        string strRootUrl = "";
        if (null != ConfigurationManager.AppSettings["WPOWARootUrl"])
        {
            strRootUrl = ConfigurationManager.AppSettings["WPOWARootUrl"];
        }
        try
        {
            OWAInboxPart myInbox = new OWAInboxPart();
            myInbox.OWAServerAddressRoot = strRootUrl;
            myInbox.ViewName             = ConfigurationManager.AppSettings["WPOWAInboxViewName"];
            this.phInbox.Controls.Add(myInbox);
        }
        catch (Exception ex)
        {
            Label lbl = new Label();
            lbl.Text = "Failed to load Webpart OWAInbox error: " + ex.Message;
            this.phInbox.Controls.Add(lbl);
            LPLog.LogMessage(LogType.Logerror, "Failed to load Webpart OWAInbox error: " + ex.Message);
        }
        try
        {
            OWACalendarPart myCalendar = new OWACalendarPart();
            myCalendar.OWAServerAddressRoot = strRootUrl;
            myCalendar.ViewName             = ConfigurationManager.AppSettings["WPOWACalendarViewName"];
            this.phMyCalendar.Controls.Add(myCalendar);
        }
        catch (Exception ex)
        {
            Label lbl = new Label();
            lbl.Text = "Failed to load Webpart OWACalendar error: " + ex.Message;
            this.phMyCalendar.Controls.Add(lbl);
            LPLog.LogMessage(LogType.Logerror, "Failed to load Webpart OWACalendar error: " + ex.Message);
        }

        SPWeb web = this.Web;
        //SPList spList = web.Lists[System.Configuration.ConfigurationManager.AppSettings["WPComAnnName"]];
        //SPView spView = spList.Views[System.Configuration.ConfigurationManager.AppSettings["WPComAnnViewName"]];
        //this.xlvwpComAnn.ListId = spList.ID;
        //this.xlvwpComAnn.ListName = string.Format("{{{0}}}", spList.ID.ToString());
        //this.xlvwpComAnn.ViewGuid = spView.ID.ToString();

        #region =====show company announcement webpart=====

        if (this.CurrentUser.userRole.Announcements == true)
        {
            this.divCompanyAnn.Visible = true;
        }
        else
        {
            this.divCompanyAnn.Visible = false;
        }

        // User Home Profile
        if (UserHomePref2 != null)
        {
            if (UserHomePref2.Announcements == true)
            {
                this.divCompanyAnn.Visible = true;
            }
            else
            {
                this.divCompanyAnn.Visible = false;
            }
        }

        if (this.divCompanyAnn.Visible == true)
        {
            SPList spListComAnn = null;
            SPView spViewComAnn = null;
            try
            {
                spListComAnn = web.Lists[System.Configuration.ConfigurationManager.AppSettings["WPComAnnName"]];
            }
            catch
            {
                spListComAnn = null;
            }
            if (null != spListComAnn)
            {
                try
                {
                    spViewComAnn = spListComAnn.Views[System.Configuration.ConfigurationManager.AppSettings["WPComAnnViewName"]];
                }
                catch
                {
                    spViewComAnn = null;
                }
                if (null != spViewComAnn)
                {
                    strComAnnListUrl = spListComAnn.DefaultViewUrl;

                    XsltListViewWebPart xlvwpComAnn = new XsltListViewWebPart();
                    xlvwpComAnn.ListId   = spListComAnn.ID;
                    xlvwpComAnn.ListName = string.Format("{{{0}}}", spListComAnn.ID.ToString());
                    xlvwpComAnn.ViewGuid = spViewComAnn.ID.ToString();
                    //xlvwpComAnn.Toolbar = "None";
                    xlvwpComAnn.XmlDefinition = @"
    <View Name=""{EC6E2014-F0A2-4273-B6BC-1A9F00110341}"" MobileView=""TRUE"" Type=""HTML"" Hidden=""TRUE"" DisplayName="""" Url=""/SitePages/Home.aspx"" Level=""1"" BaseViewID=""1"" ContentTypeID=""0x"" ImageUrl=""/_layouts/images/announce.png"">
      <Query>
        <OrderBy>
          <FieldRef Name=""Modified"" Ascending=""FALSE""/>
        </OrderBy>
      </Query>
      <ViewFields>
        <FieldRef Name=""LinkTitle""/>
      </ViewFields>
      <RowLimit Paged=""TRUE"">5</RowLimit>
      <Toolbar Type=""None""/>
    </View>";
                    xlvwpComAnn.Xsl           = @"
    <xsl:stylesheet xmlns:x=""http://www.w3.org/2001/XMLSchema"" xmlns:d=""http://schemas.microsoft.com/sharepoint/dsp"" version=""1.0"" exclude-result-prefixes=""xsl msxsl ddwrt"" xmlns:ddwrt=""http://schemas.microsoft.com/WebParts/v2/DataView/runtime"" xmlns:asp=""http://schemas.microsoft.com/ASPNET/20"" xmlns:__designer=""http://schemas.microsoft.com/WebParts/v2/DataView/designer"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" xmlns:SharePoint=""Microsoft.SharePoint.WebControls"" xmlns:ddwrt2=""urn:frontpage:internal"" xmlns:o=""urn:schemas-microsoft-com:office:office"">
      <xsl:include href=""/_layouts/xsl/main.xsl""/>
      <xsl:include href=""/_layouts/xsl/internal.xsl""/>
      <xsl:param name=""AllRows"" select=""/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]""/>
      <xsl:param name=""dvt_apos"">'</xsl:param>

      <xsl:template name=""FieldRef_ValueOf.Modified"" ddwrt:dvt_mode=""body"" ddwrt:ghost="""" xmlns:ddwrt2=""urn:frontpage:internal"">
        <xsl:param name=""thisNode"" select="".""/>
        <span style=""color: #FF00FF"">
          <xsl:value-of select=""$thisNode/@*[name()=current()/@Name]"" />
        </span>
      </xsl:template>
    </xsl:stylesheet>";
                    this.phComAnn.Controls.Add(xlvwpComAnn);
                }
                else
                {
                    Label lbl = new Label();
                    lbl.Text = string.Format("Can not find the specified webpart view with name \"{0}\".",
                                             System.Configuration.ConfigurationManager.AppSettings["WPComAnnViewName"]);
                    this.phComAnn.Controls.Add(lbl);
                }
            }
            else
            {
                Label lbl = new Label();
                lbl.Text = string.Format("Can not find the specified webpart with name \"{0}\".",
                                         System.Configuration.ConfigurationManager.AppSettings["WPComAnnName"]);
                this.phComAnn.Controls.Add(lbl);
            }
        }
        #endregion

        #region =====show company calendar webpart=====

        if (this.CurrentUser.userRole.CompanyCalendar == true)
        {
            this.divComCal.Visible = true;
        }
        else
        {
            this.divComCal.Visible = false;
        }

        // User Home Profile
        if (UserHomePref2 != null)
        {
            if (UserHomePref2.CompanyCalendar == true)
            {
                this.divComCal.Visible = true;
            }
            else
            {
                this.divComCal.Visible = false;
            }
        }

        if (this.divComCal.Visible == true)
        {
            SPList spListComCal = null;
            SPView spViewComCal = null;
            try
            {
                spListComCal = web.Lists[System.Configuration.ConfigurationManager.AppSettings["WPComCalName"]];
            }
            catch
            {
                spListComCal = null;
            }
            if (null != spListComCal)
            {
                try
                {
                    spViewComCal = spListComCal.Views[System.Configuration.ConfigurationManager.AppSettings["WPComCalViewName"]];
                }
                catch
                {
                    spViewComCal = null;
                }
                if (null != spViewComCal)
                {
                    strComCalListUrl = spListComCal.DefaultViewUrl;

                    XsltListViewWebPart xlvwpComCal = new XsltListViewWebPart();
                    xlvwpComCal.ListId   = spListComCal.ID;
                    xlvwpComCal.ListName = string.Format("{{{0}}}", spListComCal.ID.ToString());
                    xlvwpComCal.ViewGuid = spViewComCal.ID.ToString();
                    //xlvwpComCal.Toolbar = "None";
                    xlvwpComCal.XmlDefinition = @"<View Name=""{3A64E1C5-8CDF-418C-A94F-5E66F61EB5CF}"" MobileView=""TRUE"" Type=""HTML"" Hidden=""TRUE"" DisplayName="""" Url=""/SitePages/Test webparts.aspx"" Level=""1"" BaseViewID=""2"" ContentTypeID=""0x"" MobileUrl=""_layouts/mobile/viewdaily.aspx"" ImageUrl=""/_layouts/images/events.png"">
				<Query>
					<Where>
						<DateRangesOverlap>
							<FieldRef Name=""EventDate""/>
							<FieldRef Name=""EndDate""/>
							<FieldRef Name=""RecurrenceID""/>
							<Value Type=""DateTime"">
								<Month/>
							</Value>
						</DateRangesOverlap>
					</Where>
				</Query>
				<ViewFields>
					<FieldRef Name=""Title""/>
					<FieldRef Name=""EventDate""/>
				</ViewFields>
				<Toolbar Type=""None""/>
			</View>"            ;
                    xlvwpComCal.Xsl           = @"<xsl:stylesheet xmlns:x=""http://www.w3.org/2001/XMLSchema"" xmlns:d=""http://schemas.microsoft.com/sharepoint/dsp"" version=""1.0"" exclude-result-prefixes=""xsl msxsl ddwrt"" xmlns:ddwrt=""http://schemas.microsoft.com/WebParts/v2/DataView/runtime"" xmlns:asp=""http://schemas.microsoft.com/ASPNET/20"" xmlns:__designer=""http://schemas.microsoft.com/WebParts/v2/DataView/designer"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" xmlns:SharePoint=""Microsoft.SharePoint.WebControls"" xmlns:ddwrt2=""urn:frontpage:internal"" xmlns:o=""urn:schemas-microsoft-com:office:office""> 
  <xsl:include href=""/_layouts/xsl/main.xsl""/> 
  <xsl:include href=""/_layouts/xsl/internal.xsl""/> 
            <xsl:param name=""AllRows"" select=""/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]""/>
            <xsl:param name=""dvt_apos"">'</xsl:param>
			<xsl:template name=""FieldRef_Recurrence_body.fRecurrence"" ddwrt:dvt_mode=""body"" match=""FieldRef[@Name='fRecurrence']"" mode=""Recurrence_body"" ddwrt:ghost="""" xmlns:ddwrt2=""urn:frontpage:internal"">
                <xsl:param name=""thisNode"" select="".""/>
                <xsl:variable name=""fRecurrence"" select=""$thisNode/@*[name()=current()/@Name]""/>
                <xsl:variable name=""src"">/_layouts/images/
					<xsl:choose>
                        <xsl:when test=""$fRecurrence='1'"">
                            <xsl:choose>
                                <xsl:when test=""$thisNode/@EventType='3'"">recurEx.gif</xsl:when>
                                <xsl:when test=""$thisNode/@EventType='4'"">recurEx.gif</xsl:when>
                                <xsl:otherwise>recur.gif</xsl:otherwise>
                            </xsl:choose>
        </xsl:when>
                        <xsl:otherwise>blank.gif</xsl:otherwise>
                    </xsl:choose>
    </xsl:variable>
                <xsl:variable name=""alt"">
                    <xsl:if test=""$fRecurrence='1'"">
                        <xsl:choose>
                            <xsl:when test=""@EventType='3'"">
            <xsl:value-of select=""'Exception to Recurring Event'""/>
          </xsl:when>
                            <xsl:when test=""@EventType='4'"">
            <xsl:value-of select=""'Exception to Recurring Event'""/>
          </xsl:when>
                            <xsl:otherwise>
            <xsl:value-of select=""'Recurring Event'""/>
          </xsl:otherwise>
                        </xsl:choose>
      </xsl:if>
    </xsl:variable>
    <img border=""0"" width=""16"" height=""16"" src=""/_layouts/images/
			blank.gif"" alt=""{$alt}"" title=""{$alt}""/>
  </xsl:template></xsl:stylesheet>";
                    this.phComCal.Controls.Add(xlvwpComCal);
                }
                else
                {
                    Label lbl = new Label();
                    lbl.Text = string.Format("Can not find the specified webpart view with name \"{0}\".",
                                             System.Configuration.ConfigurationManager.AppSettings["WPComCalViewName"]);
                    this.phComCal.Controls.Add(lbl);
                }
            }
            else
            {
                Label lbl = new Label();
                lbl.Text = string.Format("Can not find the specified webpart with name \"{0}\".",
                                         System.Configuration.ConfigurationManager.AppSettings["WPComCalName"]);
                this.phComCal.Controls.Add(lbl);
            }
        }
        #endregion

        #region =====show rates sheet webpart=====

        if (this.CurrentUser.userRole.RateSummary == true)
        {
            this.divRates.Visible = true;
        }
        else
        {
            this.divRates.Visible = false;
        }

        // User Home Profile
        if (UserHomePref2 != null)
        {
            if (UserHomePref2.RateSummary == true)
            {
                this.divRates.Visible = true;
            }
            else
            {
                this.divRates.Visible = false;
            }
        }

        if (this.divRates.Visible == true)
        {
            SPList spListRates = null;
            SPView spViewRates = null;
            try
            {
                spListRates = web.Lists[System.Configuration.ConfigurationManager.AppSettings["WPRatesName"]];
            }
            catch
            {
                spListRates = null;
            }
            if (null != spListRates)
            {
                try
                {
                    spViewRates = spListRates.Views[System.Configuration.ConfigurationManager.AppSettings["WPRatesViewName"]];
                }
                catch
                {
                    spViewRates = null;
                }
                if (null != spViewRates)
                {
                    strRatesListUrl = spListRates.DefaultViewUrl;

                    XsltListViewWebPart xlvwpRates = new XsltListViewWebPart();
                    xlvwpRates.ListId   = spListRates.ID;
                    xlvwpRates.ListName = string.Format("{{{0}}}", spListRates.ID.ToString());
                    xlvwpRates.ViewGuid = spViewRates.ID.ToString();
                    //xlvwpRates.Toolbar = "None";
                    xlvwpRates.XmlDefinition = @"<View Name=""{FE66F61E-EBF7-49E8-BD37-F9955793DDCE}"" MobileView=""TRUE"" Type=""HTML"" Hidden=""TRUE"" DisplayName="""" Url=""/SitePages/Test webparts.aspx"" Level=""1"" BaseViewID=""1"" ContentTypeID=""0x"" ImageUrl=""/_layouts/images/dlicon.png"">
				<Query>
					<OrderBy>
						<FieldRef Name=""FileLeafRef""/>
					</OrderBy>
				</Query>
				<ViewFields>
					<FieldRef Name=""LinkFilename""/>
				</ViewFields>
				<RowLimit Paged=""TRUE"">30</RowLimit>
				<Toolbar Type=""None""/>
			</View>"            ;
                    xlvwpRates.Xsl           = @"
    <xsl:stylesheet xmlns:x=""http://www.w3.org/2001/XMLSchema"" xmlns:d=""http://schemas.microsoft.com/sharepoint/dsp"" version=""1.0"" exclude-result-prefixes=""xsl msxsl ddwrt"" xmlns:ddwrt=""http://schemas.microsoft.com/WebParts/v2/DataView/runtime"" xmlns:asp=""http://schemas.microsoft.com/ASPNET/20"" xmlns:__designer=""http://schemas.microsoft.com/WebParts/v2/DataView/designer"" xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:msxsl=""urn:schemas-microsoft-com:xslt"" xmlns:SharePoint=""Microsoft.SharePoint.WebControls"" xmlns:ddwrt2=""urn:frontpage:internal"" xmlns:o=""urn:schemas-microsoft-com:office:office"">
      <xsl:include href=""/_layouts/xsl/main.xsl""/>
      <xsl:include href=""/_layouts/xsl/internal.xsl""/>
      <xsl:param name=""AllRows"" select=""/dsQueryResponse/Rows/Row[$EntityName = '' or (position() &gt;= $FirstRow and position() &lt;= $LastRow)]""/>
      <xsl:param name=""dvt_apos"">'</xsl:param>

      <xsl:template name=""FieldRef_ValueOf.Modified"" ddwrt:dvt_mode=""body"" ddwrt:ghost="""" xmlns:ddwrt2=""urn:frontpage:internal"">
        <xsl:param name=""thisNode"" select="".""/>
        <span style=""color: #FF00FF"">
          <xsl:value-of select=""$thisNode/@*[name()=current()/@Name]"" />
        </span>
      </xsl:template>
    </xsl:stylesheet>";
                    this.phRates.Controls.Add(xlvwpRates);
                }
                else
                {
                    Label lbl = new Label();
                    lbl.Text = string.Format("Can not find the specified webpart view with name \"{0}\".",
                                             System.Configuration.ConfigurationManager.AppSettings["WPComCalViewName"]);
                    this.phRates.Controls.Add(lbl);
                }
            }
            else
            {
                Label lbl = new Label();
                lbl.Text = string.Format("Can not find the specified webpart with name \"{0}\".",
                                         System.Configuration.ConfigurationManager.AppSettings["WPRatesName"]);
                this.phRates.Controls.Add(lbl);
            }
        }
        #endregion

        #endregion
    }
示例#9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 校验页面参数

        if (this.Request.QueryString["CloseDialogCodes"] == null)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", "try{window.parent.location.href=window.parent.location.href}catch{}");
        }

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

        bool bIsValid = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID);

        if (bIsValid == false)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", sCloseDialogCodes);
        }

        string sFileID = this.Request.QueryString["FileID"].ToString();
        this.iFileID = Convert.ToInt32(sFileID);

        #endregion

        #region 获取Borrower和Property信息

        #region Property

        LPWeb.BLL.Loans LoanManager = new LPWeb.BLL.Loans();
        DataTable       LoanInfo    = LoanManager.GetLoanInfo(this.iFileID);
        if (LoanInfo.Rows.Count == 0)
        {
            PageCommon.WriteJsEnd(this, "Invalid query string.", sCloseDialogCodes);
        }
        string sPropertyAddress = LoanInfo.Rows[0]["PropertyAddr"].ToString();
        string sPropertyCity    = LoanInfo.Rows[0]["PropertyCity"].ToString();
        string sPropertyState   = LoanInfo.Rows[0]["PropertyState"].ToString();
        string sPropertyZip     = LoanInfo.Rows[0]["PropertyZip"].ToString();

        string sProperty = sPropertyAddress + ", " + sPropertyCity + ", " + sPropertyState + " " + sPropertyZip;

        #endregion

        #region Borrower

        DataTable BorrowerInfo = LoanManager.GetBorrowerInfo(this.iFileID);
        if (BorrowerInfo.Rows.Count == 0)
        {
            PageCommon.WriteJsEnd(this, "There is no Borrower in this loan.", sCloseDialogCodes);
        }
        string sFirstName  = BorrowerInfo.Rows[0]["FirstName"].ToString();
        string sMiddleName = BorrowerInfo.Rows[0]["MiddleName"].ToString();
        string sLastName   = BorrowerInfo.Rows[0]["LastName"].ToString();

        string sBorrower = sLastName + ",  " + sFirstName;
        if (sMiddleName != string.Empty)
        {
            sBorrower += " " + sMiddleName;
        }

        this.lbBorrower.Text = sBorrower;
        this.lbProperty.Text = sProperty;

        #endregion

        #endregion

        #region 查询条件

        string sWhere = string.Empty;

        if (this.Request.QueryString["search"] == null)    // 未设置查询条件
        {
            sWhere = " (1=0)";
        }
        else
        {
            //sWhere = " (FileId <> " + this.iFileID + ")";
            sWhere = " (1=1) ";
            // Service Type
            if (this.Request.QueryString["ServiceType"] != null)
            {
                string sServiceType = this.Request.QueryString["ServiceType"];

                sWhere += "  and ServiceTypes='" + sServiceType + "'";
            }

            // Company
            if (this.Request.QueryString["Company"] != null)
            {
                string sCompany = this.Request.QueryString["Company"];

                sWhere += " and CompanyName like '" + sCompany + "%'";
            }

            // Zip
            if (this.Request.QueryString["Zip"] != null)
            {
                string sZip = this.Request.QueryString["Zip"];

                sWhere += " and MailingZip like '" + sZip + "%'";
            }
        }

        #endregion

        #region 排序

        string sOrderByField = "ContactsName";
        if (this.Request.QueryString["OrderByField"] != null)
        {
            sOrderByField = this.Request.QueryString["OrderByField"];
        }

        int iOrderByType = 0;  // default asc
        if (this.Request.QueryString["OrderByType"] != null)
        {
            string sOrderByType = this.Request.QueryString["OrderByType"];
            if (sOrderByType != "0")
            {
                sOrderByType = "1";
            }

            iOrderByType = Convert.ToInt32(sOrderByType);
        }

        #endregion

        if (this.IsPostBack == false)
        {
            #region 加载Service Type Filter

            string    sSql2           = "select * from ServiceTypes where Enabled=1 order by Name";
            DataTable ServiceTypeList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql2);

            DataRow AllRow = ServiceTypeList.NewRow();
            AllRow["ServiceTypeId"] = 0;
            AllRow["Name"]          = "All";
            AllRow["Enabled"]       = true;

            ServiceTypeList.Rows.InsertAt(AllRow, 0);

            this.ddlServiceType.DataSource = ServiceTypeList;
            this.ddlServiceType.DataBind();

            #endregion

            #region 加载Contact Role Filter

            string    sSql3           = "select * from ContactRoles where Enabled=1 and Name <> 'Borrower' and Name <> 'CoBorrower' order by Name";
            DataTable ContactRoleList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql3);

            DataRow EmptyRow = ContactRoleList.NewRow();
            EmptyRow["ContactRoleId"] = 0;
            EmptyRow["Name"]          = "-- select --";
            EmptyRow["Enabled"]       = true;

            ContactRoleList.Rows.InsertAt(EmptyRow, 0);

            this.ddlContactRole.DataSource = ContactRoleList;
            this.ddlContactRole.DataBind();

            #endregion

            #region 加载Contact List

            int iPageSize  = this.AspNetPager1.PageSize;
            int iPageIndex = 1;
            if (this.Request.QueryString["PageIndex"] != null)
            {
                iPageIndex = Convert.ToInt32(this.Request.QueryString["PageIndex"]);
            }

            int iRowCount = 0;

            LPWeb.BLL.LoanContacts contacts = new LPWeb.BLL.LoanContacts();
            DataSet ds = contacts.GetDistinctLoanContactsForReassign(iPageSize, iPageIndex, sWhere, out iRowCount, sOrderByField, iOrderByType);

            this.AspNetPager1.RecordCount = iRowCount;

            #region set EmptyDataText

            if (this.Request.QueryString["search"] == null)
            {
                this.gridLoanContactList.EmptyDataText = "Please enter conditions and click Display.";
            }
            else
            {
                if (iRowCount == 0)
                {
                    this.gridLoanContactList.EmptyDataText = "There is no loan contact by the conditions.";
                }
            }

            #endregion

            this.gridLoanContactList.DataSource = ds;
            this.gridLoanContactList.DataBind();



            #endregion
        }
    }
示例#10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region 校验页面参数

        if (this.Request.QueryString["CloseDialogCodes"] == null)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", "try{window.parent.location.href=window.parent.location.href}catch{}");
        }

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

        bool bIsValid = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID);

        if (bIsValid == false)
        {
            PageCommon.WriteJsEnd(this, "Missing required query string.", sCloseDialogCodes);
        }

        string sFileID = this.Request.QueryString["FileID"].ToString();
        this.iFileID = Convert.ToInt32(sFileID);

        #endregion

        #region 获取Borrower和Property信息

        #region Property

        LPWeb.BLL.Loans LoanManager = new LPWeb.BLL.Loans();
        DataTable       LoanInfo    = LoanManager.GetLoanInfo(this.iFileID);
        if (LoanInfo.Rows.Count == 0)
        {
            PageCommon.WriteJsEnd(this, "Invalid query string.", sCloseDialogCodes);
        }
        string sPropertyAddress = LoanInfo.Rows[0]["PropertyAddr"].ToString();
        string sPropertyCity    = LoanInfo.Rows[0]["PropertyCity"].ToString();
        string sPropertyState   = LoanInfo.Rows[0]["PropertyState"].ToString();
        string sPropertyZip     = LoanInfo.Rows[0]["PropertyZip"].ToString();

        string sProperty = sPropertyAddress + ", " + sPropertyCity + ", " + sPropertyState + " " + sPropertyZip;

        #endregion

        #region Borrower

        DataTable BorrowerInfo = LoanManager.GetBorrowerInfo(this.iFileID);
        if (BorrowerInfo.Rows.Count == 0)
        {
            PageCommon.WriteJsEnd(this, "There is no Borrower in this loan.", sCloseDialogCodes);
        }
        string sFirstName  = BorrowerInfo.Rows[0]["FirstName"].ToString();
        string sMiddleName = BorrowerInfo.Rows[0]["MiddleName"].ToString();
        string sLastName1  = BorrowerInfo.Rows[0]["LastName"].ToString();

        string sBorrower = sLastName1 + ",  " + sFirstName;
        if (sMiddleName != string.Empty)
        {
            sBorrower += " " + sMiddleName;
        }

        this.lbBorrower.Text = sBorrower;
        this.lbProperty.Text = sProperty;

        #endregion

        #endregion

        #region 查询条件

        string sWhere = string.Empty;

        if (this.Request.QueryString["search"] == null)    // 未设置查询条件
        {
            sWhere = " and (1=0)";
        }
        else
        {
            sWhere = "";

            // Branch
            if (this.Request.QueryString["Branch"] != null)
            {
                string sBranch = this.Request.QueryString["Branch"];

                //gdc 20120621 #1794
                sWhere += " And UserId IN ( SELECT u.UserId from Users as u ";
                sWhere += "     left outer join GroupUsers as c on u.UserId=c.UserID ";
                sWhere += "     left outer join Groups as d on c.GroupID=d.GroupId ";
                sWhere += "     left outer join Branches as e on d.BranchID=e.BranchId ";
                sWhere += "     where e.BranchId = " + sBranch;
                sWhere += "     ) ";
            }

            // Company
            if (this.Request.QueryString["UserRole"] != null)
            {
                string sUserRole = this.Request.QueryString["UserRole"];

                sWhere += " and RoleId=" + sUserRole;
            }

            // Last Name
            if (this.Request.QueryString["LastName"] != null)
            {
                string sLastName = this.Request.QueryString["LastName"];

                sWhere += " and LastName like '" + sLastName + "%'";
            }
        }

        #endregion

        #region 排序

        string sOrderByField = "FullName";
        if (this.Request.QueryString["OrderByField"] != null)
        {
            sOrderByField = this.Request.QueryString["OrderByField"];
        }

        string sOrderByType = "asc";  // default asc
        if (this.Request.QueryString["OrderByType"] != null)
        {
            sOrderByType = this.Request.QueryString["OrderByType"];
            if (sOrderByType != "asc" && sOrderByType != "desc")
            {
                sOrderByType = "asc";
            }
        }

        #endregion

        if (this.IsPostBack == false)
        {
            #region 加载Branch Filter
            string sSql2 = string.Empty;
            if (CurrUser.bIsCompanyExecutive)
            {
                sSql2 = "Select BranchId, [Name] from Branches where [Enabled]=1 order by [Name]";
            }
            else if (CurrUser.bIsRegionExecutive || CurrUser.bIsDivisionExecutive)
            {
                sSql2 = string.Format("select a.BranchID, b.Name from dbo.lpfn_GetUserBranches_Executive({0}) as a inner join Branches as b on a.BranchID=b.BranchId where b.Enabled=1 order by b.Name", CurrUser.iUserID);
            }
            else if (CurrUser.bIsBranchManager)
            {
                sSql2 = string.Format("select a.BranchID, b.Name from dbo.lpfn_GetUserBranches_Branch_Manager({0}) as a inner join Branches as b on a.BranchID=b.BranchId where b.Enabled=1 order by b.Name", CurrUser.iUserID);
            }
            else
            {
                sSql2 = string.Format("select a.BranchID, b.Name from dbo.lpfn_GetUserBranches({0}) as a inner join Branches as b on a.BranchID=b.BranchId where b.Enabled=1 order by b.Name", CurrUser.iUserID);
            }
            DataTable BranchList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql2);

            DataRow AllRow = BranchList.NewRow();
            AllRow["BranchId"] = 0;
            AllRow["Name"]     = "All";

            BranchList.Rows.InsertAt(AllRow, 0);

            this.ddlBranch.DataSource = BranchList;
            this.ddlBranch.DataBind();

            #endregion

            #region 加载User Role Filter

            string    sSql3        = "select RoleId, Name from Roles where Name in ('Branch Manager','Closer','Doc Prep', 'Jr Processor','Loan Officer','Loan Officer Assistant','Processor','Shipper','Underwriter') order by Name";
            DataTable UserRoleList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql3);

            DataTable LoanRoleList = UserRoleList.Copy();

            DataRow AllUserRoleRow = UserRoleList.NewRow();
            AllUserRoleRow["RoleId"] = 0;
            AllUserRoleRow["Name"]   = "All";

            UserRoleList.Rows.InsertAt(AllUserRoleRow, 0);

            this.ddlUserRole.DataSource = UserRoleList;
            this.ddlUserRole.DataBind();

            #endregion

            #region 加载Loan Role Filter

            DataRow AllLoanRoleRow = LoanRoleList.NewRow();
            AllLoanRoleRow["RoleId"] = 0;
            AllLoanRoleRow["Name"]   = "-- select --";

            LoanRoleList.Rows.InsertAt(AllLoanRoleRow, 0);

            this.ddlLoanRole.DataSource = LoanRoleList;
            this.ddlLoanRole.DataBind();

            #endregion

            #region 加载Contact List

            string sSql = "select * from ( "
                          + "select a.UserId,a.LastName,dbo.lpfn_GetUserName(a.UserId) as FullName,' ' as BranchId, ' ' as BranchName,a.RoleId,b.Name as UserRole " //gdc 20120621 #1794
                          + "from Users as a "
                          + "left outer join Roles as b on a.RoleId=b.RoleId "
                          //+ "left outer join GroupUsers as c on a.UserId=c.UserID "  //gdc 20120621 #1794
                          //+ "left outer join Groups as d on c.GroupID=d.GroupId "       //gdc 20120621 #1794
                          //+ "left outer join Branches as e on d.BranchID=e.BranchId "   //gdc 20120621 #1794
                          + " where a.UserEnabled=1 and a.UserId not in (select UserID from LoanTeam where FileId=" + iFileID + ")) as m "
                          + "where 1=1 " + sWhere;

            #region get row count

            int iRowCount = this.GetLoanTeamListRowCount(sSql, sWhere);
            this.AspNetPager1.RecordCount = iRowCount;

            #endregion

            int iPageSize  = this.AspNetPager1.PageSize;
            int iPageIndex = 1;
            if (this.Request.QueryString["PageIndex"] != null)
            {
                iPageIndex = Convert.ToInt32(this.Request.QueryString["PageIndex"]);
            }

            DataTable LoanTeamList = this.GetLoanTeamList(sSql, iRowCount, iPageSize, iPageIndex, sOrderByField, sOrderByType);

            #region UserBranchInfo gdc 20120621 #1794
            // Get user branch info
            LPWeb.BLL.Users UsersManager = new LPWeb.BLL.Users();
            DataTable       dtUserBranch = new DataTable();
            dtUserBranch = UsersManager.GetUserBranchInfo();

            if (null != dtUserBranch)
            {
                foreach (DataRow item in LoanTeamList.Rows)
                {
                    var nUserID     = item["UserId"].ToString();
                    var sUserBranch = item["BranchName"].ToString();

                    // concatenates all user branch names, using "," between each name
                    StringBuilder sbBName = new StringBuilder();
                    DataRow[]     drs     = dtUserBranch.Select(string.Format("UserId={0}", nUserID));
                    if (null != drs)
                    {
                        foreach (DataRow row in drs)
                        {
                            if (sbBName.Length > 0)
                            {
                                sbBName.Append(", ");
                            }
                            sbBName.Append(row["Name"]);
                        }
                    }
                    //int nDisLen = 30;
                    //if (sbBName.Length > nDisLen)
                    //{
                    //    lblBranch.ToolTip = sbBName.ToString();
                    //    lblBranch.Text = sbBName.ToString().Substring(0, nDisLen) + "...";
                    //}
                    //else
                    //    lblBranch.Text = sbBName.ToString();

                    item["BranchName"] = sbBName.ToString();
                }
            }
            #endregion

            #region set EmptyDataText

            if (this.Request.QueryString["search"] == null)
            {
                this.gridLoanTeamList.EmptyDataText = "Please enter conditions and click Display.";
            }
            else
            {
                if (iRowCount == 0)
                {
                    this.gridLoanTeamList.EmptyDataText = "There is no loan team by the conditions.";
                }
            }

            #endregion

            this.gridLoanTeamList.DataSource = LoanTeamList;
            this.gridLoanTeamList.DataBind();

            #endregion
        }
    }
示例#11
0
    public void BindData()
    {
        LPWeb.BLL.Loans    bllLoans    = new LPWeb.BLL.Loans();
        LPWeb.BLL.LoanTeam bllLoanTeam = new LPWeb.BLL.LoanTeam();
        LPWeb.BLL.Users    bllUsers    = new LPWeb.BLL.Users();
        LPWeb.Model.Loans  loanInfo    = bllLoans.GetModel(LoanID);

        DataTable LoanInfo_datatable = bllLoans.GetLoanInfo(LoanID);
        decimal   loanAmount         = 0;

        LoanPointFields LoanPointFieldsMgr = new LoanPointFields();

        //LPWeb.Model.LoanPointFields PointFieldInfo = LoanPointFieldsMgr.GetPointFieldInfo(LoanID, 21017);
        LPWeb.Model.LoanPointFields PointFieldInfo = LoanPointFieldsMgr.GetModel(LoanID, 21017);
        if (PointFieldInfo != null && !string.IsNullOrEmpty(PointFieldInfo.CurrentValue))
        {
            decimal.TryParse(PointFieldInfo.CurrentValue, out loanAmount);
        }
        if (loanAmount <= 0 && LoanInfo_datatable != null && LoanInfo_datatable.Rows.Count > 0)
        {
            loanAmount = LoanInfo_datatable.Rows[0]["LoanAmount"] == DBNull.Value ? 0 : (decimal)LoanInfo_datatable.Rows[0]["LoanAmount"];
        }
        this.labLoanamount.Text = loanAmount.ToString("n2");

        var list = new List <ViewCompDetail>();

        var Lo = new ViewCompDetail();

        Lo.Type = "Loan Officer";
        var LOUserId = bllLoanTeam.GetLoanOfficerID(LoanID);

        Lo.Name   = bllLoanTeam.GetLoanOfficer(LoanID);
        Lo.Rate   = GetUserCompRate(LOUserId);
        Lo.Amount = Lo.Rate * loanAmount / 100.00M;
        list.Add(Lo);


        loanInfo.BranchID = loanInfo.BranchID != null ? loanInfo.BranchID : 0;
        var branchM = new ViewCompDetail();

        branchM.Type = "Branch Manager";
        LPWeb.BLL.BranchManagers bllbranM = new LPWeb.BLL.BranchManagers();
        var branchUserId = 0;
        var branchObj    = bllbranM.GetModelList("BranchId =" + loanInfo.BranchID).FirstOrDefault();

        if (branchObj != null)
        {
            branchUserId = branchObj.BranchMgrId;
        }

        LPWeb.Model.Users userBrM = bllUsers.GetModel(branchUserId);
        if (userBrM != null && userBrM.UserId == branchUserId)
        {
            branchM.Name   = userBrM.LastName + "," + userBrM.FirstName;
            branchM.Rate   = GetBranchMgrCompRate(LOUserId);
            branchM.Amount = branchM.Rate * loanAmount / 100.00M;
        }
        list.Add(branchM);


        loanInfo.DivisionID = loanInfo.DivisionID != null ? loanInfo.DivisionID : 0;
        var divisionM = new ViewCompDetail();

        divisionM.Type = "Division Manager";
        LPWeb.BLL.DivisionExecutives bllDivM = new LPWeb.BLL.DivisionExecutives();
        var DivMUserId = 0;
        var divobj     = bllDivM.GetModelList("DivisionId =" + loanInfo.DivisionID).FirstOrDefault();

        if (divobj != null)
        {
            DivMUserId = divobj.ExecutiveId;
        }

        LPWeb.Model.Users userDivM = bllUsers.GetModel(DivMUserId);
        if (userDivM != null && userDivM.UserId == DivMUserId)
        {
            divisionM.Name   = userDivM.LastName + "," + userDivM.FirstName;
            divisionM.Rate   = GetDivisionMgrCompRate(LOUserId);
            divisionM.Amount = divisionM.Rate * loanAmount / 100.00M;
        }
        list.Add(divisionM);

        loanInfo.RegionID = loanInfo.RegionID != null ? loanInfo.RegionID : 0;
        var RegionM = new ViewCompDetail();

        RegionM.Type = "Region Manager";
        LPWeb.BLL.RegionExecutives bllRegionM = new LPWeb.BLL.RegionExecutives();
        var RegionMUserId = 0;
        var regionObj     = bllRegionM.GetModelList("RegionId =" + loanInfo.RegionID).FirstOrDefault();

        if (regionObj != null)
        {
            RegionMUserId = regionObj.ExecutiveId;
        }

        LPWeb.Model.Users userRegionM = bllUsers.GetModel(RegionMUserId);
        if (userRegionM != null && userRegionM.UserId == RegionMUserId)
        {
            RegionM.Name   = userRegionM.LastName + "," + userRegionM.FirstName;
            RegionM.Rate   = GetRegionMgrCompRate(LOUserId);
            RegionM.Amount = RegionM.Rate * loanAmount / 100.00M;
        }
        list.Add(RegionM);


        gvCompDetail.DataSource = list;
        gvCompDetail.DataBind();
    }