protected void btnKaydet_Click(object sender, EventArgs e) { try { BASVURU mn = new BASVURU(); mn.TARIFE = tbTar.Text; mn.AD = tbAd.Text; mn.CEP_TEL = tbCep.Text; mn.TEL = tbTel.Text; mn.ADRES = tbAdres.Text; mn.TAR = tbTarih.Text; mn.ONAY = cbOnay.Checked.ToString(); mn.A_ID = Convert.ToInt32(ddlAdmin.SelectedValue); string sonuc = String.Empty; if (AddEdit == 0) { BASVURUCRUD.Kaydet(mn); sonuc = "Kaydetme"; Temizle(); } else { mn.ID = AddEdit; BASVURUCRUD.Guncelle(mn); sonuc = "Güncelleme"; } Page.ClientScript.RegisterStartupScript(this.GetType(), "bilgi", "$.jGrowl('" + sonuc + " Başarılı" + "', { header: 'Sonuç' });", true); BASGetir(); } catch { Page.ClientScript.RegisterStartupScript(this.GetType(), "bilgi", "$.jGrowl('" + "İşleminizde Hata Oluştu Lütfen Kontrol Ediniz!" + "', { header: 'Sonuç' });", true); } }
protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(Request.QueryString["id"])) { AddEdit = Convert.ToInt32(Request.QueryString["id"]); } else { AddEdit = 0; } if (!Page.IsPostBack) { if (AddEdit != 0) { btnKaydet.Text = "Düzenle"; BASVURU mst = BASVURUCRUD.IdyeGoreBASVURUGetir(AddEdit); tbAd.Text = mst.AD; tbCep.Text = mst.CEP_TEL; tbTel.Text = mst.TEL; tbTar.Text = mst.TARIFE; tbAdres.Text = mst.ADRES; tbTarih.Text = mst.TAR; ddlAdmin.SelectedValue = mst.A_ID.ToString(); cbOnay.Checked = Convert.ToBoolean(mst.ONAY); } BASGetir(); } }
public static BASVURU IdyeGoreBASVURUGetir(int ID) { SQLiteDataAdapter da = new SQLiteDataAdapter("select * from BASVURU where ID=@ID", DBCon.BaglantiYap()); da.SelectCommand.Parameters.AddWithValue("@ID", ID); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count != 0) { BASVURU b = new BASVURU(); b.ID = Convert.ToInt32(dt.Rows[0]["ID"]); b.AD = Convert.ToString(dt.Rows[0]["AD"]); b.ADRES = Convert.ToString(dt.Rows[0]["ADRES"]); b.CEP_TEL = Convert.ToString(dt.Rows[0]["CEP_TEL"]); b.TEL = Convert.ToString(dt.Rows[0]["TEL"]); b.TARIFE = Convert.ToString(dt.Rows[0]["TARIFE"]); b.A_ID = Convert.ToInt32(dt.Rows[0]["A_ID"]); b.TAR = Convert.ToString(dt.Rows[0]["TAR"]); b.ONAY = Convert.ToString(dt.Rows[0]["ONAY"]); return(b); } else { return(null); } }
public static void Guncelle(BASVURU p) { SQLiteCommand cm = DBCon.KomutOlustur("update BASVURU set AD=@AD,ADRES=@ADRES,CEP_TEL=@CEP_TEL,TEL=@TEL,TARIFE=@TARIFE,A_ID=@A_ID,TAR=@TAR,ONAY=@ONAY where ID=@ID"); cm.Parameters.AddWithValue("@AD", p.AD); cm.Parameters.AddWithValue("@ADRES", p.ADRES); cm.Parameters.AddWithValue("@CEP_TEL", p.CEP_TEL); cm.Parameters.AddWithValue("@TEL", p.TEL); cm.Parameters.AddWithValue("@TARIFE", p.TARIFE); cm.Parameters.AddWithValue("@A_ID", p.A_ID); cm.Parameters.AddWithValue("@TAR", p.TAR); cm.Parameters.AddWithValue("@ONAY", p.ONAY); cm.Parameters.AddWithValue("@ID", p.ID); cm.Connection.Open(); cm.ExecuteNonQuery(); cm.Connection.Close(); }
public static void Kaydet(BASVURU p) { SQLiteCommand cm = DBCon.KomutOlustur("insert into BASVURU(ID,AD,ADRES,CEP_TEL,TEL,TARIFE,A_ID,TAR,ONAY)values (@ID,@AD,@ADRES,@CEP_TEL,@TEL,@TARIFE,@A_ID,@TAR,@ONAY)"); cm.Parameters.AddWithValue("@ID", null); cm.Parameters.AddWithValue("@AD", p.AD); cm.Parameters.AddWithValue("@ADRES", p.ADRES); cm.Parameters.AddWithValue("@CEP_TEL", p.CEP_TEL); cm.Parameters.AddWithValue("@TEL", p.TEL); cm.Parameters.AddWithValue("@TARIFE", p.TARIFE); cm.Parameters.AddWithValue("@A_ID", p.A_ID); cm.Parameters.AddWithValue("@TAR", p.TAR); cm.Parameters.AddWithValue("@ONAY", p.ONAY); cm.Connection.Open(); cm.ExecuteNonQuery(); cm.Connection.Close(); }