protected void rGridStats_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { try { HiddenField hSeasonID = (HiddenField)Parent.FindControl("hddSeasonID"); HiddenField hPlayerGUID = (HiddenField)Parent.FindControl("hddPlayerGUID"); HiddenField hddPrimPosID = (HiddenField)Parent.FindControl("hddPrimPosID"); PickAPlayerDomainModel PlayerDrafted = new PickAPlayerDomainModel(); PlayerDrafted.PlayerGUID = new Guid(hPlayerGUID.Value.ToString()); PlayerDrafted.SeasonID = Convert.ToInt32(hSeasonID.Value); PlayerDrafted.PrimPositionTypeID = Convert.ToInt32(hddPrimPosID.Value); DataTable dt = sppsBLL.GetDynamicStats(PlayerDrafted); rGridStats.DataSource = dt; } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } }
public DataTable GetDynamicStats(PickAPlayerDomainModel player) { try { SqlConnection sqlConnection1 = new SqlConnection(ConfigurationManager.ConnectionStrings["CSBAConn"].ToString()); SqlCommand cmd = new SqlCommand(); SqlDataReader reader; SqlDataAdapter adp = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); cmd.CommandText = "dbo.sp_Stat_Dynamic_Select"; cmd.Parameters.Add("@SeasonID", SqlDbType.Int).Value = player.SeasonID; cmd.Parameters.Add("@PlayerGUID", SqlDbType.UniqueIdentifier).Value = player.PlayerGUID; cmd.Parameters.Add("@PositionTypeID", SqlDbType.Int).Value = player.PrimPositionTypeID; cmd.CommandType = CommandType.StoredProcedure; cmd.Connection = sqlConnection1; sqlConnection1.Open(); adp.Fill(ds); // Data is accessible through the DataReader object here. sqlConnection1.Close(); return(ds.Tables[0]); } catch (Exception ex) { throw (ex); } }
protected static void GetStatView() { SeasonPlayerPositionStatBusinessLogic sppsBLL = new SeasonPlayerPositionStatBusinessLogic(); PickAPlayerDomainModel player = new PickAPlayerDomainModel(); player.PlayerGUID = new Guid("427D3393-3232-4E29-BAF2-18650072C736"); DataTable dt = sppsBLL.GetDynamicStats(player); }
protected void rBTNPickPlayer_Click(object sender, EventArgs e) { try { PickAPlayerDomainModel PickPlayer = new PickAPlayerDomainModel(); PlayerDrafted = DraftPlayerBLL.PickAPLayer(Convert.ToInt32(rDDSeason.SelectedValue)); if (PlayerDrafted != null) { hddSeasonID.Value = "0"; // I want all seasons hddPlayerGUID.Value = PlayerDrafted.PlayerGUID.ToString(); hddPrimPosID.Value = PlayerDrafted.PrimPositionTypeID.ToString(); imgPlayer.DataValue = PlayerDrafted.PlayerImage; //imgPositon.ImageUrl = "~/Content/images/" + PlayerDrafted.PrimPositionName.Trim() + ".jpg"; lblCurrPlayer.Text = PlayerDrafted.PlayerName; imgPlayer.Visible = true; //imgPositon.Visible = true; lblCurrPlayer.Visible = true; rBTNAssign.Enabled = true; BindStatsGrid(PlayerDrafted); LoadrDDSeasonTeam(); Application.Add("CurrentPlayer", PlayerDrafted); rNTBCurrBid.Value = 2; strPageState = "Picked"; ManageButtons(); } else { lblMessage.Text = "Draft Completed"; } } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } }
public void BindStatsGrid(PickAPlayerDomainModel PickPlayer) { try { ucPlayerStats.BindChildStatsGrid(); } catch (Exception ex) { StackTrace st = new StackTrace(); StackFrame sf = st.GetFrame(0); string errMethod = sf.GetMethod().Name.ToString(); // Get the current method name string errMsg = "600"; // Gotta pass something, we're retro-fitting an existing method Session["LastException"] = ex; // Throw the exception in the session variable, will be used in error page string url = string.Format(ConfigurationManager.AppSettings["ErrorPageURL"], errMethod, errMsg); //Set the URL Response.Redirect(url); // Go to the error page. } }
public void BindChildStatsGrid() { HiddenField hSeasonID = (HiddenField)Parent.FindControl("hddSeasonID"); HiddenField hPlayerGUID = (HiddenField)Parent.FindControl("hddPlayerGUID"); HiddenField hddPrimPosID = (HiddenField)Parent.FindControl("hddPrimPosID"); PickAPlayerDomainModel PlayerDrafted = new PickAPlayerDomainModel(); PlayerDrafted.PlayerGUID = new Guid(hPlayerGUID.Value.ToString()); PlayerDrafted.SeasonID = Convert.ToInt32(hSeasonID.Value); PlayerDrafted.PrimPositionTypeID = Convert.ToInt32(hddPrimPosID.Value); rGridStats.DataSource = null; rGridStats.DataBind(); DataTable dt = sppsBLL.GetDynamicStats(PlayerDrafted); rGridStats.DataSource = dt; rGridStats.DataBind(); }
public PickAPlayerDomainModel PickAPLayer(int SeasonID) { PickAPlayerDomainModel PickPlayer = new PickAPlayerDomainModel(); using (CSBAAzureEntities context = new CSBAAzureEntities()) { PickPlayer = (from result in context.PickAPlayer(SeasonID) select new PickAPlayerDomainModel { PlayerGUID = result.PlayerGUID, PlayerImage = result.PlayerImage, PlayerName = result.PlayerName, PrimPositionTypeID = result.PrimPositionTypeID, PrimPositionName = result.PrimPositionName, PrimPositionTypeDescr = result.PrimPositionTypeDescr, SecPositionName = result.SecPositionName, SecPositionTypeDescr = result.SecPositionTypeDescr }).FirstOrDefault(); } // Guaranteed to close the Connection return(PickPlayer); }
public DataTable GetDynamicStats(PickAPlayerDomainModel player) { return(dal.GetDynamicStats(player)); }