using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class admin_toode : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ToodeteHaldus t = new ToodeteHaldus(); int tootenr = -1; //sellist toodet tegelikult ei ole if (Request["TooteID"] != null) { try { tootenr=Convert.ToInt32(Request["TooteID"]); } catch (Exception) { } } Toode asi = t.KysiToode(tootenr); if (asi != null) { if (!IsPostBack) { lblNimetus.Text = asi.KysiNimetus(); txtTooteID.Value = Convert.ToString(tootenr); txtNimetus.Text = asi.KysiNimetus(); txtHind.Text = Convert.ToString(asi.KysiHind()); txtKirjeldus.Text = asi.KysiKirjeldus(); chbNahtav.Checked = asi.KysiNahtav(); pilt.ImageUrl = "../pildivaatamine.aspx?tooteid=" + tootenr + "&suurus=suur"; } } else { lblNimetus.Text = "Toode puudub"; } } protected void Button1_Click(object sender, EventArgs e) { Toode asi = new Toode(Convert.ToInt32(txtTooteID.Value), -1, txtNimetus.Text, Convert.ToDouble(txtHind.Text), txtKirjeldus.Text, -1, ((pildiandmed.HasFile) ? pildiandmed.FileBytes : null), null, chbNahtav.Checked); ToodeteHaldus t = new ToodeteHaldus(); t.MuudaToode(asi); Server.Transfer("tooted.aspx"); } }