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) { } } }
private void btnGeriGetir_Click(object sender, EventArgs e) { if (cmbTablolar.SelectedIndex == 0) { if (kategoribll.GetBack(kategori)) { MessageBox.Show("geri geldi"); bll = new SatisBLL(); dto = bll.Select(true); dataGridView1.DataSource = dto.Kategoriler; } } if (cmbTablolar.SelectedIndex == 1) { if (urunbll.GetBack(urun)) { if (urun.isKategoriDeleted) { MessageBox.Show("Kategori silindi bu ürün geri getirilemez"); } else { MessageBox.Show("geri geldi"); bll = new SatisBLL(); dto = bll.Select(true); dataGridView1.DataSource = dto.Urunler; } } } if (cmbTablolar.SelectedIndex == 2) { if (musteribll.GetBack(musteri)) { MessageBox.Show("geri geldi"); bll = new SatisBLL(); dto = bll.Select(true); dataGridView1.DataSource = dto.Musteriler; } } if (cmbTablolar.SelectedIndex == 3) { if (bll.GetBack(satis)) { if (!satis.udeleted && !satis.kdeleted && !satis.mdeleted) { MessageBox.Show("Silinememz"); } else { MessageBox.Show("geri geldi"); bll = new SatisBLL(); dto = bll.Select(true); dataGridView1.DataSource = dto.Satislar; } } } }
private void bagla(long guid, object sender, EventArgs e) { try { Satis Satis = SatisBLL.SelectWithId(guid); if (Satis != null) { if (ddlYemekId != null) { ddlYemekId.SelectedValue = ddlYemekId.ToString(); } else { ddlYemekId.SelectedValue = ""; } if (Satis.SatisAdet != null) { string gecici = Satis.SatisAdet.ToString(); txtSatisAdet.Text = gecici.ToString(); } else { txtSatisAdet.Text = ""; } if (Satis.SatisTarih != null) { txtSatisTarih.Text = Satis.SatisTarih.Value.ToShortDateString(); } else { txtSatisTarih.Text = ""; } if (!string.IsNullOrEmpty(Satis.SatisTutar)) { txtSatisTutar.Text = Satis.SatisTutar; } else { txtSatisTutar.Text = ""; } } } catch (Exception ex) { } }
protected void GridDoldur() { gvSatis.Visible = true; try { //if (ddlYemekEkle.SelectedValue != "0") //{ // int gecici = Convert.ToInt32(ddlYemekId.SelectedValue); // Expression<Func<Satis, bool>> pr1 = p => p.YemekId == gecici; //} //if (ddlYemekId.SelectedValue != "0") //{ // int vergi = Convert.ToInt32(ddlYemekId.SelectedValue); // Expression<Func<Satis, bool>> pr1 = p => p.YemekId == vergi; // predicates.Add(pr1); //} //if (!string.IsNullOrEmpty(txtSatisAdet.Text)) //{ // int kayit = Convert.ToInt32(txtSatisAdet.Text); // Expression<Func<Satis, bool>> pr1 = p => p.SatisAdet == kayit; // predicates.Add(pr1); //} //if (!string.IsNullOrEmpty(txtSatisTarih.Text)) //{ // DateTime tarih = Convert.ToDateTime(txtSatisTarih.Text); // Expression<Func<Satis, bool>> pr1 = p => p.SatisTarih == tarih; // predicates.Add(pr1); //} //if (!string.IsNullOrEmpty(txtSatisTutar.Text)) //{ // string temp = txtSatisTutar.Text; // Expression<Func<Satis, bool>> pr1 = p => p.SatisTutar == temp; // == yap // predicates.Add(pr1); //} Expression <Func <Satis, bool> > pr3 = p => p.SatisAktif == true; predicates.Add(pr3); List <Satis> SatisList = SatisBLL.SelectOrderedPaged(predicates, new Expression <Func <Satis, string> >[] { p => p.SatisTarih.ToString() }, false).ToList(); gvSatis.DataSource = SatisList; gvSatis.DataBind(); } catch (Exception ex) { } }
private void btnSil_Click(object sender, EventArgs e) { if (detay.SatisID == 0) { MessageBox.Show("Satış seçiniz."); } DialogResult result = MessageBox.Show("Silinsinmi", "Dikkat", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { if (bll.Delete(detay)) { MessageBox.Show("Silindi"); bll = new SatisBLL(); dto = bll.Select(); dataGridView1.DataSource = dto.Satislar; } } }
private void btnGuncelle_Click(object sender, EventArgs e) { if (detay.UrunID == 0) { MessageBox.Show("Seçim yapınız"); } else { FrmSatis frm = new FrmSatis(); frm.dto = dto; frm.detaydto = detay; frm.isUpdate = true; this.Hide(); frm.ShowDialog(); this.Visible = true; bll = new SatisBLL(); dto = bll.Select(); dataGridView1.DataSource = dto.Satislar; } }
protected void Satis_Click(object sender, EventArgs e) { try { guid = 0; if (!string.IsNullOrEmpty(lblId.Text)) //? { guid = Convert.ToInt32(lblId.Text); } if (guid == 0) { Satis Satis = new Satis(); Satis.SatisAktif = true; Satis.YemekId = Convert.ToInt32(ddlYemekId.SelectedValue); Satis.SatisAdet = Convert.ToInt32(txtSatisAdet.Text); Satis.SatisTarih = Convert.ToDateTime(txtSatisTarih.Text); Satis.SatisTutar = txtSatisTutar.Text; if (!string.IsNullOrEmpty(txtSatisAdet.Text)) { Satis.SatisAdet = Convert.ToInt32(txtSatisAdet.Text); } else { Satis.SatisAdet = null; } if (!string.IsNullOrEmpty(txtSatisTarih.Text)) { Satis.SatisTarih = Convert.ToDateTime(txtSatisTarih.Text); } else { Satis.SatisTarih = null; } if (!string.IsNullOrEmpty(txtSatisTutar.Text)) { Satis.SatisTutar = txtSatisTutar.Text; } else { Satis.SatisTutar = null; } SatisBLL.Insert(Satis); GridDoldur(); // } // else // { // Satis Satis = SatisBLL.SelectWithId(guid); // if(Satis != null) // { // Satis.SatisAktif = true; // Satis.YemekId = Convert.ToInt32(ddlYemekId.SelectedValue); // Satis.SatisAdet = Convert.ToInt32(txtSatisAdet.Text); // Satis.SatisTarih = Convert.ToDateTime(txtSatisTarih.Text); // Satis.SatisTutar = txtSatisTutar.Text; // if(string.IsNullOrEmpty(ddlYemekId.SelectedValue)) // Satis.YemekId = Convert.ToInt32(ddlYemekId.Text); // else Satis.YemekId = null; // if(!string.IsNullOrEmpty(txtSatisAdet.Text)) // Satis.SatisAdet = Convert.ToInt32(ddlYemekId.Text); // else Satis.SatisAdet = null; // if(!string.IsNullOrEmpty(txtSatisTarih.Text)) // Satis.SatisTarih = Convert.ToDateTime(txtSatisTarih.Text); // else Satis.SatisTarih = null; // if(!string.IsNullOrEmpty(txtSatisTutar.Text)) // Satis.SatisTutar = txtSatisTutar.Text; // else Satis.SatisTutar = null; // Satis.SatisId = guid; // SatisBLL.Update(Satis.SatisId, Satis); // } // } // } // catch(Exception ex) // {} // GridDoldur(); //} } } catch (Exception ex) { } }