protected void btnKaydet_Click(object sender, EventArgs e) { try { ARIZA mn = new ARIZA(); mn.A_ID = Convert.ToInt32(ddlAdmin.SelectedValue); mn.M_ID = Convert.ToInt32(ddlMusteri.SelectedValue); mn.ONAY = cbOnay.Checked.ToString(); mn.TAR = tbTarih.Text; mn.MSJ = tbNot.Text; string sonuc = String.Empty; if (AddEdit == 0) { ARIZACRUD.Kaydet(mn); sonuc = "Kaydetme"; Temizle(); } else { mn.ID = AddEdit; ARIZACRUD.Guncelle(mn); sonuc = "Güncelleme"; } Page.ClientScript.RegisterStartupScript(this.GetType(), "bilgi", "$.jGrowl('" + sonuc + " Başarılı" + "', { header: 'Sonuç' });", true); ARGetir(); } 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"; ARIZA mst = ARIZACRUD.IdyeGoreARIZAGetir(AddEdit); ddlMusteri.SelectedValue = mst.M_ID.ToString(); ddlAdmin.SelectedValue = mst.A_ID.ToString(); cbOnay.Checked = Convert.ToBoolean(mst.ONAY); tbTarih.Text = mst.TAR; tbNot.Text = mst.MSJ; } ARGetir(); } }
public static void Guncelle(ARIZA p) { SQLiteCommand cm = DBCon.KomutOlustur("update ARIZA set M_ID=@M_ID,A_ID=@A_ID,TAR=@TAR,ONAY=@ONAY,MSJ=@MSJ where ID=@ID"); cm.Parameters.AddWithValue("@M_ID", p.M_ID); cm.Parameters.AddWithValue("@A_ID", p.A_ID); cm.Parameters.AddWithValue("@TAR", p.TAR); cm.Parameters.AddWithValue("@ONAY", p.ONAY); cm.Parameters.AddWithValue("@MSJ", p.MSJ); cm.Parameters.AddWithValue("@ID", p.ID); cm.Connection.Open(); cm.ExecuteNonQuery(); cm.Connection.Close(); }
public static void Kaydet(ARIZA p) { SQLiteCommand cm = DBCon.KomutOlustur("insert into ARIZA(ID,M_ID,A_ID,TAR,ONAY,MSJ)values (@ID,@M_ID,@A_ID,@TAR,@ONAY,@MSJ)"); cm.Parameters.AddWithValue("@ID", null); cm.Parameters.AddWithValue("@M_ID", p.M_ID); cm.Parameters.AddWithValue("@A_ID", p.A_ID); cm.Parameters.AddWithValue("@TAR", p.TAR); cm.Parameters.AddWithValue("@ONAY", p.ONAY); cm.Parameters.AddWithValue("@MSJ", p.MSJ); cm.Connection.Open(); cm.ExecuteNonQuery(); cm.Connection.Close(); }
public static ARIZA IdyeGoreARIZAGetir(int ID) { SQLiteDataAdapter da = new SQLiteDataAdapter("select * from ARIZA where ID=@ID", DBCon.BaglantiYap()); da.SelectCommand.Parameters.AddWithValue("@ID", ID); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count != 0) { ARIZA a = new ARIZA(); a.ID = Convert.ToInt32(dt.Rows[0]["ID"]); a.M_ID = Convert.ToInt32(dt.Rows[0]["M_ID"]); a.A_ID = Convert.ToInt32(dt.Rows[0]["A_ID"]); a.TAR = Convert.ToString(dt.Rows[0]["TAR"]); a.ONAY = Convert.ToString(dt.Rows[0]["ONAY"]); a.MSJ = Convert.ToString(dt.Rows[0]["MSJ"]); return(a); } else { return(null); } }