예제 #1
0
        public ActionResult UpdateStatus(UpdateStatusModel model)
        {
            List<string> Error = new List<string>();
            EventAttendee attn = eventInterface.GetEventAttendee(CurrentEvent.EventID, MemberInfo.MemberID);
            int roleID = (!String.IsNullOrEmpty(Request["Role"])) ? Convert.ToInt32(Request["Role"]) : 0;
            if (roleID == 0)
            {
                Error.Add("Role Not Specified");
            }

            int charID = (!String.IsNullOrEmpty(Request["SelectedCharacter"])) ? Convert.ToInt32(Request["SelectedCharacter"]) : 0;
            if (charID == 0)
            {
                Error.Add("Character not Specified");
            }

            // Ensure the character exists on the same server as the evemt
            if (charInterface.GetCharacterByID(charID).ServerID != CurrentEvent.ServerID)
            {
                Error.Add("Character doesnt exist on same server as event");
            }

            //Enfore Role Restrictions
            bool roleHasChanged = (attn.RoleID != roleID);
            if (roleID != 0 && roleHasChanged && eventInterface.IsRoleRestricted(CurrentEvent.EventID, roleID))
            {
                Error.Add("The role you selected is full");
            }

            if (Error.Count == 0)
            {
                MemCharacter memChar = charInterface.GetCharacterByID(charID);
                if (charInterface.ValidateUserRoles(memChar.ClassID, new int[] { roleID }))
                {
                    CommitResponse response = eventInterface.UpdateAttendeeStatus(CurrentEvent.EventID, MemberInfo.MemberID, model.AttendeeStatus, charID, model.Note, roleID);
                    if (response.success)
                    {
                        return RedirectToAction("Confirmation", "Shared");
                    }
                }
            }
            else
            {
                int eCount = 0;
                foreach (string e in Error)
                {
                    this.ModelState.AddModelError("Error" + eCount, e);
                }
            }

            model.UserCharacters = charInterface.GetAllMemberCharactersByGame(MemberInfo.MemberID, CurrentEvent.GameID).ToList();
            model.RestrictedRoles = eventInterface.GetRestrictedRolesThatAreFull(CurrentEvent.EventID).ToList();
            return View(model);
        }
예제 #2
0
        public ViewResult UpdateStatus(int gameID)
        {
            UpdateStatusModel model = new UpdateStatusModel();
            var attn = eventInterface.GetEventAttendee(CurrentEvent.EventID, MemberInfo.MemberID);
            model.Note = attn.Note;
            model.AttendeeStatus = attn.Status;
            model.SelectedRole = attn.RoleID.Value;
            model.SelectedCharacter = attn.CharacterID;
            model.UserCharacters = (from memChar in charInterface.GetAllMemberCharactersByGame(MemberInfo.MemberID, gameID)
                                    where memChar.ServerID == (int)CurrentEvent.ServerID // Filter by characters which exists on the same server as the event
                                    select memChar).ToList();
            model.RestrictedRoles = eventInterface.GetRestrictedRolesThatAreFull(CurrentEvent.EventID).ToList();

            return View(model);
        }