public bool giris(string kullaniciAdi, string sifre)
        {
            bool          a        = false;
            cGenel        gnl      = new cGenel();
            SqlConnection baglanti = new SqlConnection(gnl.baglantiMetni);
            SqlCommand    komut    = new SqlCommand("select PAROLA from personeller where KULLANICIADI=@kullaniciadi", baglanti);

            if (baglanti.State == ConnectionState.Closed)
            {
                baglanti.Open();
            }
            komut.Parameters.Add("@kullaniciadi", SqlDbType.NVarChar).Value = kullaniciAdi;
            SqlDataReader oku        = komut.ExecuteReader();
            string        dogruSifre = "";

            while (oku.Read())
            {
                dogruSifre = oku["PAROLA"].ToString();
            }
            if (sifre == dogruSifre)
            {
                a = true;
            }
            else
            {
                MessageBox.Show("Şifre Yanlış", "HATA", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(a);
        }
        public void lvYaz(ListView lv, int kategoriId)
        {
            cGenel        cg    = new cGenel();
            SqlConnection bag   = new SqlConnection(cg.baglantiMetni);
            SqlCommand    komut = new SqlCommand("select * from urunler where KATEGORIID=@kategoriId", bag);

            if (bag.State == ConnectionState.Closed)
            {
                bag.Open();
            }


            komut.Parameters.Add("@kategoriId", SqlDbType.Int).Value = kategoriId;

            SqlDataReader okuma = komut.ExecuteReader();
            int           i     = 0;

            lv.Items.Clear();
            while (okuma.Read())
            {
                //ad, fiyat, kategori id, id
                lv.Items.Add(okuma["URUNAD"].ToString());
                lv.Items[i].SubItems.Add(okuma["FIYAT"].ToString());
                lv.Items[i].SubItems.Add(okuma["ID"].ToString());
                lv.Items[i].SubItems.Add(okuma["KATEGORIID"].ToString());
                i++;
            }
        }
Exemple #3
0
        private void FrmSiparis_Load(object sender, EventArgs e)
        {
            cGenel   cg = new cGenel();
            cMasalar cm = new cMasalar();

            lblMasaNo.Text = "MASA > " + cGenel.masaNumarası + " <";
            cm.masaOdenenTutarEkle(0);
            SqlConnection baglanti = new SqlConnection(cg.baglantiMetni);
            SqlCommand    komut    = new SqlCommand("select URUNAD, ADET, satislar.FIYAT, satislar.ACIKLAMA, urunler.ID, KATEGORIID from urunler inner join satislar on urunler.ID=satislar.URUNID where MASAID=@masaId", baglanti);

            komut.Parameters.AddWithValue("@masaId", cGenel.masaNumarası);
            if (baglanti.State == ConnectionState.Closed)
            {
                baglanti.Open();
            }
            SqlDataReader okuma = komut.ExecuteReader();
            int           i     = 0;

            while (okuma.Read())
            {
                lvSiparisler.Items.Add(okuma["URUNAD"].ToString());
                lvSiparisler.Items[i].SubItems.Add(okuma["ADET"].ToString());
                lvSiparisler.Items[i].SubItems.Add(okuma["FIYAT"].ToString());
                lvSiparisler.Items[i].SubItems.Add(okuma["ACIKLAMA"].ToString());
                lvSiparisler.Items[i].SubItems.Add(okuma["ID"].ToString());
                lvSiparisler.Items[i].SubItems.Add(okuma["KATEGORIID"].ToString());
                i++;
            }
            okuma.Close();
            baglanti.Close();
            cSiparisler cs = new cSiparisler();

            txtKalanBorc.Text = "Borç: " + cs.borcCek() + "TL";
        }
 public void siparisSil(int urunId)
 {
     cGenel cg = new cGenel();
     SqlConnection bag = new SqlConnection(cg.baglantiMetni);
     SqlCommand komut = new SqlCommand("delete from satislar where URUNID=" + urunId + " and MASAID=" + cGenel.masaNumarası, bag);
     if (bag.State == ConnectionState.Closed)
         bag.Open();
     komut.ExecuteNonQuery();
     bag.Close();
 }
Exemple #5
0
        public void masaDurumDegistir(int masaNo, int durum)
        {
            cGenel        cg    = new cGenel();
            SqlConnection bag   = new SqlConnection(cg.baglantiMetni);
            SqlCommand    komut = new SqlCommand("update masalar set DURUM=@durum where ID=@masano", bag);

            komut.Parameters.AddWithValue("@durum", durum);
            komut.Parameters.AddWithValue("@masano", masaNo);
            if (bag.State == ConnectionState.Closed)
            {
                bag.Open();
            }
            komut.ExecuteNonQuery();
            bag.Close();
        }
 public int borcCek()
 {
     int borc = 0;
     cGenel cg = new cGenel();
     SqlConnection bag = new SqlConnection(cg.baglantiMetni);
     SqlCommand komut = new SqlCommand("select sum(FIYAT) as BORC from satislar where MASAID=" + cGenel.masaNumarası, bag);
     if (bag.State == ConnectionState.Closed)
         bag.Open();
     SqlDataReader okuma = komut.ExecuteReader();
     while (okuma.Read())
         borc = okuma["BORC"] != DBNull.Value ? Convert.ToInt32(okuma["BORC"]) : 0;
     borc -= (int)cGenel.odenenMiktar[cGenel.masaNumarası];
     okuma.Close();
     bag.Close();
     return borc;
 }
        public void siparisVer(int urunId, int adet, string aciklama, string adSoyad, string telNo, string adres)
        {
            cGenel        cg    = new cGenel();
            SqlConnection bag   = new SqlConnection(cg.baglantiMetni);
            SqlCommand    komut = new SqlCommand("insert into paketSiparis (URUNID, ADET, ACIKLAMA, M_ADSOYAD, M_TELEFONNO, M_ADRES) values (@urunId, @adet, @aciklama, @adSoyad, @telNo, @adres)", bag);

            komut.Parameters.AddWithValue("urunId", urunId);
            komut.Parameters.AddWithValue("adet", adet);
            komut.Parameters.AddWithValue("aciklama", aciklama);
            komut.Parameters.AddWithValue("adSoyad", adSoyad);
            komut.Parameters.AddWithValue("telNo", telNo);
            komut.Parameters.AddWithValue("adres", adres);
            if (bag.State == ConnectionState.Closed)
            {
                bag.Open();
            }
            komut.ExecuteNonQuery();
            komut.Dispose();
            bag.Close();
        }
 public void siparisEkle(int urunId, int adet, string fiyat, string aciklama)
 {
     cGenel cg = new cGenel();
     SqlConnection bag = new SqlConnection(cg.baglantiMetni);
     SqlCommand komut = new SqlCommand("select * from satislar where MASAID=" + cGenel.masaNumarası + " and URUNID=" + urunId, bag);
     if (bag.State == ConnectionState.Closed)
         bag.Open();
     int sayi = Convert.ToInt32(komut.ExecuteScalar());
     if (sayi > 0)
     {
         //bu ürün daha önce bu masada varsa güncelleme yapılır
         if (fiyat.Contains(","))
         {
             fiyat = fiyat.Insert(fiyat.IndexOf(",") + 1, ".");
             fiyat = fiyat.Remove(fiyat.IndexOf(","), 1);
         }
         komut = new SqlCommand("update satislar set ADET=" + adet + ", FIYAT=" + fiyat + " where MASAID=" + cGenel.masaNumarası + " and URUNID=" + urunId, bag);
         if (bag.State == ConnectionState.Closed)
             bag.Open();
         komut.ExecuteNonQuery();
     }
     else
     {
         //masaya bu ürün ilk defa eklenir
         while (fiyat.Contains(","))
         {
             fiyat = fiyat.Insert(fiyat.IndexOf(",") + 1, ".");
             fiyat = fiyat.Remove(fiyat.IndexOf(","), 1);
         }
         komut = new SqlCommand("insert into satislar (ADISYONID, MASAID, URUNID, FIYAT, ADET, ACIKLAMA) values (" + cGenel.masaNumarası + "," + cGenel.masaNumarası + "," + urunId + "," + fiyat + "," + adet + ",'" + aciklama + "')", bag);
         if (bag.State == ConnectionState.Closed)
             bag.Open();
         komut.ExecuteNonQuery();
     }
     komut.Dispose();
     bag.Close();
 }
Exemple #9
0
        public void masaOdenenTutarEkle(int miktar)
        {
            cGenel        cg    = new cGenel();
            SqlConnection bag   = new SqlConnection(cg.baglantiMetni);
            SqlCommand    komut = new SqlCommand("update masalar set ODENENTUTAR=@miktar where MASAID=" + cGenel.masaNumarası, bag);

            if (bag.State == ConnectionState.Closed)
            {
                bag.Open();
            }
            komut.Parameters.AddWithValue("@miktar", miktar);
            komut.ExecuteNonQuery();

            decimal tutar = 0;

            komut = new SqlCommand("select ODENENTUTAR from masalar where MASAID=" + cGenel.masaNumarası, bag);
            SqlDataReader oku = komut.ExecuteReader();

            while (oku.Read())
            {
                tutar = Convert.ToDecimal(oku["ODENENTUTAR"]);
            }
            cGenel.odenenMiktar[cGenel.masaNumarası] = tutar;
        }
Exemple #10
0
        private void BtnIcecek_Click(object sender, EventArgs e)
        {
            cGenel cg = new cGenel();

            cg.lvYaz(lvIcindekiler, 14);
        }
Exemple #11
0
        private void BtnTatlı_Click(object sender, EventArgs e)
        {
            cGenel cg = new cGenel();

            cg.lvYaz(lvIcindekiler, 13);
        }
Exemple #12
0
        private void BtnKahvaltı_Click(object sender, EventArgs e)
        {
            cGenel cg = new cGenel();

            cg.lvYaz(lvIcindekiler, 12);
        }
Exemple #13
0
        private void BtnMakarna_Click(object sender, EventArgs e)
        {
            cGenel cg = new cGenel();

            cg.lvYaz(lvIcindekiler, 10);
        }