protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(ExtraColumn) && ExtraColumn.Equals("Spectators")) { lblExtraColumnName.Text = "Зрители"; } }
protected void rptGames_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (!string.IsNullOrEmpty(ExtraColumn)) { Label lblExtraColumnText = e.Item.FindControl("lblExtraColumnText") as Label; if (ExtraColumn.Equals("Spectators")) { lblExtraColumnText.Text = (e.Item.DataItem as MatchDTO).Spectators.ToString(); } } }
public List <ExtraColumn> Get() { List <ExtraColumn> listOfExtraColumns = new List <ExtraColumn>(); try { using (var connection = new MySqlConnection(connectionString)) { connection.Open(); using (var cmd = new MySqlCommand()) { cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "Select * from extracolumn"; cmd.Connection = connection; MySqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { ExtraColumn extraColumn = new ExtraColumn(); extraColumn.id = Convert.ToInt32(reader.GetValue(0)); extraColumn.columnname = reader.GetValue(1).ToString(); listOfExtraColumns.Add(extraColumn); } reader.Close(); } } } catch (MySqlException ex) { Console.WriteLine(ex.Message); } return(listOfExtraColumns); }
public void AddInterviewee(ExtraColumn extraColumn) { try { using (var connection = new MySqlConnection(connectionString)) { connection.Open(); using (var cmd = new MySqlCommand()) { cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "insert into extracolumn (columnname) values (@columnname)"; cmd.Connection = connection; cmd.Parameters.AddWithValue("@columnname", extraColumn.columnname); cmd.ExecuteNonQuery(); } } } catch (MySqlException ex) { Debug.WriteLine(ex.Message); } }