protected void Button3_Click(object sender, EventArgs e) { // KAYDET if (txtURUN_REFNO.Text != "") { int refno = Convert.ToInt32(txtURUN_REFNO.Text); URUN u = db.URUNs.Find(refno); u.URUN_ADI = txtURUN_ADI.Text; u.FIYATI = Convert.ToDecimal(txtFIYATI.Text); u.DURUMU = Convert.ToBoolean(ddlDURUMU.SelectedValue); u.KATEGORI_REFNO = Convert.ToInt32(ddlKATEGORI_REFNO.SelectedValue); u.KDV_ORANI = Convert.ToInt32(txtKDV_ORANI.Text); u.MARKA_REFNO = Convert.ToInt32(ddlMARKA_REFNO.SelectedValue); u.ACIKLAMA = HttpUtility.HtmlDecode(txtACIKLAMA.Text); u.RESIM1 = RESIM1.FileName; u.RESIM2 = RESIM2.FileName; u.RESIM3 = RESIM3.FileName; u.RESIM4 = RESIM4.FileName; RESIM1.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM1.FileName); RESIM2.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM2.FileName); RESIM3.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM3.FileName); RESIM4.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM4.FileName); db.SaveChanges(); } else { URUN u = new URUN(); u.URUN_ADI = txtURUN_ADI.Text; u.FIYATI = Convert.ToInt32(txtFIYATI.Text); u.DURUMU = Convert.ToBoolean(ddlDURUMU.SelectedValue); u.KATEGORI_REFNO = Convert.ToInt32(ddlKATEGORI_REFNO.SelectedValue); u.KDV_ORANI = Convert.ToInt32(txtKDV_ORANI.Text); u.MARKA_REFNO = Convert.ToInt32(ddlMARKA_REFNO.SelectedValue); u.ACIKLAMA = HttpUtility.HtmlDecode(txtACIKLAMA.Text); u.RESIM1 = RESIM1.FileName; u.RESIM2 = RESIM2.FileName; u.RESIM3 = RESIM3.FileName; u.RESIM4 = RESIM4.FileName; RESIM1.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM1.FileName); RESIM2.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM2.FileName); RESIM3.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM3.FileName); RESIM4.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM4.FileName); db.URUNs.Add(u); db.SaveChanges(); } GridView1.DataSource = db.VW_URUN_.ToList(); GridView1.DataBind(); pnlKayit.Visible = false; pnlListe.Visible = true; }
protected void Button3_Click(object sender, EventArgs e) { // KAYDET if (txtSLIDER_REFNO.Text != "") { int refno = Convert.ToInt32(txtSLIDER_REFNO.Text); SLIDER s = db.SLIDERs.Find(refno); s.BASLIK = txtBASLIK.Text; s.LINK = txtLINK.Text; s.DURUMU = Convert.ToBoolean(ddlDURUMU.SelectedValue); s.RESIM = RESIM1.FileName; RESIM1.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM1.FileName); db.SaveChanges(); } else { SLIDER s = new SLIDER(); s.BASLIK = txtBASLIK.Text; s.LINK = txtLINK.Text; s.DURUMU = Convert.ToBoolean(ddlDURUMU.SelectedValue); s.RESIM = RESIM1.FileName; RESIM1.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM1.FileName); db.SLIDERs.Add(s); db.SaveChanges(); } GridView1.DataSource = db.SLIDERs.ToList(); GridView1.DataBind(); pnlKayit.Visible = false; pnlListe.Visible = true; }
protected void Button3_Click(object sender, EventArgs e) { // KAYDET if (txtPROJE_REFNO.Text != "") { int refno = Convert.ToInt32(txtPROJE_REFNO.Text); PROJE p = db.PROJEs.Find(refno); p.PROJE_ADI = txtPROJE_ADI.Text; p.ACIKLAMA = HttpUtility.HtmlDecode(txtACIKLAMA.Text); p.RESIM = RESIM1.FileName; RESIM1.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM1.FileName); db.SaveChanges(); } else { PROJE p = new PROJE(); p.PROJE_ADI = txtPROJE_ADI.Text; p.ACIKLAMA = HttpUtility.HtmlDecode(txtACIKLAMA.Text); p.RESIM = RESIM1.FileName; RESIM1.SaveAs(Request.PhysicalApplicationPath + "/images/" + RESIM1.FileName); db.PROJEs.Add(p); db.SaveChanges(); } GridView1.DataSource = db.PROJEs.ToList(); GridView1.DataBind(); pnlKayit.Visible = false; pnlListe.Visible = true; }