protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["html"] == null && this.Request.QueryString["id"] == null) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing1", "alert('Missing required query string.');window.close();", true); return; } string sHtmlBody = ""; if (this.Request.QueryString["html"] != null) { string sHtmlBody_Encode = this.Request.QueryString["html"].ToString(); sHtmlBody = Encrypter.Base64Decode(sHtmlBody_Encode); } else if (this.Request.QueryString["id"] != null) { int iEmailTemplateID = Convert.ToInt32(this.Request.QueryString["id"]); LPWeb.BLL.Template_Email emailTempMgr = new Template_Email(); LPWeb.Model.Template_Email emailTempModel = emailTempMgr.GetModel(iEmailTemplateID); if (emailTempModel.TemplEmailId > 0) { sHtmlBody = GetEmailTemplateContentWithEmailSkin(emailTempModel.EmailSkinId, emailTempModel.Content); } else { sHtmlBody = emailTempModel.Content; } } this.ltEmailBody.Text = sHtmlBody; }
protected void Page_Load(object sender, EventArgs e) { var IDs = ""; if (string.IsNullOrEmpty(Request.QueryString["IDs"])) { Response.Write("<script>alert('Error IDs');</script>"); Response.End(); return; } IDs = Request.QueryString["IDs"].ToString(); IDs = IDs.EndsWith(",") ? IDs.Remove(IDs.Length - 1, 1) : IDs; try { isAll = (string.IsNullOrEmpty(Request.QueryString["IsAll"]) || Request.QueryString["IsAll"] == "0") ? false : true; queryCondition = string.IsNullOrEmpty(Request.QueryString["queryCondition"]) ? "" : Encrypter.Base64Decode(Request.QueryString["queryCondition"].ToString().Replace("_99_", "+")); recordTotal = string.IsNullOrEmpty(Request.QueryString["recordTotal"]) ? 0 : Convert.ToInt32(Request.QueryString["recordTotal"]); } catch { Response.Write("<script>alert('Error');</script>"); Response.End(); return; } if (Request.QueryString["action"].ToLower() == "loans") { //Response.Write("<script>alert('" + IDs + "');</script>"); ExportLoans(IDs); } else if (Request.QueryString["action"].ToLower() == "leads") { ExportLeads(IDs); } else if (Request.QueryString["action"].ToLower() == "clients") { ExportClients(IDs); } }
/// <summary> /// Filters from home pipline summary. /// </summary> /// <returns></returns> private string FilterFromHomePiplineSummary() { string searchCondition = string.Empty; StageFilter = string.Empty; if (!string.IsNullOrEmpty(Request.QueryString["q"])) { string qString = Encrypter.Base64Decode(Request.QueryString["q"]); //string qString = Request.QueryString["q"]; //string qString = "RegionID=-1&DivisionID=8&BranchID=-1&DateType=CloseDate&FromDate=&ToDate=2010-11-08&Status=Processing&LastCompletedStage=Opened"; string[] args = qString.Split("&".ToCharArray()); string searchTempllage = " AND {0} = '{1}'"; Dictionary <string, string> KVPs = new Dictionary <string, string>(); try { KVPs = (from arg in args.Where(s => !string.IsNullOrEmpty(s)).ToList() select new { key = arg.Split("=".ToCharArray())[0], value = arg.Split("=".ToCharArray())[1] }). ToDictionary(p => p.key, p => p.value); } catch (Exception e) { LPLog.LogMessage(e.Message); return(string.Empty); } if (KVPs.ContainsKey("RegionID") && !string.IsNullOrEmpty(KVPs["RegionID"])) { //searchCondition += string.Format(searchTempllage, "RegionID", KVPs["RegionID"]); this.ddlRegion.SelectedValue = KVPs["RegionID"]; } if (KVPs.ContainsKey("DivisionID") && !string.IsNullOrEmpty(KVPs["DivisionID"])) { //searchCondition += string.Format(searchTempllage, "DivisionID", KVPs["DivisionID"]); this.ddlDivison.SelectedValue = KVPs["DivisionID"]; } if (KVPs.ContainsKey("BranchID") && !string.IsNullOrEmpty(KVPs["BranchID"])) { //searchCondition += string.Format(searchTempllage, "BranchID", KVPs["BranchID"]); this.ddlBranch.SelectedValue = KVPs["BranchID"]; } if (KVPs.ContainsKey("StageID") && !string.IsNullOrEmpty(KVPs["StageID"])) { //searchCondition += string.Format(searchTempllage, "StageID", KVPs["StageID"]); this.ddlStage.SelectedValue = KVPs["StageID"]; } if (KVPs.ContainsKey("DateType") && !string.IsNullOrEmpty(KVPs["DateType"])) { //string dateTemplage = "AND {0} >= '{1}' AND {0} <= '{2}'"; string dateType = string.Empty; if (KVPs["DateType"].Equals("CloseDate", StringComparison.CurrentCultureIgnoreCase)) { dateType = "DateClose"; } else { dateType = "DateOpen"; } if (KVPs.ContainsKey("FromDate") && !string.IsNullOrEmpty(KVPs["FromDate"])) { searchCondition += string.Format(" AND [{0}] >= '{1}'", dateType, KVPs["FromDate"]); } if (KVPs.ContainsKey("ToDate") && !string.IsNullOrEmpty(KVPs["ToDate"])) { searchCondition += string.Format(" AND [{0}] <= '{1}'", dateType, KVPs["ToDate"]); } } if (KVPs.ContainsKey("Status") && !string.IsNullOrEmpty(KVPs["Status"])) { searchCondition += string.Format(searchTempllage, "[Status]", KVPs["Status"]); } if (KVPs.ContainsKey("LastCompletedStage") && !string.IsNullOrEmpty(KVPs["LastCompletedStage"])) { searchCondition += string.Format(searchTempllage, "[LastCompletedStage]", KVPs["LastCompletedStage"]); StageFilter = "'" + KVPs["LastCompletedStage"] + "'"; } else { StageFilter = string.Empty; } } return(searchCondition); }
protected void Page_Load(object sender, EventArgs e) { // FromPage if (this.Request.QueryString["FromPage"] == null) { PageCommon.WriteJsEnd(this, "Missing required query string.", "window.location.href='../Pipeline/ProspectPipelineSummary.aspx'"); } string sFromPage = this.Request.QueryString["FromPage"].ToString(); string sFromPage_Decode = Encrypter.Base64Decode(sFromPage); // ContactID bool bIsValid = PageCommon.ValidateQueryString(this, "ContactID", QueryStringType.ID); if (bIsValid == false) { PageCommon.WriteJsEnd(this, "Missing required query string.", "window.location.href='" + sFromPage_Decode + "'"); } string sContactID = this.Request.QueryString["ContactID"].ToString(); #region get loan ids by contact id string sSql = "select a.FileId from LoanContacts as a inner join Loans as b on a.FileId=b.FileId " + "where a.ContactId=" + sContactID + " " + "and (a.ContactRoleId=dbo.lpfn_GetBorrowerRoleId() or a.ContactRoleId=dbo.lpfn_GetCoBorrowerRoleId()) " + "and b.Status='Prospect' "; //string sSql = "select lc.FileId, lc.ContactId from dbo.[lpvw_GetLoanContactwRoles] lc inner join Loans l on lc.FileId=l.FileId where ContactId=" + sContactID + " and (RoleName='Borrower' or RoleName='CoBorrower') and l.[Status]='Prospect' "; DataTable LoanList = null; try { LoanList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql); } catch { PageCommon.WriteJsEnd(this, "Failed to get loans by contact id.", "window.location.href='" + sFromPage_Decode + "'"); } if (LoanList.Rows.Count == 0) { PageCommon.WriteJsEnd(this, "No leads found for the prospect.", "window.location.href='" + sFromPage_Decode + "'"); } #endregion #region build url string sFirstLoanID = string.Empty; StringBuilder sbLoanIDs = new StringBuilder(); foreach (DataRow LoanRow in LoanList.Rows) { string sLoanID = LoanRow["FileID"].ToString(); if (sbLoanIDs.Length == 0) { sbLoanIDs.Append(sLoanID); sFirstLoanID = sLoanID; } else { sbLoanIDs.Append("," + sLoanID); } } #endregion this.Response.Redirect("ProspectLoanDetails.aspx?FromPage=&FileID=" + sFirstLoanID + "&FileIDs=" + sbLoanIDs.ToString()); }
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() >= $FirstRow and position() <= $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() >= $FirstRow and position() <= $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() >= $FirstRow and position() <= $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 }
protected void Page_Load(object sender, EventArgs e) { #region 校验页面参数 // FromPage if (this.Request.QueryString["FromPage"] == null) { PageCommon.WriteJsEnd(this, "Missing required query string.", "window.location.href='../Pipeline/ProcessingPipelineSummary.aspx'"); } string sFromPage = this.Request.QueryString["FromPage"].ToString(); string sFromPage_Decode = Encrypter.Base64Decode(sFromPage); // FileID bool bIsValid = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID); if (bIsValid == false) { PageCommon.WriteJsEnd(this, "Missing required query string.", "window.location.href='" + sFromPage_Decode + "'"); } string sFileID = this.Request.QueryString["FileID"].ToString(); #endregion #region get the current loan's Borrower's or Co-borrower's lead records string sSql = "select a.FileId from Loans as a inner join LoanContacts as b on a.FileId=b.FileId " + "where a.Status='Prospect' " + "and (b.ContactRoleId=dbo.lpfn_GetBorrowerRoleId() or b.ContactRoleId=dbo.lpfn_GetCoBorrowerRoleId()) " + "and b.ContactId in (select ContactId from LoanContacts where FileId=" + sFileID + " and (ContactRoleId=dbo.lpfn_GetBorrowerRoleId() or ContactRoleId=dbo.lpfn_GetCoBorrowerRoleId()))"; DataTable ProspectLoanList = null; try { ProspectLoanList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql); } catch { PageCommon.WriteJsEnd(this, "Failed to get the lead record for the loan.", "window.location.href='" + sFromPage_Decode + "'"); } if (ProspectLoanList.Rows.Count == 0) { PageCommon.WriteJsEnd(this, "Cannot find the lead record for the current loan.", "window.location.href='" + sFromPage_Decode + "'"); } #endregion #region build url string sFirstProspectLoanID = string.Empty; StringBuilder sbProspectLoanIDs = new StringBuilder(); foreach (DataRow ProspectLoanRow in ProspectLoanList.Rows) { string sProspectLoanID = ProspectLoanRow["FileId"].ToString(); if (sbProspectLoanIDs.Length == 0) { sbProspectLoanIDs.Append(sProspectLoanID); sFirstProspectLoanID = sProspectLoanID; } else { sbProspectLoanIDs.Append("," + sProspectLoanID); } } #endregion // 重定向到 ProspectLoanDetails.aspx this.Response.Redirect("../Prospect/ProspectLoanDetails.aspx?FromPage=&FileID=" + sFirstProspectLoanID + "&FileIDs=" + sbProspectLoanIDs.ToString()); }
protected void Page_Load(object sender, EventArgs e) { #region 校验页面参数 string sErrorJs = "alert('Missing required query string.');window.close();"; #region UseEmailTemplate if (this.Request.QueryString["UseEmailTemplate"] == null) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing3", sErrorJs, true); return; } string sUseEmailTemplate = this.Request.QueryString["UseEmailTemplate"].ToString(); if (sUseEmailTemplate != "0" && sUseEmailTemplate != "1") { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Invalid3", "alert('Invalid query string.');window.close();", true); return; } bool bUseEmailTemplate = sUseEmailTemplate == "1" ? true : false; #endregion #region EmailTemplateID bool bIsValid = PageCommon.ValidateQueryString(this, "EmailTemplateID", QueryStringType.ID); if (bIsValid == false) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing1", sErrorJs, true); return; } string sEmailTemplateID = this.Request.QueryString["EmailTemplateID"].ToString(); #endregion #region text email body if (this.Request.QueryString["TextBody"] == null) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing6", sErrorJs, true); return; } string sTextBody = this.Request.QueryString["TextBody"].ToString(); #endregion #region LoanID or ProspectID or ProspectAlertID string sLoanID = string.Empty; string sProspectID = string.Empty; string sProspectAlertID = string.Empty; if (this.Request.QueryString["LoanID"] == null && this.Request.QueryString["ProspectID"] == null && this.Request.QueryString["ProspectAlertID"] == null) { this.ClientScript.RegisterStartupScript(this.GetType(), "_Missing11", sErrorJs, true); return; } if (this.Request.QueryString["LoanID"] != null) { #region LoanID bIsValid = PageCommon.ValidateQueryString(this, "LoanID", QueryStringType.ID); if (bIsValid == false) { this.ClientScript.RegisterStartupScript(this.GetType(), "_Missing12", sErrorJs, true); return; } sLoanID = this.Request.QueryString["LoanID"].ToString(); #endregion } else if (this.Request.QueryString["ProspectID"] != null) { #region ProspectID bIsValid = PageCommon.ValidateQueryString(this, "ProspectID", QueryStringType.ID); if (bIsValid == false) { this.ClientScript.RegisterStartupScript(this.GetType(), "_Missing13", sErrorJs, true); return; } sProspectID = this.Request.QueryString["ProspectID"].ToString(); #endregion } else if (this.Request.QueryString["ProspectAlertID"] != null) { #region ProspectAlertID bIsValid = PageCommon.ValidateQueryString(this, "ProspectAlertID", QueryStringType.ID); if (bIsValid == false) { this.ClientScript.RegisterStartupScript(this.GetType(), "_Missing14", sErrorJs, true); return; } sProspectAlertID = this.Request.QueryString["ProspectAlertID"].ToString(); #endregion } #endregion #region Append My Picture and Signature if (this.Request.QueryString["AppendMyPic"] == null) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Missing4", sErrorJs, true); return; } string sAppendMyPic = this.Request.QueryString["AppendMyPic"].ToString(); if (sAppendMyPic != "0" && sAppendMyPic != "1") { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_Invalid4", "alert('Invalid query string.');window.close();", true); return; } bool bAppendMyPic = sAppendMyPic == "1" ? true : false; #endregion #endregion #region 生成email body // workflow api string sHtmlBody = string.Empty; try { ServiceManager sm = new ServiceManager(); using (LP2ServiceClient service = sm.StartServiceClient()) { EmailPreviewRequest req = new EmailPreviewRequest(); if (bUseEmailTemplate == true) { req.EmailTemplId = Convert.ToInt32(sEmailTemplateID); req.EmailBody = null; req.AppendPictureSignature = false; } else { req.EmailTemplId = 0; string sTextBody_Decode = Encrypter.Base64Decode(sTextBody); req.EmailBody = Encoding.UTF8.GetBytes(sTextBody_Decode); req.AppendPictureSignature = bAppendMyPic; } if (this.Request.QueryString["LoanID"] != null) { req.FileId = Convert.ToInt32(sLoanID); } else if (this.Request.QueryString["ProspectID"] != null) { req.ProspectId = Convert.ToInt32(sProspectID); } else if (this.Request.QueryString["ProspectAlertID"] != null) { req.PropsectTaskId = Convert.ToInt32(sProspectAlertID); } req.hdr = new ReqHdr(); req.UserId = this.CurrUser.iUserID; EmailPreviewResponse response = service.PreviewEmail(req); if (response.resp.Successful == false) { this.ClientScript.RegisterClientScriptBlock(this.GetType(), "_FailedGetHtml", "alert('Failed to preview email: " + response.resp.StatusInfo + "');window.close();", true); return; } sHtmlBody = Encoding.UTF8.GetString(response.EmailHtmlContent); } } catch (System.ServiceModel.EndpointNotFoundException ee) { PageCommon.AlertMsg(this, "Failed to preview email, Email Manager is not running, error: " + ee.ToString()); } #endregion this.ltEmailBody.Text = sHtmlBody; }
protected void Page_Load(object sender, EventArgs e) { #region 校验页面参数 string sReturnUrl = "../Pipeline/ProspectPipelineSummary.aspx"; string sErrorMsg = "Failed to load this page: missing required query string."; string sBackJs = "window.location.href='" + sReturnUrl + "'"; // e bool bIsValid = PageCommon.ValidateQueryString(this, "e", QueryStringType.String); if (bIsValid == false) { PageCommon.WriteJsEnd(this, sErrorMsg, sBackJs); } string sEncodeQueryString = this.Request.QueryString["e"]; string sDecodeQueryString = Encrypter.Base64Decode(sEncodeQueryString); bIsValid = Regex.IsMatch(sDecodeQueryString, @"^ContactID=([1-9]\d*)&ContactIDs=([1-9]\d*)(,[1-9]\d*)*$"); if (bIsValid == false) { PageCommon.WriteJsEnd(this, sErrorMsg, sBackJs); } string[] QueryStringArray = sDecodeQueryString.Split('&'); string sContactIDKeyValue = QueryStringArray[0]; string sContactIDsKeyValue = QueryStringArray[1]; string[] ContactIDKeyValueArray = sContactIDKeyValue.Split('='); string[] ContactIDsKeyValueArray = sContactIDsKeyValue.Split('='); // ContactID string sContactID = ContactIDKeyValueArray[1]; // ContactIDs string sContactIDs = ContactIDsKeyValueArray[1]; // PageFrom bIsValid = PageCommon.ValidateQueryString(this, "PageFrom", QueryStringType.String); if (bIsValid == false) { PageCommon.WriteJsEnd(this, sErrorMsg, sBackJs); } string sPageFrom = this.Request.QueryString["PageFrom"]; if (sPageFrom == string.Empty) { sPageFrom = sReturnUrl; } #endregion hfID.Value = sContactID; hfIDs.Value = sContactIDs; hfPageFrom.Value = sPageFrom; #region AccessUnassignedLeads check LPWeb.BLL.Prospect prospect = new LPWeb.BLL.Prospect(); LPWeb.Model.Prospect pModel = prospect.GetModel(Convert.ToInt32(sContactID)); //当 有loanOfficer 指定 或者 if (pModel != null && (pModel.Loanofficer == null || pModel.Loanofficer == 0 || pModel.Loanofficer == -1)) { if (!CurrUser.bAccessOtherLoans && !CurrUser.userRole.AccessUnassignedLeads) { PageCommon.WriteJsEnd(this, "No permission to access", sBackJs); } } #endregion }
protected void Page_Load(object sender, EventArgs e) { // FromPage if (this.Request.QueryString["FromPage"] == null) { PageCommon.WriteJsEnd(this, "Missing required query string.", "window.location.href='../Pipeline/ProspectPipelineSummaryLoan.aspx'"); } string sFromPage = this.Request.QueryString["FromPage"].ToString(); string sFromPage_Decode = Encrypter.Base64Decode(sFromPage); // FileID bool bIsValid = PageCommon.ValidateQueryString(this, "FileID", QueryStringType.ID); if (bIsValid == false) { PageCommon.WriteJsEnd(this, "Missing required query string.", "window.location.href='" + sFromPage_Decode + "'"); } string sFileID = this.Request.QueryString["FileID"].ToString(); #region get contact ids by loan id string sSql = "select * from LoanContacts where FileId=" + sFileID + " and (ContactRoleId=dbo.lpfn_GetBorrowerRoleId() or ContactRoleId=dbo.lpfn_GetCoBorrowerRoleId())"; DataTable ContactList = null; try { ContactList = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql); } catch { PageCommon.WriteJsEnd(this, "Failed to get the client record for the lead.", "window.location.href='" + sFromPage_Decode + "'"); } if (ContactList.Rows.Count == 0) { PageCommon.WriteJsEnd(this, "Cannot find the client record for the current lead.", "window.location.href='" + sFromPage_Decode + "'"); } #endregion #region build url string sFirstContactID = string.Empty; StringBuilder sbContactIDs = new StringBuilder(); foreach (DataRow ContactRow in ContactList.Rows) { string sContactID = ContactRow["ContactID"].ToString(); if (sbContactIDs.Length == 0) { sbContactIDs.Append(sContactID); sFirstContactID = sContactID; } else { sbContactIDs.Append("," + sContactID); } } #endregion string c = "ContactID=" + sFirstContactID + "&ContactIDs=" + sbContactIDs.ToString(); string en = Encrypter.Base64Encode(c); this.Response.Redirect("ProspectDetailView.aspx?PageFrom=&e=" + en); }
protected void Page_Load(object sender, EventArgs e) { #region 校验页面参数 string sWhere = string.Empty; if (this.Request.QueryString["w"] != null) { string sWhereEncode = this.Request.QueryString["w"].ToString(); if (sWhereEncode != string.Empty) { string sWhereDecode = Encrypter.Base64Decode(sWhereEncode); if (sWhereEncode == sWhereDecode) { sWhere = "and (1=0)"; } else { sWhere = sWhereDecode; } } } string sOrgan = "Branch"; if (this.Request.QueryString["Organ"] != null) { sOrgan = this.Request.QueryString["Organ"]; } #endregion string sWorkflowType = "Processing"; if (this.Request.QueryString["wt"] != null) { sWorkflowType = this.Request.QueryString["wt"]; } #region get user loan list string sFromTable = string.Empty; if (sWorkflowType == "Prospect") { #region Prospect if (this.CurrUser.sRoleName == "Branch Manager") { sFromTable = "(select b.* from lpfn_GetUserLoans_Branch_Manager(" + this.CurrUser.iUserID + ") as a inner join lpvw_PipelineInfo as b on a.LoanID = b.FileId " + "where (1=1) " + sWhere + ") as t"; } else { if (this.CurrUser.sRoleName == "Executive") { sFromTable = "(select b.* from lpfn_GetUserLoans_Executive(" + this.CurrUser.iUserID + ") as a inner join lpvw_PipelineInfo as b on a.LoanID = b.FileId " + "where (1=1) " + sWhere + ") as t"; } else { sFromTable = "(select b.* from lpfn_GetUserLoans(" + this.CurrUser.iUserID + ") as a inner join lpvw_PipelineInfo as b on a.LoanID = b.FileId " + "where (1=1) " + sWhere + ") as t"; } } #endregion } else { if (this.CurrUser.sRoleName == "Branch Manager") { sFromTable = "(select b.* from lpfn_GetUserLoans_Branch_Manager(" + this.CurrUser.iUserID + ") as a inner join V_ProcessingPipelineInfo as b on a.LoanID = b.FileId " + "where (1=1) " + sWhere + ") as t"; } else { if (this.CurrUser.sRoleName == "Executive") { sFromTable = "(select b.* from lpfn_GetUserLoans_Executive(" + this.CurrUser.iUserID + ") as a inner join V_ProcessingPipelineInfo as b on a.LoanID = b.FileId " + "where (1=1) " + sWhere + ") as t"; } else { sFromTable = "select b.* from lpfn_GetUserLoans(" + this.CurrUser.iUserID + ") as a inner join V_ProcessingPipelineInfo as b on a.LoanID = b.FileId " + "where (1=1) " + sWhere + ") as t"; } } } #endregion #region 生成Xml for Organ. Production LPWeb.BLL.Loans LoanManager = new LPWeb.BLL.Loans(); string sSql = string.Empty; if (sOrgan == "Regional") { sSql = "select t.RegionID, b.Name, SUM(t.Amount) as Amount from " + sFromTable + " inner join Regions as b on t.RegionID=b.RegionId group by t.RegionID, b.Name"; } if (sOrgan == "Division") { sSql = "select t.DivisionID, b.Name, SUM(t.Amount) as Amount from " + sFromTable + " inner join Divisions as b on t.DivisionID=b.DivisionID group by t.DivisionID, b.Name"; } if (sOrgan == "Branch") { sSql = "select t.BranchID, b.Name, SUM(t.Amount) as Amount from " + sFromTable + " inner join Branches as b on t.BranchID=b.BranchID group by t.BranchID, b.Name"; } DataTable OrganProductionData = LPWeb.DAL.DbHelperSQL.ExecuteDataTable(sSql); StringBuilder sbOrganPoints = new StringBuilder(); foreach (DataRow OrganRow in OrganProductionData.Rows) { decimal dAmount = Convert.ToDecimal(OrganRow["Amount"]) / 1000; string sOrganName = OrganRow["Name"].ToString(); sOrganName = this.WordWrap(sOrganName, 10); sbOrganPoints.AppendLine("<point name=\"" + sOrganName + "\" y=\"" + dAmount + "\"/>"); } if (sbOrganPoints.Length > 0) { this.sOrganPoints = "<series>" + sbOrganPoints.ToString() + "</series>"; } #endregion if (OrganProductionData.Rows.Count > 0) { DataView OrganView = new DataView(OrganProductionData); OrganView.Sort = "Amount desc"; int iMax = Convert.ToInt32(Convert.ToDecimal(OrganView[0]["Amount"]) / 1000); string sMax = iMax.ToString(); string sFirstNum = sMax.Substring(0, 1); int iCeilNum = Convert.ToInt32(sFirstNum) + 1; this.iOverlay = iCeilNum * Convert.ToInt32(Math.Pow(Convert.ToDouble(10), Convert.ToDouble(sMax.Length - 1))); } }