protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int MatchID = Convert.ToInt32(Request.QueryString["MatchID"]); string CN = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString; using (MySqlConnection cn = new MySqlConnection(CN)) { cn.Open(); string s = "Select * From ClientMaster"; MySqlCommand cmd = new MySqlCommand(s, cn); MySqlDataAdapter adp = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); adp.Fill(dt); Dropdownclient.DataSource = dt; Dropdownclient.DataTextField = "Name"; Dropdownclient.DataValueField = "ClientID"; Dropdownclient.DataBind(); string TeamName = "Select TeamA,TeamB From Matches where apiID = '" + MatchID + "'"; MySqlCommand TeamNamecmd = new MySqlCommand(TeamName, cn); MySqlDataAdapter TeamNameadp = new MySqlDataAdapter(TeamNamecmd); DataTable TeamNamedt = new DataTable(); TeamNameadp.Fill(TeamNamedt); lblTeamA.Text = TeamNamedt.Rows[0]["TeamA"].ToString(); lblTeamB.Text = TeamNamedt.Rows[0]["TeamB"].ToString(); lblTeam1.Text = TeamNamedt.Rows[0]["TeamA"].ToString(); lblTeam2.Text = TeamNamedt.Rows[0]["TeamB"].ToString(); string s2 = "select Runner.RunnerID,Runner.Amount,Runner.rate,Runner.Mode,Runner.DateTime,Runner.Team,Runner.Position1,Runner.Position2,Runner.clientID,clientmaster.Name from Runner inner join clientmaster on Runner.ClientID = clientmaster.ClientID where Runner.MatchID = '" + MatchID + "' order by Runner.DATETime DESC"; MySqlCommand cmd1 = new MySqlCommand(s2, cn); MySqlDataAdapter adp1 = new MySqlDataAdapter(cmd1); dt2 = new DataTable(); adp1.Fill(dt2); decimal PositionAAmount = 0, PositionBAmount = 0; for (int i = 0; i < dt2.Rows.Count; i++) { decimal Amount = Convert.ToDecimal(dt2.Rows[i]["Position1"]); PositionAAmount = PositionAAmount + Amount; } lblTotalPosition1.Text = PositionAAmount.ToString(); lblPositionA.Text = PositionAAmount.ToString(); colorforpositionA(PositionAAmount); for (int i = 0; i < dt2.Rows.Count; i++) { decimal Amount = Convert.ToDecimal(dt2.Rows[i]["Position2"]); PositionBAmount = PositionBAmount + Amount; } lblTotalPosition2.Text = PositionBAmount.ToString(); lblPositionB.Text = PositionBAmount.ToString(); colorforpositionB(PositionBAmount); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int MatchID = Convert.ToInt32(Request.QueryString["MatchID"]); string CN = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString; using (MySqlConnection cn = new MySqlConnection(CN)) { cn.Open(); string s = "Select * From ClientMaster where CreatedBy = '" + Session["Agentcode"] + "'"; MySqlCommand cmd = new MySqlCommand(s, cn); MySqlDataAdapter adp = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); adp.Fill(dt); Dropdownclient.DataSource = dt; Dropdownclient.DataTextField = "Name"; Dropdownclient.DataValueField = "ClientID"; Dropdownclient.DataBind(); Bets(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Bets(); runtable = new DataTable(); runtable.Columns.Add(new DataColumn("ClientID")); runtable.Columns.Add(new DataColumn("Name")); DataRow row = runtable.NewRow(); string MatchID = Request.QueryString["MatchID"]; string CN = ConfigurationManager.ConnectionStrings["DBMS"].ConnectionString; using (MySqlConnection cn = new MySqlConnection(CN)) { cn.Open(); string SELECT = "Select * from Matches Where apiID = '" + MatchID + "'"; MySqlCommand cmd = new MySqlCommand(SELECT, cn); MySqlDataAdapter adp = new MySqlDataAdapter(cmd); DataTable dt = new DataTable(); adp.Fill(dt); string TeamA = dt.Rows[0]["TeamA"].ToString(); string TeamB = dt.Rows[0]["TeamB"].ToString(); lblTeamA.Text = TeamA; lblTeamB.Text = TeamB; lblTeamA1.Text = TeamA; lblTeamB1.Text = TeamB; string s1 = "Select * From AgentMaster where CreatedBy = '" + Session["SuperAgentCode"] + "'"; MySqlCommand cmd1 = new MySqlCommand(s1, cn); MySqlDataAdapter adp1 = new MySqlDataAdapter(cmd1); DataTable dt1 = new DataTable(); adp1.Fill(dt1); for (int i = 0; i < dt1.Rows.Count; i++) { string Agentcode = dt1.Rows[i]["code"].ToString(); string s2 = "Select * From ClientMaster where CreatedBy = '" + Agentcode + "' && Mode = 'Agent'"; MySqlCommand cmd2 = new MySqlCommand(s2, cn); MySqlDataAdapter adp2 = new MySqlDataAdapter(cmd2); DataTable dt2 = new DataTable(); adp2.Fill(dt2); for (int j = 0; j < dt2.Rows.Count; j++) { int ClientID = Convert.ToInt32(dt2.Rows[j]["ClientID"]); string Name = "C" + ClientID + dt2.Rows[j]["Name"].ToString(); row["ClientID"] = ClientID; row["Name"] = Name; runtable.Rows.Add(row.ItemArray); } } Dropdownclient.DataSource = runtable; Dropdownclient.DataTextField = "Name"; Dropdownclient.DataValueField = "ClientID"; Dropdownclient.DataBind(); } } }