コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            LOCALES lOCALES = db.LOCALES.Find(id);

            db.LOCALES.Remove(lOCALES);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public void changeCurrentLocale(LOCALES locales)
 {
     if (_currentLocale != locales || _dictionary == null || _dictionary.Count == 0)
     {
         PlayerPrefs.SetString(PP_KEY, locales.ToString());
         _currentLocale = locales;
         loadDictionary();
     }
 }
コード例 #3
0
 public ActionResult Edit_Local([Bind(Include = "Id,Nombre,Direccion,Correo,Telefono,Hora_apertura,Hora_cierre,Lunes,Martes,Miercoles,Jueves,Viernes,Sabado,Domingo,Carta")] LOCALES lOCALES)
 {
     lOCALES.Correo = User.Identity.GetUserName();
     if (ModelState.IsValid)
     {
         db.Entry(lOCALES).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index", "Home"));
     }
     return(View(lOCALES));
 }
コード例 #4
0
        // GET: Locales/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LOCALES lOCALES = db.LOCALES.Find(id);

            if (lOCALES == null)
            {
                return(HttpNotFound());
            }
            return(View(lOCALES));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "Id,Nombre,Direccion,Correo,Telefono,Hora_apertura,Hora_cierre,Lunes,Martes,Miercoles,Jueves,Viernes,Sabado,Domingo,Carta")] LOCALES lOCALES)
        {
            lOCALES.Correo = User.Identity.GetUserName();

            if (ModelState.IsValid)
            {
                db.LOCALES.Add(lOCALES);
                db.SaveChanges();
                var path = Server.MapPath("~/Content/Images/" + lOCALES.Id);
                Directory.CreateDirectory(path);
                return(RedirectToAction("Index", "Home"));
            }

            return(View(lOCALES));
        }
コード例 #6
0
        //GET: Locales/Detalles/1
        public ActionResult Detalles(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LOCALES lOCALES = db.LOCALES.Find(id);

            if (lOCALES == null)
            {
                return(HttpNotFound());
            }
            var correoUsuario = User.Identity.GetUserName();

            ViewBag.exists = db.RESERVAS.Any(a => a.USUARIOS.Correo == correoUsuario && a.MESAS.Id_Local == id && a.Dia < DateTime.Now);
            return(View(lOCALES));
        }
コード例 #7
0
        public ActionResult Edit([Bind(Include = "Id,Nombre,Direccion,Correo,Telefono,Hora_apertura,Hora_cierre,Lunes,Martes,Miercoles,Jueves,Viernes,Sabado,Domingo,Carta")] LOCALES lOCALES)
        {
            if (ModelState.IsValid)
            {
                db.Entry(lOCALES).State = EntityState.Modified;
                db.SaveChanges();

                if (User.IsInRole("Local"))
                {
                    return(RedirectToAction("Index"));
                }
                else if (User.IsInRole("Administrador"))
                {
                    return(RedirectToAction("Admin"));
                }
            }
            return(View(lOCALES));
        }
コード例 #8
0
    private Locale(SystemLanguage systemLanguage)
    {
        string current = PlayerPrefs.GetString(PP_KEY, null);

        if (current == null || !Enum.TryParse <LOCALES>(current, out _currentLocale))
        {
            switch (systemLanguage)
            {
            case SystemLanguage.English:
                _currentLocale = LOCALES.EN;
                break;

            case SystemLanguage.Spanish:
                _currentLocale = LOCALES.ES;
                break;

            default:
                _currentLocale = LOCALES.EN;
                break;
            }
        }
        loadDictionary();
    }
コード例 #9
0
        // GET: Reservas/Create
        public ActionResult Create(int?id, string hora, string dia)
        {
            var correoUsuario = User.Identity.GetUserName();

            ViewBag.idlocal        = id;
            ViewBag.idlocal        = id;
            ViewBag.Id_Mesa        = new SelectList(db.MESAS.Where(c => c.Id_Local == id), "Id", "Descripcion");
            ViewBag.nummesas       = new SelectList(db.MESAS.Where(c => c.Id_Local == id), "Id", "Descripcion").Count();
            ViewBag.Capacidad_Mesa = new SelectList(db.MESAS.Where(c => c.Id_Local == id), "Id", "Capacidad");
            ViewBag.Id_Usuario     = new SelectList(db.USUARIOS.Where(a => a.Correo == correoUsuario), "Id", "Id");

            LOCALES local = db.LOCALES.Find(id);

            ViewBag.hora_cierre  = local.Hora_cierre.ToString("hh\\:mm");
            ViewBag.hora_apert   = local.Hora_apertura.ToString("hh\\:mm");
            ViewBag.nombre_local = local.Nombre;

            ViewBag.mesilla = new SelectList(db.MESAS.Where(c => c.Id_Local == id), "Id", "Descripcion");

            if (!string.IsNullOrEmpty(hora) && !string.IsNullOrEmpty(dia))
            {
                ViewBag.returned = 1;
                DateTime dia_reserv      = Convert.ToDateTime(dia);
                TimeSpan hora_reserv     = TimeSpan.Parse(hora);
                TimeSpan hora_diferencia = TimeSpan.FromHours(1);
                TimeSpan hora_extra      = hora_reserv.Add(hora_diferencia);

                ViewBag.Dia     = dia_reserv;
                ViewBag.Hora    = hora;
                ViewBag.Id_Mesa = (from m in db.MESAS
                                   join l in db.LOCALES on m.Id_Local equals l.Id
                                   where l.Id == id && !(
                                       from r in db.RESERVAS
                                       join me in db.MESAS on r.Id_Mesa equals me.Id
                                       where (r.Dia == dia_reserv && r.Hora == hora_reserv)
                                       select r.Id_Mesa).Contains(m.Id)
                                   select new SelectListItem
                {
                    Value = m.Id.ToString(),
                    Text = m.Descripcion
                }
                                   ).Distinct();

                ViewBag.nummesas = (from m in db.MESAS
                                    join l in db.LOCALES on m.Id_Local equals l.Id
                                    where l.Id == id && !(
                                        from r in db.RESERVAS
                                        join me in db.MESAS on r.Id_Mesa equals me.Id
                                        where (r.Dia == dia_reserv && r.Hora == hora_reserv)
                                        select r.Id_Mesa).Contains(m.Id)
                                    select new SelectListItem
                {
                    Value = m.Id.ToString(),
                    Text = m.Descripcion
                }
                                    ).Count();
            }


            return(View());
        }