public static int Giris(string kullaniciAd, string sifre)
        {
            using (hesapEntities he = new hesapEntities())
            {
                var kullanicilar = he.Kullanicilar.ToList();
                foreach (var item in kullanicilar)
                {
                    if (item.KullaniciAd == kullaniciAd && item.KullaniciSifre.ToString() == sifre)
                    {
                        return(0);
                    }
                    //else if (item.KullaniciSifre != sifre)
                    //{
                    //    return 1;

                    //}
                    //else if (item.KullaniciAd != kullaniciAd)
                    //{
                    //    return 2;
                    //}
                }
            }

            return(3);
        }
Example #2
0
        public static List <UrunlerModel> ReturnUrunler(int ID)
        {
            List <UrunlerModel> urunler = new List <UrunlerModel>();

            using (hesapEntities he = new hesapEntities())
            {
                List <Urunler> urunlers = he.Urunler.ToList();
                foreach (var item in urunlers)
                {
                    UrunlerModel um = new UrunlerModel();
                    if (item.KategoriID == ID)
                    {
                        um.UrunAd     = item.UrunAd;
                        um.SatisUcret = item.SatisUcret;
                        um.UrunDesc   = item.UrunDesc;

                        um.KategoriID = item.KategoriID;
                        um.GelisUcret = item.GelisUcret;
                        um.Stok       = item.Stok;
                        urunler.Add(um);
                    }
                }
            }
            return(urunler);
        }
Example #3
0
        public static List <UrunlerModel> UrunlerAsList()
        {
            List <UrunlerModel> urunlerList = new List <UrunlerModel>();

            using (hesapEntities he = new hesapEntities())
            {
                var list         = he.Urunler.ToList();
                var kategoriList = he.Kategoriler.ToList();
                foreach (var item in list)
                {
                    UrunlerModel um = new UrunlerModel();
                    um.UrunID     = item.UrunID;
                    um.UrunAd     = item.UrunAd;
                    um.KategoriID = item.KategoriID;
                    um.GelisUcret = item.GelisUcret;
                    um.SatisUcret = item.SatisUcret;
                    um.Stok       = item.Stok;
                    um.UrunDesc   = item.UrunDesc;
                    foreach (var kategori in kategoriList)
                    {
                        if (item.KategoriID == kategori.KategoriID)
                        {
                            um.km.KategoriAd   = kategori.KategoriAd;
                            um.km.KategoriDesc = kategori.KategoriDesc;
                        }
                    } //kategori adının ve açıklamasının dahil edilmesi

                    urunlerList.Add(um);
                }
            }
            return(urunlerList);
        }
Example #4
0
        public static int KarZararHesapla()
        {
            int totalAlis = 0, totalSatis = 0;

            using (hesapEntities he = new hesapEntities())
            {
                var satisList = he.Satislar.ToList();
                var urunList  = he.Urunler.ToList();

                foreach (var item in satisList)
                {
                    UrunlerModel um = new UrunlerModel();
                    um.UrunID      = item.UrunID;
                    um.sm.UrunAdet = item.UrunAdet;
                    foreach (var itemUrun in urunList)
                    {
                        if (um.UrunID == itemUrun.UrunID)
                        {
                            int adet  = um.sm.UrunAdet;
                            int satis = itemUrun.SatisUcret;
                            int alis  = itemUrun.GelisUcret;
                            totalAlis  = adet * alis;
                            totalSatis = adet * satis;
                        }
                    }
                }
                int fark = totalSatis - totalAlis;
                return(fark);
            }
        }
Example #5
0
        //idye eşit olan ürünlerin adı, satış fiyatı, açıklaması gelecek

        public static List <Urunler> ReturnUrunler()
        {
            using (hesapEntities he = new hesapEntities())
            {
                return(he.Urunler.ToList());
            }
        }
Example #6
0
        } //ürün yönetimi kategori ekleme

        public void ComboBox2Fill()
        {
            using (hesapEntities he = new hesapEntities())
            {
                var list = he.Kategoriler.ToList();
                foreach (var item in list)
                {
                    comboBox2.Items.Add(item.KategoriAd);
                }
            }
        } //ürün yönetimi kategori ekleme
 public static bool UpdateKullanicilar(Kullanicilar kk)
 {
     using (hesapEntities he = new hesapEntities())
     {
         he.Entry(kk).State = EntityState.Modified;
         if (he.SaveChanges() > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #8
0
 public static bool AddMusteri(MusterilerModel m)
 {
     using (hesapEntities he = new hesapEntities())
     {
         Musteriler musteri = ConvertToMusteriler(m);
         he.Musteriler.Add(musteri);
         if (he.SaveChanges() > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
 public static bool DeleteKategori(int ID)
 {
     using (hesapEntities he = new hesapEntities())
     {
         var id = he.Kategoriler.Find(ID);
         he.Kategoriler.Remove(id);
         if (he.SaveChanges() > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #10
0
 public static bool DeleteUrun(int ID)
 {
     using (hesapEntities he = new hesapEntities())
     {
         var s = he.Urunler.Find(ID);
         he.Urunler.Remove(s);
         if (he.SaveChanges() > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Example #11
0
 public static bool AddSatislar(SatislarModel sm)
 {
     using (hesapEntities he = new hesapEntities())
     {
         var s = ConvertToSatislar(sm);
         he.Satislar.Add(s);
         if (he.SaveChanges() > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
        public static bool UpdateKategori(KategorilerModel km)
        {
            var k = ConvertToKategoriler(km);

            using (hesapEntities he = new hesapEntities())
            {
                he.Entry(k).State = EntityState.Modified;
                if (he.SaveChanges() > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #13
0
        public static bool UpdateUrun(UrunlerModel um)
        {
            var urun = ConvertToUrunler(um);

            using (hesapEntities he = new hesapEntities())
            {
                he.Entry(urun).State = EntityState.Modified;
                if (he.SaveChanges() > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #14
0
        public static bool AddUrun(UrunlerModel um)
        {
            var u = ConvertToUrunler(um);

            using (hesapEntities he = new hesapEntities())
            {
                he.Urunler.Add(u);
                if (he.SaveChanges() > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #15
0
        public static string FindMusteriAd(int ID)
        {
            string musteriAd = "";

            using (hesapEntities he = new hesapEntities())
            {
                var list = he.Musteriler.ToList();
                foreach (var item in list)
                {
                    if (item.MusteriID == ID)
                    {
                        musteriAd = item.MusteriAd;
                    }
                }
            }
            return(musteriAd);
        }
Example #16
0
        public static bool UpdateMusteri(MusterilerModel mm)
        {
            var musteri = ConvertToMusteriler(mm);

            using (hesapEntities he = new hesapEntities())
            {
                he.Entry(musteri).State = EntityState.Modified;
                if (he.SaveChanges() > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #17
0
        public static int FindUrunID(string ad, int kategoriID)
        {
            int urunID = 0;

            using (hesapEntities he = new hesapEntities())
            {
                var list = he.Urunler.ToList();
                foreach (var item in list)
                {
                    if (item.UrunAd.Equals(ad) && item.KategoriID.Equals(kategoriID))
                    {
                        urunID = item.UrunID;
                    }
                }
            }
            return(urunID);
        }
        public static bool AddKategori(KategorilerModel km)
        {
            var f = ConvertToKategoriler(km);

            using (hesapEntities he = new hesapEntities())
            {
                he.Kategoriler.Add(f);
                if (he.SaveChanges() > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #19
0
        //public static bool UpdateUrunler(UrunlerModel um)
        //{
        //    Urunler u = new Urunler();
        //    using (hesapEntities he = new hesapEntities())
        //    {
        //        u.UrunID = um.UrunID;

        //        he.Entry(u).State = EntityState.Modified;
        //        if (he.SaveChanges() > 0)
        //        {
        //            return true;
        //        }
        //        else
        //            return false;
        //    }
        //}
        public static string FindKategoriAd(int ID)
        {
            string kategori = "";

            using (hesapEntities he = new hesapEntities())
            {
                var list = he.Kategoriler.ToList();
                foreach (var item in list)
                {
                    if (item.KategoriID == ID)
                    {
                        kategori = item.KategoriAd;
                    }
                }
            }
            return(kategori);
        }
Example #20
0
        public static int FindKategoriID(string ad)
        {
            int id = 0;

            using (hesapEntities he = new hesapEntities())
            {
                var kategoriler = he.Kategoriler.ToList();
                foreach (var item in kategoriler)
                {
                    if (item.KategoriAd.Equals(ad))
                    {
                        id = item.KategoriID;
                    }
                }
            }
            return(id);
        }
Example #21
0
        public static List <UrunlerModel> KategorilerAsList()
        {
            List <UrunlerModel> kategoriAdlar = new List <UrunlerModel>();

            using (hesapEntities he = new hesapEntities())
            {
                var kategoriler = he.Kategoriler.ToList();
                foreach (var item in kategoriler)
                {
                    UrunlerModel um = new UrunlerModel();
                    um.km.KategoriAd   = item.KategoriAd;
                    um.km.KategoriID   = item.KategoriID;
                    um.km.KategoriDesc = item.KategoriDesc;
                    kategoriAdlar.Add(um);
                }
            }
            return(kategoriAdlar);
        }
Example #22
0
        public static int FindUrun(UrunlerModel um)
        {
            int urunID = 0;

            using (hesapEntities he = new hesapEntities())
            {
                var urunList = he.Urunler.ToList();

                foreach (var item in urunList)
                {
                    if (um.UrunAd.Equals(item.UrunAd) && um.GelisUcret.Equals(item.GelisUcret) && um.SatisUcret.Equals(item.SatisUcret))
                    {
                        urunID = item.UrunID;
                    }
                }
            }
            return(urunID);
        }
Example #23
0
        public static int FindMusteri(MusterilerModel m)
        {
            int musteriID = 0;

            using (hesapEntities he = new hesapEntities())
            {
                var list = he.Musteriler.ToList();
                foreach (var item in list)
                {
                    if (m.MusteriAd.Equals(item.MusteriAd) && m.MusteriSoyad.Equals(item.MusteriSoyad) &&
                        m.Telefon.Equals(item.Telefon) && m.Adres.Equals(item.Adres))
                    {
                        musteriID = item.MusteriID;
                    }
                }
            }

            return(musteriID);
        }
        public static List <KategorilerModel> KategorilerAsList()
        {
            List <KategorilerModel> km = new List <KategorilerModel>();

            using (hesapEntities he = new hesapEntities())
            {
                var klist = he.Kategoriler.ToList();
                foreach (var item in klist)
                {
                    KategorilerModel k = new KategorilerModel();
                    k.KategoriAd   = item.KategoriAd;
                    k.KategoriDesc = item.KategoriDesc;
                    k.KategoriID   = item.KategoriID;

                    km.Add(k);
                }
            }
            return(km);
        }
Example #25
0
        public static List <MusterilerModel> MusterilerAsList()
        {
            List <MusterilerModel> musteriList = new List <MusterilerModel>();

            using (hesapEntities he = new hesapEntities())
            {
                var list = he.Musteriler.ToList();
                foreach (Musteriler item in list)
                {
                    MusterilerModel mm = new MusterilerModel();
                    mm.MusteriID    = item.MusteriID;
                    mm.MusteriAd    = item.MusteriAd;
                    mm.MusteriSoyad = item.MusteriSoyad;
                    mm.Telefon      = item.Telefon;
                    mm.Adres        = item.Adres;
                    musteriList.Add(mm);
                }
            }

            return(musteriList);
        }
        public static Kullanicilar SifreDegistir(string kAd, string eSifre, string ySifre)
        {
            Kullanicilar k = new Kullanicilar();

            using (hesapEntities he = new hesapEntities())
            {
                var list = he.Kullanicilar.ToList();
                foreach (var item in list)
                {
                    if (item.KullaniciAd == kAd)
                    {
                        if (item.KullaniciSifre == eSifre)
                        {
                            k.KullaniciAd    = kAd;
                            k.KullaniciSifre = ySifre;
                            k.KullaniciID    = item.KullaniciID;
                        }
                    }
                }
            }
            return(k);
        }
Example #27
0
        public static List <UrunlerModel> UruneGoreRapor(int id, DateTime value1, DateTime value2)
        {
            List <UrunlerModel> rapor = new List <UrunlerModel>();

            using (hesapEntities he = new hesapEntities())
            {
                var satislarList = he.Satislar.ToList();
                var urunlerList  = ReturnUrunler();


                foreach (var item in satislarList)
                {
                    if (id == item.UrunID)
                    {
                        UrunlerModel um = new UrunlerModel();
                        if (value1 <= item.SatisDate && value2 >= item.SatisDate)
                        {
                            um.sm.SatisDate = item.SatisDate;
                            um.sm.UrunAdet  = item.UrunAdet;
                            um.sm.MusteriID = item.MusteriID;
                            foreach (var urun in urunlerList)
                            {
                                if (urun.UrunID == item.UrunID)
                                {
                                    um.SatisUcret    = urun.SatisUcret;
                                    um.UrunAd        = urun.UrunAd;
                                    um.km.KategoriAd = FindKategoriAd(urun.KategoriID);
                                }
                            }
                            rapor.Add(um);
                        }
                    }
                }
                return(rapor);
            }
        }