Bar Load Display Code Behind...
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Press
{
public partial class BarLoad1 :
System.Web.UI.Page
{
DataTable dtBarLoadDisplay = new DataTable();
private readonly ISessionBLL _session;
private readonly ISessionBasketBLL
_sessionbasket;
private readonly IUserBLL _user;
private readonly IBarLoadBLL _barload;
public BarLoad1()
{
_user = new UserBLL(new SessionBLL());
_session = new SessionBLL();
_sessionbasket = new SessionBasketBLL();
_barload = new BarLoadBLL(_session);
}
protected void Page_Load(object sender,
EventArgs e)
{
string strSessionUID =
Request.QueryString["SessionUID"];
if (strSessionUID == "login" ||
!_session.IsGuid(strSessionUID))
{
Response.Redirect("login.aspx?
SessionUID=login");
}
string ErrorMessage = "";
DataTable dtSession = new DataTable();
DataTable dtSessionBasket =
new DataTable();
if (!IsPostBack)
{
string strEventID = "";
int intEventID = 0;
string strAttemptAmount = "";
if (strSessionUID != null &&
strSessionUID != "")
{
try
{
dtSessionBasket = _sessionbasket.
getDetail(strSessionUID,
"AttemptAmount");
if (dtSessionBasket != null)
{
foreach (DataRow r in
dtSessionBasket.Rows)
{
strAttemptAmount =
r["BasketValue"].ToString();
}
}
else
{
FailureText.Text = "Attempt
Amount not found in Session";
}
dtSessionBasket = _sessionbasket.
getDetail(strSessionUID,
"EventID");
if (dtSessionBasket != null)
{
foreach (DataRow r in
dtSessionBasket.Rows)
{
strEventID =
r["BasketValue"].ToString();
}
}
else
{
FailureText.Text = "EventID not found
in Session";
}
}
catch (Exception ex)
{
FailureText.Text = ex.Message;
}
}
else
{
Response.Redirect("default.aspx");
}
try
{
intEventID = Convert.ToInt16(strEventID);
}
catch (Exception ex)
{
}
dtBarLoadDisplay = _barload.getDisplay(
intEventID,
strAttemptAmount,
ref ErrorMessage);
PopulateList();
}
}
protected void PopulateList()
{
string ErrorMessage = "";
if (ErrorMessage == "")
{
gvBarLoadDisplay.DataSource =
dtBarLoadDisplay;
gvBarLoadDisplay.DataBind();
}
else
{
FailureText.Text = ErrorMessage;
}
}
protected void btnReturn_Clicked(
Object sender,
System.EventArgs e)
{
string strSessionUID =
Request.QueryString["SessionUID"];
// Redirect to the Run Event page
Response.Redirect(
"RunEvent.aspx?SessionUID=" +
Request.QueryString["SessionUID"]);
}
}
}