protected void EditProduct2_Click(object sender, EventArgs e) { foreach (Produkt_spozywczy p in baza.Produkt_spozywczies) { if (p.Id == ProduktID) { p.nazwa = TextBoxNazwa2.Text; p.jednostka = DropDownListJednostka2.SelectedValue; p.kalorie = float.Parse(TextBoxKalorie2.Text); p.weglowodany = float.Parse(TextBoxWeglowodany2.Text); p.bialka = float.Parse(TextBoxBialka2.Text); p.blonnik = float.Parse(TextBoxBlonnik2.Text); p.sol = float.Parse(TextBoxSol2.Text); p.tluszcze = float.Parse(TextBoxTluszcze2.Text); break; } } baza.SubmitChanges(); SqlCommand cmd = new SqlCommand("SELECT Id, nazwa, kalorie, weglowodany, bialka, tluszcze, blonnik, sol FROM Produkt_spozywczy", new SqlConnection(constr)); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); RepeaterProduktow.DataSource = dt; RepeaterProduktow.DataBind(); edycjaProduktow.Visible = false; }
protected void ustawRepeaterKlientow() { SqlCommand cmd = new SqlCommand("SELECT Id, nazwa, kalorie, weglowodany, bialka, tluszcze, blonnik, sol FROM Produkt_spozywczy", new SqlConnection(constr)); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); RepeaterProduktow.DataSource = dt; RepeaterProduktow.DataBind(); cmd = new SqlCommand("Select Id, imie, nazwisko, login, telefon FROM Konto WHERE rodzaj='K'", new SqlConnection(constr)); sda = new SqlDataAdapter(cmd); dt = new DataTable(); sda.Fill(dt); RepeaterKlientow.DataSource = dt; RepeaterKlientow.DataBind(); }