bool ValidatePage() { ClearPageMessages(); ReportOK = false; if (decimal.TryParse(CPRFactor.Text, NumberStyles.Number, null, out Factor)) { Session["CPRFactor"] = Factor; ReportOK = true; } if (!ReportOK) { if (CPRFactor.Text.ToString().Trim() == "") { Session["CPRFactor"] = -1m; ReportOK = true; } else { lblErrorMessage.Text = "A Factor is required for the report"; CPRFactor.Focus(); return(ReportOK); } } //lblErrorMessage.Text = "Factor:" + Session["CPRFactor"].ToString(); dt = (DataTable)Session[CurItemsName.Value]; if (dt.Rows.Count > 0) { ReportOK = true; } else { lblErrorMessage.Text = "There a no records to report"; ReportOK = false; } return(ReportOK); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { RunByLabel.Text = Session["UserName"].ToString(); RemoveNoStock.Checked = true; ReportType.Value = ""; CurItemsName.Value = "CurItems"; //scrollbars=no, ReportLinkButt.Attributes.Add("onfocus", "document.getElementById('RunReportButt').focus();window.open('CPRReport.aspx','CPR','height=768,width=1024,scrollbars=yes,toolbar=no,menubar=yes,location=no,status=no,top='+((screen.height/2) - (760/2))+',left='+((screen.width/2) - (1020/2))+',resizable=YES','');"); ManualXFerLinkButt.Attributes.Add("onfocus", "document.getElementById('ManualXFerButt').focus();window.open('ManualTransfer.aspx','ManualXFer','height=768,width=1024,scrollbars=yes,toolbar=no,menubar=yes,location=no,status=no,top='+((screen.height/2) - (760/2))+',left='+((screen.width/2) - (1020/2))+',resizable=YES','');"); ItemListLinkButt.Attributes.Add("onfocus", "document.getElementById('RunReportButt').focus();window.open('Showitems.aspx','Items','scrollbars=yes,toolbar=no,menubar=yes,location=no,status=no,top='+((screen.height/2) - (760/2))+',left='+((screen.width/2) - (1020/2))+',resizable=YES','');"); if (Request.QueryString["Type"] != null) { CurItemsName.Value = "BuyItems"; ReportType.Value = Request.QueryString["Type"]; LongReport.Enabled = false; ShortReport.Enabled = false; TransferReport.Enabled = false; this.Title = "CPR Buy Report Prompts"; lblParentMenuName.Text = "CPR Buy Report Options"; ReportLinkButt.Attributes.Add("onfocus", "document.getElementById('RunReportButt').focus();window.open('CPRBuyReport.aspx','CPRBuy','height=768,width=1024,scrollbars=yes,toolbar=no,menubar=yes,location=no,status=no,top='+((screen.height/2) - (760/2))+',left='+((screen.width/2) - (1020/2))+',resizable=YES','');"); } if (Session["CPRSort"] != null) { if (Session["CPRSort"].ToString() == "SortPlating") { SortPlating.Checked = true; } if (Session["CPRSort"].ToString() == "SortItem") { SortItem.Checked = true; } if (Session["CPRSort"].ToString() == "SortVariance") { SortVariance.Checked = true; } if (Session["CPRSort"].ToString() == "SortNetBuyBucks") { SortNetBuyBucks.Checked = true; } if (Session["CPRSort"].ToString() == "SortNewBuyLBS") { SortNewBuyLBS.Checked = true; } if (Session["CPRSort"].ToString() == "SortCFVC") { SortCFVC.Checked = true; } } if ((Session["IncludeSummQtys"] != null) && (Session["IncludeSummQtys"].ToString().ToUpper() == "TRUE")) { IncludeSummQtys.Checked = true; } if ((Session["CPRFactor"] != null) && (Session["CPRFactor"].ToString() != "-1")) { CPRFactor.Text = Session["CPRFactor"].ToString(); } CPRFactor.Focus(); try { dt = (DataTable)Session[CurItemsName.Value]; RecCountLabel.Text = dt.Rows.Count.ToString(); } catch { }; int ExceptPcnt = (int)(cpr.GetAppPrefNumber("ExceptPcnt") * 100); Exception3.Text = "Hub Required > Company Excess; " + ExceptPcnt.ToString() + "% Hub Required < Company Excess"; Exception4.Text = "Hub Required > Company Excess; " + ExceptPcnt.ToString() + "% Hub Required < Branch " + cpr.GetAppPrefValue("ExceptHubs") + " Excess"; } else { ScriptManager1.AsyncPostBackTimeout = TimeOutSeconds; } TimeOutSeconds = (int)cpr.GetAppPrefNumber("CPR", "TimeOut"); }