Esempio n. 1
0
        // GET: RoomModels/Edit/5
        public ActionResult Edit(int?id)
        {
            string ipAddress = System.Web.HttpContext.Current.Request.UserHostAddress;

            if (Iplist.Contains(ipAddress))
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                RoomModels roomModels = db.RoomModels.Find(id);

                if (roomModels == null)
                {
                    return(HttpNotFound());
                }
                if (!roomModels.Status)
                {
                    roomModels.Peopel    = "";
                    roomModels.Person    = "";
                    roomModels.Coustomer = "";
                    roomModels.Tips      = "";
                    roomModels.StartTime = DateTime.Now;
                    roomModels.EndTime   = DateTime.Now;
                }
                roomModels.Status = true;
                return(View(roomModels));
            }
            else
            {
                return(View("SkipRoom"));
            }
        }
        public async Task <ActionResult> Edit([Bind(Include = "RoomID,RoomName,RoomCode,RoomUrl")] RoomModels roomModels)
        {
            RoomModels roomModel = await db.RoomModels.FindAsync(roomModels.RoomID);

            if (User.IsInRole("User") && User.Identity.Name != roomModel.RoomOwner)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }

            if (ModelState.IsValid)
            {
                roomModel.RoomCode = roomModels.RoomCode;
                roomModel.RoomName = roomModels.RoomName;
                roomModel.RoomUrl  = roomModels.RoomUrl;

                db.Entry(roomModel).State = EntityState.Modified;
                await db.SaveChangesAsync();

                if (User.IsInRole("Admin"))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Account", "User"));
                }
            }
            return(View(roomModels));
        }
Esempio n. 3
0
        // GET: RoomModels/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RoomModels roomModels = db.RoomModels.Find(id);

            if (roomModels == null)
            {
                return(HttpNotFound());
            }
            List <SelectListItem> page = new List <SelectListItem>();

            //foreach (var it  in db.Companies)
            {
                page.Add(new SelectListItem {
                    Text = "内部", Value = "内部", Selected = true
                });
                page.Add(new SelectListItem {
                    Text = "坂田", Value = "坂田"
                });
                page.Add(new SelectListItem {
                    Text = "惠南", Value = "惠南"
                });
            }
            ViewBag.page = page;

            return(View(roomModels));
        }
Esempio n. 4
0
        public ActionResult DeleteConfirmed(string id)
        {
            RoomModels roommodels = db.Rooms.Find(id);

            db.Rooms.Remove(roommodels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 5
0
 public ActionResult Edit([Bind(Include = "ID,Name,Peopel,Coustomer,StartTime,EndTime,Tips,Status,Page,Person")] RoomModels roomModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(roomModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(roomModels));
 }
Esempio n. 6
0
 public ActionResult Edit([Bind(Include = "RoomName,Password,MaxUsers")] RoomModels roommodels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(roommodels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(roommodels));
 }
        public IHttpActionResult GetRoles(int id)
        {
            RoomModels role = context.Rooms.Find(id);

            if (role != null)
            {
                return(Ok(role));
            }
            return(NotFound());
        }
Esempio n. 8
0
 public ActionResult DisplayRoom(RoomModels room)
 {
     if (room.Status == false)
     {
         return(PartialView("Roomhide", room));
     }
     else
     {
         return(PartialView("Roomshow", room));
     }
 }
Esempio n. 9
0
        public ActionResult Create([Bind(Include = "ID,Name,Peopel,Coustomer,StartTime,EndTime,Tips,Status,Page,Person")] RoomModels roomModels)
        {
            if (ModelState.IsValid)
            {
                db.RoomModels.Add(roomModels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(roomModels));
        }
        public async Task <ActionResult> Lookup(string roomCode)
        {
            RoomModels roomModels = await db.RoomModels.
                                    FirstOrDefaultAsync(r => r.RoomCode == roomCode);

            if (roomModels == null)
            {
                return(HttpNotFound());
            }

            return(View(roomModels));
        }
Esempio n. 11
0
        public ActionResult DeleteConfirmed(int id)
        {
            RoomModels roomModels = db.RoomModels.Find(id);

            if (WriteHis(roomModels))
            {
                roomModels.Peopel = "";
                roomModels.Status = false;
                Edit(roomModels);
            }
            return(RedirectToAction("Index"));
        }
Esempio n. 12
0
        public ActionResult Edit2([Bind(Include = "ID,Name,Peopel,Coustomer,StartTime,EndTime,Tips,Status,Page,Person")] RoomModels roomModels)
        {
            int id = roomModels.ID;

            if (ModelState.IsValid)
            {
                RoomModels room = db.RoomModels.Find(id);
                db.RoomModels.Remove(room);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(roomModels));
        }
 public IHttpActionResult Post(RoomModels role)
 {
     if (!string.IsNullOrWhiteSpace(role.Name))
     {
         context.Rooms.Add(role);
         var result = context.SaveChanges();
         if (result > 0)
         {
             return(Ok(role));
         }
     }
     return(BadRequest());
 }
Esempio n. 14
0
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RoomModels roommodels = db.Rooms.Find(id);

            if (roommodels == null)
            {
                return(HttpNotFound());
            }
            return(View(roommodels));
        }
        // GET: Room/Details/5
        // Action allows controls of the Video Feed
        public async Task <ActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            RoomModels roomModels = await db.RoomModels.FindAsync(id);

            // User can only navigate to Details room page if they are the owner
            if (User.IsInRole("User") && User.Identity.Name != roomModels.RoomOwner)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            return(View(roomModels));
        }
Esempio n. 16
0
        public ActionResult Create([Bind(Include = "RoomName,Password,MaxUsers")] RoomModels roommodels)
        {
            var name = User.Identity.Name;

            if (ModelState.IsValid)
            {
                var user = db.Users.SingleOrDefault(u => u.UserName == name);
                user.UsingRoom = roommodels.RoomName;
                db.Rooms.Add(roommodels);
                //      roommodels.RoomUsers.Add(user);
                db.SaveChanges();
                return(RedirectToAction("WaitingRoom"));
            }

            return(View(roommodels));
        }
Esempio n. 17
0
    //***************************************************************************************************

    public Room_Geometry(
        List <RoomLevel> roomData,
        RoomModels models,
        int tileDimension,
        Vector3 roomDimension,
        bool startRoom,
        GameObject entrancePoint,
        GameObject startHallway
        )
    {
        RoomData       = roomData;
        TileDimension  = tileDimension;
        StartRoom      = startRoom;
        RoomDimensions = roomDimension;
        Models         = models;
        EntrancePoint  = entrancePoint;
        StartHallway   = startHallway;
    }
Esempio n. 18
0
        public bool WriteHis([Bind(Include = "Id,RoomId,RoomName,Peopel,Coustomer,StartTime,EndTime,Tips")] RoomModels rm)
        {
            HistoryModels room = new HistoryModels();

            room.RoomId    = rm.ID;
            room.RoomName  = rm.Name;
            room.Peopel    = rm.Peopel;
            room.Coustomer = rm.Coustomer;
            room.StartTime = rm.StartTime;
            room.EndTime   = rm.EndTime;
            room.Tips      = rm.Tips;
            if (ModelState.IsValid)
            {
                db.HistoryModels.Add(room);
                db.SaveChanges();
                return(true);
            }
            return(false);
        }
Esempio n. 19
0
        public string Get(string name, string page)
        {
            var room = db.RoomModels as IQueryable <RoomModels>;

            if (!String.IsNullOrEmpty(name))
            {
                room = room.Where(m => m.Name.Contains(name));
            }
            if (!String.IsNullOrEmpty(page))
            {
                room = room.Where(m => m.Page.Equals(page));
            }

            RoomModels Room = room.Where(m => m.Name.Equals(name)).First();

            string jsonData = JsonConvert.SerializeObject(Room);

            return(jsonData);
        }
        public IHttpActionResult Put(int id, RoomModels role)
        {
            var put = context.Rooms.Find(id);

            if (put != null)
            {
                if (!string.IsNullOrWhiteSpace(role.Name))
                {
                    put.Name = role.Name;
                    context.Entry(put).State = EntityState.Modified;
                    var result = context.SaveChanges();
                    if (result > 0)
                    {
                        return(Ok(put));
                    }
                }
                return(BadRequest());
            }
            return(NotFound());
        }
        // GET: Room/Edit/5
        public async Task <ActionResult> Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RoomModels roomModels = await db.RoomModels.FindAsync(id);

            if (roomModels == null)
            {
                return(HttpNotFound());
            }

            if (User.IsInRole("User") && User.Identity.Name != roomModels.RoomOwner)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            return(View(roomModels));
        }
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            RoomModels roomModels = await db.RoomModels.FindAsync(id);

            if (User.IsInRole("User") && User.Identity.Name != roomModels.RoomOwner)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.Unauthorized));
            }

            db.RoomModels.Remove(roomModels);
            await db.SaveChangesAsync();

            if (User.IsInRole("Admin"))
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(RedirectToAction("Account", "User"));
            }
        }
        public async Task <ActionResult> Create([Bind(Include = "RoomID,RoomName,RoomCode,RoomUrl")] RoomModels roomModels)
        {
            // Room owner must be current logged in user
            roomModels.RoomOwner = User.Identity.Name;

            if (ModelState.IsValid)
            {
                db.RoomModels.Add(roomModels);
                await db.SaveChangesAsync();

                if (User.IsInRole("Admin"))
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Account", "User"));
                }
            }

            return(View(roomModels));
        }
Esempio n. 24
0
        // GET: RoomModels/Delete/5
        public ActionResult Delete(int?id)
        {
            string ipAddress = System.Web.HttpContext.Current.Request.UserHostAddress;

            if (Iplist.Contains(ipAddress))
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                RoomModels roomModels = db.RoomModels.Find(id);
                if (roomModels == null)
                {
                    return(HttpNotFound());
                }
                return(View(roomModels));
            }
            else
            {
                return(View("SkipRoom"));
            }
        }
Esempio n. 25
0
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += UnhandledException;
            IOStreamer = new IOStreamer("Project habSock3t");

            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine();
            Console.WriteLine(@"        ___           _           _   ");
            Console.WriteLine(@"       / _ \_ __ ___ (_) ___  ___| |_ ");
            Console.WriteLine(@"      / /_)/ '__/ _ \| |/ _ \/ __| __|" + "     Project habSock3t v" + Assembly.GetExecutingAssembly().GetName().Version.Major + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor);
            Console.WriteLine(@"     / ___/| | | (_) | |  __/ (__| |_ " + "     www.mediafire.com/?6k55egn38ry2y");
            Console.WriteLine(@"     \/    |_|  \___// |\___|\___|\__|");
            Console.WriteLine(@"                   |__/               ");
            Console.WriteLine(@"      _           _     __            _    _____ _   ");
            Console.WriteLine(@"     | |__   __ _| |__ / _\ ___   ___| | _|___ /| |_ ");
            Console.WriteLine(@"     | '_ \ / _` | '_ \\ \ / _ \ / __| |/ / |_ \| __|");
            Console.WriteLine(@"     | | | | (_| | |_) |\ \ (_) | (__|   < ___) | |_ ");
            Console.WriteLine(@"     |_| |_|\__,_|_.__/\__/\___/ \___|_|\_\____/ \__|");
            Console.WriteLine();
            Console.WriteLine("  http://forum.ragezone.com/f331/open-source-c-mysql-project-830191/");
            Console.WriteLine();
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("  Project habSock3t");
            Console.WriteLine("  Copyright (C) AlexDj94 2012");
            Console.WriteLine("  [email protected]");
            Console.WriteLine();
            Console.WriteLine("  This program comes with ABSOLUTELY NO WARRANTY.");
            Console.WriteLine("  This is free software, and you are welcome to");
            Console.WriteLine("  redistribute it under certain conditions.");
            Console.WriteLine("  Read LICENSE file for more information.");
            Console.WriteLine();
            Console.Write("  ");

            IOStreamer.AppendLog("Client: " + ClientVersion);
            IOStreamer.AppendLog("Starting up Project habSock3t for " + Environment.UserName + "...");
            Configuration = new Configuration();
            MySqlManager  = new MySqlManager();

            IOStreamer.AppendLog("Cleaning database...");
            MySqlManager.InvokeQuery(new ClearIPQuery());
            IOStreamer.AppendLog("IP reset.");
            MySqlManager.InvokeQuery(new ClearOnlineQuery());
            IOStreamer.AppendLog("Online status reset.");
            MySqlManager.InvokeQuery(new ClearVisitorsQuery());
            IOStreamer.AppendLog("Visitors reset.");
            MySqlManager.InvokeQuery(new ClearEventsQuery());
            IOStreamer.AppendLog("Events reset.");
            MySqlManager.InvokeQuery(new ClearLastRoomQuery());
            IOStreamer.AppendLog("Lastrooms reset.");

            PacketsManager = new PacketsManager();
            UsersManager   = new UsersManager();
            RoomsManager   = new RoomsManager();
            RoomModels     = new RoomModels();
            IOStreamer.AppendLog("Loaded " + RoomModels.AllRoomModels.Count + " room models.");

            GameSocket = new GameSocket(new IPEndPoint(IPAddress.Parse(System.Configuration.Read("gameserver.host")),
                                                       int.Parse(System.Configuration.Read("gameserver.port"))));
            GameSocket.Load();

            IOStreamer.AppendLog("Players can now login!");
            sMonitor.Priority = ThreadPriority.Lowest;
            sMonitor.Start();
            Console.Beep();
        }