public ActionResult Create([Bind(Include = "Id,Adi,AcilisTarihi,KapanisTarihi,Enlem,Boylam,Adres,TelefonNo,MailAdresi,WebSitesi,NobetUstGrupId")] Eczane eczane)
        {
            if (ModelState.IsValid)
            {
                _eczaneService.Insert(eczane);
                TempData["EklenenEczane"] = eczane.Adi;

                var eczaneler = new int[1]
                {
                    eczane.Id
                };

                var eczaneNobetGrupCoklu = new EczaneNobetGrupCoklu
                {
                    EczaneId        = eczaneler,
                    BaslangicTarihi = eczane.AcilisTarihi,
                };

                TempData["EklenecekEczane"] = eczaneNobetGrupCoklu;

                return(RedirectToAction("Create", "EczaneNobetGrup"));
                //return RedirectToAction("Index");
            }
            var ustGrupSession  = _nobetUstGrupSessionService.GetSession("nobetUstGrup");
            var nobetUstGruplar = _nobetUstGrupService.GetDetaylar(ustGrupSession.Id);

            ViewBag.NobetUstGrupId = new SelectList(nobetUstGruplar, "Id", "Adi", eczane.NobetUstGrupId);

            return(View(eczane));
        }
Exemple #2
0
 public HttpResponseMessage GetEczane(int userId)
 {//virtual propertiesler web apide json serilizationda sorun çıkrıyor
     try
     {
         //User user = new User();
         //user = _userService.GetById(userId);
         EczaneApi eczaneApi = new EczaneApi();
         Eczane    eczane    = new Eczane();
         int       eczaneId  = _userEczaneService.GetDetaylarByUserId(userId).Select(s => s.EczaneId).FirstOrDefault();
         eczane                    = _eczaneService.GetById(eczaneId);
         eczaneApi.Id              = eczane.Id;
         eczaneApi.Adi             = eczane.Adi;
         eczaneApi.AcilisTarihi    = eczane.AcilisTarihi;
         eczaneApi.KapanisTarihi   = eczane.KapanisTarihi;
         eczaneApi.AdresTarifi     = eczane.AdresTarifi;
         eczaneApi.AdresTarifiKisa = eczane.AdresTarifiKisa;
         eczaneApi.Enlem           = eczane.Enlem;
         eczaneApi.Boylam          = eczane.Boylam;
         return(Request.CreateResponse(HttpStatusCode.OK, eczaneApi));
     }
     catch (Exception e)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, e.Message + e.InnerException.StackTrace));
     }
 }
        public ActionResult DeleteConfirmed(int id)
        {
            Eczane eczane = _eczaneService.GetById(id);

            _eczaneService.Delete(id);
            return(RedirectToAction("Index"));
        }
Exemple #4
0
        public void UserRoleEczaneGrupRegister(User user, string ezaneGln, string eczaneMail,
                                               string eczaneAdi, int eczaneGrupId)
        {
            UserRole   userRole   = new UserRole();
            EczaneUser eczaneUser = new EczaneUser();
            EczaneGrup eczaneGrup = new EczaneGrup();
            Eczane     eczane     = new Eczane();

            eczane.Adi        = eczaneAdi;
            eczane.EczaneGln  = ezaneGln;
            eczane.Email      = eczaneMail;
            eczaneGrup.GrupId = eczaneGrupId;

            eczaneGrup.BaslangicTarihi = DateTime.Now;

            _userDal.Insert(user);
            var myuser = GetByEmail(eczaneMail);

            userRole.UserId = myuser.Id;
            userRole.RoleId = 3;
            _userRoleDal.Insert(userRole);
            _eczaneDal.Insert(eczane);
            var myeczane = _eczaneDal.Get(x => x.EczaneGln == ezaneGln);

            eczaneUser.EczaneId = myeczane.Id;
            eczaneUser.UserId   = myuser.Id;
            _eczaneUserDal.Insert(eczaneUser);
            eczaneGrup.EczaneId = myeczane.Id;
            _eczaneGrupDal.Insert(eczaneGrup);
        }
Exemple #5
0
 public ActionResult Edit([Bind(Include = "Id,Adi,AcilisTarihi,KapanisTarihi,Enlem,Boylam,Adres,TelefonNo,MailAdresi,WebSitesi")] Eczane eczane)
 {
     if (ModelState.IsValid)
     {
         _eczaneService.Update(eczane);
         return(RedirectToAction("Index"));
     }
     return(View(eczane));
 }
        public NobetUstGrup GetByEczaneNobetGrupId(int eczaneNobetGrupId)
        {
            EczaneNobetGrup ecaneNobetGrup = _eczaneNobetGrupService.GetById(eczaneNobetGrupId);
            int             eczaneId       = ecaneNobetGrup.EczaneId;
            Eczane          eczane         = GetById(eczaneId);
            NobetUstGrup    nobetUstGrup   = _nobetUstGrupService.GetById(eczane.NobetUstGrupId);

            return(nobetUstGrup);
        }
Exemple #7
0
        public ActionResult Edit([Bind(Include = "Id,Adi,AcilisTarihi,KapanisTarihi,Enlem,Boylam,Adres,TelefonNo,MailAdresi,WebSitesi, NobetUstGrupId")] Eczane eczane)
        {
            if (ModelState.IsValid)
            {
                _eczaneService.Update(eczane);
                return(RedirectToAction("Index"));
            }
            var ustGrupSession  = _nobetUstGrupSessionService.GetSession("nobetUstGrup");
            var nobetUstGruplar = _nobetUstGrupService.GetDetaylar(ustGrupSession.Id);

            ViewBag.NobetUstGrupId = new SelectList(nobetUstGruplar.Select(s => new { s.Id, s.Adi }), "Id", "Adi");
            return(View(eczane));
        }
        public ActionResult Delete(int id)
        {
            if (id < 1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Eczane eczane = _eczaneService.GetById(id);

            if (eczane == null)
            {
                return(HttpNotFound());
            }
            return(View(eczane));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Eczane eczane = _eczaneService.GetById(id);

            try
            {
                _eczaneService.Delete(id);
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                TempData["Message"] = "ERROR:" + ex.Message.ToString();
            }

            return(View(eczane));
        }
        public ActionResult Create([Bind(Include = "Id,Adi,Telefon,Adres,Telefon2,EczaneGln,FaturaAdSoyad,VergiNumarasi,VergiDairesi,SehirId")] Eczane eczane)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _eczaneService.Insert(eczane);
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    TempData["Message"] = "ERROR:" + ex.Message.ToString();
                }
            }

            return(View(eczane));
        }
        private void KapananEczanelerinNobetGruplariniKapat(Eczane eczane, EczaneNobetGrup gruplardakiEczane)
        {
            var altGruplardakiEczaneler = _eczaneNobetGrupAltGrup.GetListAltGruptaAcikEczanelerByEczaneNobetGrupId(gruplardakiEczane.Id);

            KapananEczaneninAltGruplariniKapat(eczane, altGruplardakiEczaneler);

            var eczaneNobetGrup = new EczaneNobetGrup
            {
                Id                  = gruplardakiEczane.Id,
                EczaneId            = gruplardakiEczane.EczaneId,
                NobetGrupGorevTipId = gruplardakiEczane.NobetGrupGorevTipId,
                Aciklama            = gruplardakiEczane.Aciklama + " (Eczane Kapandı.)",
                BaslangicTarihi     = gruplardakiEczane.BaslangicTarihi,
                BitisTarihi         = eczane.KapanisTarihi
            };

            _eczaneNobetGrupService.Update(eczaneNobetGrup);
        }
        public ActionResult Edit(int id)
        {
            if (id < 1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Eczane eczane = _eczaneService.GetById(id);

            if (eczane == null)
            {
                return(HttpNotFound());
            }
            var ustGrupSession  = _nobetUstGrupSessionService.GetSession("nobetUstGrup");
            var nobetUstGruplar = _nobetUstGrupService.GetDetaylar(ustGrupSession.Id);

            ViewBag.NobetUstGrupId = new SelectList(nobetUstGruplar.Select(s => new { s.Id, s.Adi }), "Id", "Adi");
            return(View(eczane));
        }
        private void KapananEczaneninAltGruplariniKapat(Eczane eczane, List <EczaneNobetGrupAltGrup> altGruplardakiEczaneler)
        {
            foreach (var altGruplardakiEczane in altGruplardakiEczaneler)
            {
                var eczaneNobetAltGrup = new EczaneNobetGrupAltGrup
                {
                    Aciklama          = altGruplardakiEczane.Aciklama + " (Eczane Kapandı.)",
                    BitisTarihi       = eczane.KapanisTarihi,
                    Id                = altGruplardakiEczane.Id,
                    BaslangicTarihi   = altGruplardakiEczane.BaslangicTarihi,
                    EczaneNobetGrupId = altGruplardakiEczane.EczaneNobetGrupId,
                    NobetAltGrupId    = altGruplardakiEczane.NobetAltGrupId
                };

                //altGruplardakiEczane.BitisTarihi = eczane.KapanisTarihi;
                //altGruplardakiEczane.Aciklama += " Eczane Kapandı";

                _eczaneNobetGrupAltGrup.Update(eczaneNobetAltGrup);
            }
        }
        public ActionResult Edit([Bind(Include = "Id,Adi,AcilisTarihi,KapanisTarihi,Enlem,Boylam,Adres,TelefonNo,MailAdresi,WebSitesi, NobetUstGrupId")] Eczane eczane)
        {
            if (ModelState.IsValid)
            {
                if (eczane.KapanisTarihi != null)
                {
                    var gruplardakiEczaneler = _eczaneNobetGrupService.GetGruptaAktifOlanEczanelerByEczaneId(eczane.Id);

                    foreach (var gruplardakiEczane in gruplardakiEczaneler)
                    {
                        KapananEczanelerinNobetGruplariniKapat(eczane, gruplardakiEczane);
                    }
                }

                _eczaneService.Update(eczane);

                return(RedirectToAction("Index"));
            }
            var ustGrupSession  = _nobetUstGrupSessionService.GetSession("nobetUstGrup");
            var nobetUstGruplar = _nobetUstGrupService.GetDetaylar(ustGrupSession.Id);

            ViewBag.NobetUstGrupId = new SelectList(nobetUstGruplar.Select(s => new { s.Id, s.Adi }), "Id", "Adi");
            return(View(eczane));
        }
        public ActionResult Edit([Bind(Include = "Id,Adi,Telefon,Adres,Email,Telefon2,EczaneGln,FaturaAdSoyad,VergiNumarasi,VergiDairesi,SehirId")] Eczane eczane)
        {
            var sehirler = _sehirService.GetList();

            if (ModelState.IsValid)
            {
                try
                {
                    _eczaneService.Update(eczane);
                    TempData["MessageSuccess"] = "Bilgiler başarıyla düzenlenmiştir";
                    ViewBag.SehirId            = new SelectList(sehirler, "Id", "Adi", eczane.SehirId);
                    return(View(eczane));

                    // return RedirectToAction("Index");
                }
                catch (Exception ex)
                {
                    TempData["Message"] = "ERROR:" + ex.Message.ToString();
                }
            }
            ViewBag.SehirId = new SelectList(sehirler, "Id", "Adi", eczane.SehirId);

            return(View(eczane));
        }
        public ActionResult Edit(int?id)
        {
            var user     = _userService.GetByUserName(User.Identity.Name);
            var eczaneId = _eczaneUserService.GetListByUserId(user.Id).Select(s => s.Id).FirstOrDefault();
            int Id       = 0;

            if (id == null)
            {
                try
                {
                    Id = Convert.ToInt32(eczaneId);
                }
                catch (Exception ex)
                {
                    return(RedirectToAction("Index", "Eczane"));
                }
            }

            //Id = Convert.ToInt32(id);

            if (id < 1)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Eczane eczane = _eczaneService.GetById(Id);

            var sehirler = _sehirService.GetList();

            ViewBag.SehirId = new SelectList(sehirler, "Id", "Adi", eczane.SehirId);

            if (eczane == null)
            {
                return(HttpNotFound());
            }
            return(View(eczane));
        }
        public IActionResult Kaydet(Eczane item)
        {
            try
            {
                using (var dbConnection = DatabaseBaglanti.Connection())
                {
                    dbConnection.Open();
                    if (item.Id == 0)
                    {
                        dbConnection.Execute("insert into public.eczane (adi, adres,telefon) values(@adi, @adres,@telefon)", item);
                    }
                    else
                    {
                        dbConnection.Execute("update public.eczane set adi = @adi, adres = @adres, telefon=@telefon where Id = @Id", item);
                    }
                }

                return(Json(new { basarili = true }));
            }
            catch (System.Exception ex)
            {
                return(Json(new { basarisiz = true }));
            }
        }
        public ActionResult Create()
        {
            Eczane eczane = new Eczane();

            return(View(eczane));
        }
Exemple #19
0
 public void Update(Eczane eczane)
 {
     eczane.Adi = eczane.Adi.Trim().ToUpper(new CultureInfo("tr-TR"));
     _eczaneDal.Update(eczane);
 }
Exemple #20
0
 public void Insert(Eczane eczane)
 {
     _eczaneDal.Insert(eczane);
 }
Exemple #21
0
 public void Insert(Eczane eczane)
 {
     eczane.Adi = eczane.Adi.Trim().ToUpper(new CultureInfo("tr-TR"));
     _eczaneDal.Insert(eczane);
 }
Exemple #22
0
 public void Update(Eczane eczane)
 {
     _eczaneDal.Update(eczane);
 }