Beispiel #1
0
        private PlayerGroup CreateExamplePlayerGroup(int accountid, string playergroupname)
        {
            try
            {
                IPlayerGroupRepository playergrouprep = new EntityPlayerGroupRepository();

                PlayerGroup playergroup = new PlayerGroup();
                playergroup.AccountID              = accountid;
                playergroup.PlayerGroupName        = playergroupname;
                playergroup.PlayerGroupDescription = String.Empty;
                playergroup.IsActive = true;
                playergrouprep.CreatePlayerGroup(playergroup);

                return(playergroup);
            }
            catch { return(null); }
        }
        public ActionResult Edit(PlayerGroupSchedule playergroupschedule)
        {
            try
            {
                if (Session["UserAccountID"] == null)
                    return RedirectToAction("Validate", "Login");
                User user = (User)Session["User"];
                ViewData["LoginInfo"] = Utility.BuildUserAccountString(user.Username, Convert.ToString(Session["UserAccountName"]));
                if (user.IsAdmin)
                    ViewData["txtIsAdmin"] = "true";
                else
                    ViewData["txtIsAdmin"] = "false";

                int playergroupid = Convert.ToInt32(Request.Form["txtPlayerGroupID"]);
                int screenid = Convert.ToInt32(Request.Form["lstScreen"]);
                int hour = Convert.ToInt32(Request.Form["lstHour"]);
                int minute = Convert.ToInt32(Request.Form["lstMinute"]);

                if (!String.IsNullOrEmpty(Request.Form["chkSunday"]))
                    CreatePlayerGroupSchedule(playergroupid, screenid, 0, hour, minute);
                if (!String.IsNullOrEmpty(Request.Form["chkMonday"]))
                    CreatePlayerGroupSchedule(playergroupid, screenid, 1, hour, minute);
                if (!String.IsNullOrEmpty(Request.Form["chkTuesday"]))
                    CreatePlayerGroupSchedule(playergroupid, screenid, 2, hour, minute);
                if (!String.IsNullOrEmpty(Request.Form["chkWednesday"]))
                    CreatePlayerGroupSchedule(playergroupid, screenid, 3, hour, minute);
                if (!String.IsNullOrEmpty(Request.Form["chkThursday"]))
                    CreatePlayerGroupSchedule(playergroupid, screenid, 4, hour, minute);
                if (!String.IsNullOrEmpty(Request.Form["chkFriday"]))
                    CreatePlayerGroupSchedule(playergroupid, screenid, 5, hour, minute);
                if (!String.IsNullOrEmpty(Request.Form["chkSaturday"]))
                    CreatePlayerGroupSchedule(playergroupid, screenid, 6, hour, minute);

                IPlayerGroupRepository pgrep = new EntityPlayerGroupRepository();
                PlayerGroup playergroup = pgrep.GetPlayerGroup(playergroupid);
                ViewData["PlayerGroupID"] = playergroupid;
                ViewData["PlayerGroupName"] = playergroup.PlayerGroupName;

                ViewData["ScreenList"] = new SelectList(BuildScreenList(), "Value", "Text", "");
                ViewData["HourList"] = new SelectList(BuildHourList(), "Value", "Text", "");
                ViewData["MinuteList"] = new SelectList(BuildMinuteList(), "Value", "Text", "");

                ViewData["ScheduleHTML"] = BuildScheduleTable(playergroupid);

                return View(playergroupschedule);
            }
            catch (Exception ex)
            {
                Helpers.SetupApplicationError("PlayerGroupSchedule", "Edit", ex.Message);
                return RedirectToAction("Index", "ApplicationError");
            }
        }
        private PlayerGroup CreateExamplePlayerGroup(int accountid, string playergroupname)
        {
            try
            {
                IPlayerGroupRepository playergrouprep = new EntityPlayerGroupRepository();

                PlayerGroup playergroup = new PlayerGroup();
                playergroup.AccountID = accountid;
                playergroup.PlayerGroupName = playergroupname;
                playergroup.PlayerGroupDescription = String.Empty;
                playergroup.IsActive = true;
                playergrouprep.CreatePlayerGroup(playergroup);

                return playergroup;
            }
            catch { return null; }
        }