Exemple #1
0
        public void Kesinlestir(int nobetUstGrupId)
        {
            var eczaneNobetSonucAktifler = _eczaneNobetSonucAktifService.GetSonuclar2(nobetUstGrupId);

            foreach (var aktifSonuc in eczaneNobetSonucAktifler)
            {
                var insertEntity = new EczaneNobetSonuc
                {
                    EczaneNobetGrupId = aktifSonuc.EczaneNobetGrupId,
                    TakvimId          = aktifSonuc.TakvimId,
                    NobetGorevTipId   = aktifSonuc.NobetGorevTipId
                };
                _eczaneNobetSonucService.Insert(insertEntity);
            }
        }
        public ActionResult Create([Bind(Include = "Id,EczaneNobetGrupId,NobetTarihi,Aciklama")] EczaneNobetSanalSonucEkle eczaneNobetSanalSonuc)
        {
            if (eczaneNobetSanalSonuc.NobetTarihi == null)
            {
                throw new ArgumentNullException("Nöbet tarihi boş bırakılamaz.");
            }

            if (ModelState.IsValid)
            {
                var user   = _userService.GetByUserName(User.Identity.Name);
                var takvim = _takvimService.GetByTarih(eczaneNobetSanalSonuc.NobetTarihi);
                var eczane = _eczaneNobetGrupService.GetDetayById(eczaneNobetSanalSonuc.EczaneNobetGrupId);

                var sonucParametreler = new EczaneNobetSonuc
                {
                    TakvimId          = takvim.Id,
                    NobetGorevTipId   = eczane.NobetGorevTipId,
                    EczaneNobetGrupId = eczaneNobetSanalSonuc.EczaneNobetGrupId,
                    //YayimlandiMi = eczaneNobetSanalSonuc.YayimlandiMi
                };

                var sanalSonucParametreler = new EczaneNobetSanalSonuc
                {
                    //EczaneNobetSonucId = sonuc.Id,
                    KayitTarihi = DateTime.Now,
                    UserId      = user.Id,
                    Aciklama    = eczaneNobetSanalSonuc.Aciklama
                };

                _eczaneNobetSonucService.InsertSonuclarInsertSanalSonuclar(sonucParametreler, sanalSonucParametreler);

                return(RedirectToAction("Index"));
            }

            var nobetUstGrup = _nobetUstGrupSessionService.GetSession("nobetUstGrup");

            var eczaneler = _eczaneService.GetDetaylar(nobetUstGrup.Id);

            var eczaneNobetGruplar = _eczaneNobetGrupService.GetDetaylarByEczaneIdList(eczaneler.Select(s => s.Id).ToList())
                                     .OrderBy(s => s.EczaneAdi).ThenBy(t => t.NobetGrupAdi)
                                     .Select(s => new MyDrop {
                Id = s.Id, Value = $"{s.EczaneAdi}, {s.NobetGrupGorevTipAdi}"
            });

            ViewBag.EczaneNobetGrupId = new SelectList(eczaneNobetGruplar, "Id", "Value", eczaneNobetSanalSonuc.EczaneNobetGrupId);

            return(View(eczaneNobetSanalSonuc));
        }