protected void gvSatis_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Duzenle") { guid = Convert.ToInt32(e.CommandArgument); lblId.Text = guid.ToString(); Satis.Text = "Guncelle"; //? if (guid != 0) { bagla(guid, sender, e); } ModalSatis.Show(); } else if (e.CommandName == "Sil") { try { long YemeklerId = Convert.ToInt64(e.CommandArgument); Satis Satis = SatisBLL.SelectWithId(YemeklerId); if (Satis != null) { Satis.SatisAktif = false; SatisBLL.Update(YemeklerId, Satis); } GridDoldur(); } catch (Exception ex) { } } }
protected void gvSatis_RowCommand(object sender, GridViewCommandEventArgs e) { string connString = ConfigurationManager.ConnectionStrings["cs"].ToString(); SqlConnection conn = new SqlConnection(connString); SqlCommand goruntule = new SqlCommand(); conn.Open(); if (e.CommandName == "Duzenle") { int guid = Convert.ToInt32(e.CommandArgument); lblSatisID.Text = guid.ToString(); goruntule.Connection = conn; goruntule.CommandText = "Select * from Satis where SatisId=@SatisId"; goruntule.Parameters.AddWithValue("SatisId", guid); goruntule.ExecuteNonQuery(); SqlDataReader dr = goruntule.ExecuteReader(); if (dr.Read()) { txtSatisAdet.Text = dr["SatisAdet"].ToString(); txtSatisTarih.Text = Convert.ToDateTime(dr["SatisTarih"].ToString()).ToShortDateString(); txtSatisTutar.Text = dr["SatisTutar"].ToString(); ddlYemekId.SelectedValue = dr["YemekId"].ToString(); } ModalSatis.Show(); } else if (e.CommandName == "Sil") { int guid = Convert.ToInt32(e.CommandArgument); SqlCommand sil = new SqlCommand("Delete from Satis where SatisId=@SatisId", conn); sil.Parameters.AddWithValue("SatisId", guid); sil.ExecuteNonQuery(); gvSatisDoldur(); } }
protected void btnPopupSatis_Click(object sender, EventArgs e) { ModalSatis.Show(); }