protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "ReportsSpecificGrip"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //checks if the user has logged in if (Session["currentUser"] == null) { //Go back to Login to log in Server.Transfer("LoginPage.aspx", false); } else { CU = (CurrentUser)Session["currentUser"]; //Gathering the start and end dates object[] repInfo = (object[])Session["reportInfo"]; DateTime[] reportDates = (DateTime[])repInfo[0]; DateTime startDate = reportDates[0]; DateTime endDate = reportDates[1]; //Builds string to display in label if (startDate == endDate) { lblDates.Text = "Grips Sold through: " + startDate.ToString("dd/MMM/yy"); } else { lblDates.Text = "Grips sold through: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy"); } GrdStats.DataSource = R.CallReturnSpecificGripDataTableForReport(startDate, endDate, objPageDetails); GrdStats.DataBind(); } } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }
//double profitMargin; //int profitMarginCount = 0; protected void Page_Load(object sender, EventArgs e) { //Collects current method and page for error tracking string method = "Page_Load"; Session["currPage"] = "ReportsStoreStats"; object[] objPageDetails = { Session["currPage"].ToString(), method }; try { //checks if the user has logged in if (Session["currentUser"] == null) { //Go back to Login to log in Server.Transfer("LoginPage.aspx", false); } else { if (!Page.IsPostBack) { CU = (CurrentUser)Session["currentUser"]; //Gathering the start and end dates object[] passing = (object[])Session["reportInfo"]; DateTime[] reportDates = (DateTime[])passing[0]; DateTime startDate = reportDates[0]; DateTime endDate = reportDates[1]; int locationID = Convert.ToInt32(passing[1]); int timeFrame = Convert.ToInt32(passing[2]); Calendar calStartDate = (Calendar)CustomExtensions.CallFindControlRecursive(Master, "CalStartDate"); calStartDate.SelectedDate = startDate; Calendar calEndDate = (Calendar)CustomExtensions.CallFindControlRecursive(Master, "CalEndDate"); calEndDate.SelectedDate = endDate; DropDownList ddlDatePeriod = (DropDownList)CustomExtensions.CallFindControlRecursive(Master, "ddlDatePeriod"); ddlDatePeriod.SelectedValue = timeFrame.ToString(); DropDownList ddlLocation = (DropDownList)CustomExtensions.CallFindControlRecursive(Master, "ddlLocation"); DataTable dt = LM.CallReturnLocationDropDown(objPageDetails); dt.Rows.Add(99, "All Locations"); ddlLocation.DataSource = dt; ddlLocation.DataBind(); ddlLocation.SelectedValue = locationID.ToString(); //Builds string to display in label if (startDate == endDate) { lblDates.Text = "Store stats on: " + startDate.ToString("dd/MMM/yy"); //+ " for " + LM.ReturnLocationName(locationID, objPageDetails); } else { lblDates.Text = "Store stats on: " + startDate.ToString("dd/MMM/yy") + " to " + endDate.ToString("dd/MMM/yy"); //+ " for " + LM.ReturnLocationName(locationID, objPageDetails); } //Binding the gridview DataTable stats = R.CallReturnStoreStats(startDate, endDate, timeFrame, locationID, objPageDetails); GrdStats.DataSource = stats; GrdStats.DataBind(); } } } //Exception catch catch (ThreadAbortException tae) { } catch (Exception ex) { //Log all info into error table ER.CallLogError(ex, CU.employee.intEmployeeID, Convert.ToString(Session["currPage"]) + "-V3.2", method, this); //Display message box MessageBoxCustom.ShowMessage("An Error has occurred and been logged. " + "If you continue to receive this message please contact " + "your system administrator.", this); } }