Ejemplo n.º 1
0
        public ActionResult Announcement(int?duyuruId)
        {
            if (duyuruId == null)
            {
                if (Session["grup"].Equals(3))
                {
                    List <Urun>       urunler     = StokKontrolEntitiesProvider.GetAllProducts();
                    List <UrunTipi>   urunTipleri = StokKontrolEntitiesProvider.GetAllUrunTipi();
                    AnnouncementModel model       = new AnnouncementModel(1);
                    List <UrunModel>  urunList    = new List <UrunModel>();

                    foreach (Urun urun in urunler)
                    {
                        if (urun.UrunTipi != null)
                        {
                            urunList.Add(new UrunModel(urun, urunTipleri, urun.UrunTipi.UrunTipi1));
                        }
                        else
                        {
                            urunList.Add(new UrunModel(urun, urunTipleri));
                        }
                    }
                    model.urunList = urunList;
                    return(View(model));
                }
            }
            else
            {
                List <DuyuruBilgi> duyuruBilgi = StokKontrolEntitiesProvider.GetLastDuyuruBilgiToList(Convert.ToInt32(duyuruId));
                List <UrunModel>   urunList    = new List <UrunModel>();
                AnnouncementModel  model       = new AnnouncementModel(1);

                List <Urun> urunler = StokKontrolEntitiesProvider.GetAllProducts();

                foreach (var item in duyuruBilgi)
                {
                    urunList.Add(new UrunModel(item.Urun, Convert.ToInt32(item.Adet)));
                }
                foreach (Urun urun in urunler)
                {
                    if (urunList.Where(x => x.UrunAdi == urun.UrunAdi).FirstOrDefault() == null)
                    {
                        urunList.Add(new UrunModel(urun));
                    }
                }
                model.urunList = urunList;
                return(View(model));
            }
            return(RedirectToAction("Index", "Login"));
        }
Ejemplo n.º 2
0
        public ActionResult Products(List <UrunModel> gelenler)
        {
            if (Session["grup"].Equals(3))
            {
                List <Urun>      urunler     = StokKontrolEntitiesProvider.GetAllProducts();
                List <UrunTipi>  urunTipleri = StokKontrolEntitiesProvider.GetAllUrunTipi();
                List <UrunModel> model       = new List <UrunModel>();

                for (int i = 0; i < urunler.Count(); i++)
                {
                    if (urunler[i].StokMiktari == null)
                    {
                        urunler[i].StokMiktari = 0;
                    }
                    for (int j = 0; j < gelenler.Count(); j++)
                    {
                        if (urunler[i].ObjectId == gelenler[j].ObjectId && gelenler[j].Selected == true)
                        {
                            urunler[i].StokMiktari += gelenler[j].UretimMiktari;
                        }
                    }
                }
                StokKontrolEntitiesProvider.SaveChanges();

                foreach (Urun urun in urunler)
                {
                    if (urun.UrunTipi != null)
                    {
                        model.Add(new UrunModel(urun, urunTipleri, urun.UrunTipi.UrunTipi1));
                    }
                    else
                    {
                        model.Add(new UrunModel(urun, urunTipleri));
                    }
                }
                ModelState.Clear();
                return(View(model));
            }
            return(RedirectToAction("Index", "Login"));
        }
Ejemplo n.º 3
0
        public ActionResult Products()
        {
            if (Session["grup"].Equals(3))
            {
                List <Urun>      urunler     = StokKontrolEntitiesProvider.GetAllProducts();
                List <UrunTipi>  urunTipleri = StokKontrolEntitiesProvider.GetAllUrunTipi();
                List <UrunModel> model       = new List <UrunModel>();

                foreach (Urun urun in urunler)
                {
                    if (urun.UrunTipi != null)
                    {
                        model.Add(new UrunModel(urun, urunTipleri, urun.UrunTipi.UrunTipi1));
                    }
                    else
                    {
                        model.Add(new UrunModel(urun, urunTipleri));
                    }
                }
                return(View(model));
            }
            return(RedirectToAction("Index", "Login"));
        }