Ejemplo n.º 1
0
        public IActionResult EventToDB(EventForm formData)
        {
            if (!HttpContext.Session.Keys.Contains("user"))
            {
                return(RedirectToAction("Logout", "User"));
            }
            if (!ModelState.IsValid)
            {
                return(View("WeddingForm"));
            }
            User host = dbContext.Users
                        .SingleOrDefault(u =>
                                         u.UserID == HttpContext.Session.GetInt32("user"));
            Event newEvent = new Event();

            newEvent.Name1     = formData.Name1;
            newEvent.Name2     = formData.Name2;
            newEvent.Date      = formData.Date;
            newEvent.Address   = formData.Address;
            newEvent.CreatedAt = DateTime.Now;
            newEvent.UpdatedAt = DateTime.Now;
            newEvent.UserID    = host.UserID;
            dbContext.Events.Add(newEvent);
            dbContext.SaveChanges();
            return(RedirectToAction("Dashboard"));
        }
Ejemplo n.º 2
0
        private void dogadjajToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form newform = new EventForm();

            this.Hide();
            newform.Show();
        }
Ejemplo n.º 3
0
    private IEnumerator SendEventBundle(List <EventLog> _eventBundle)
    {
        int counter = 0;

        foreach (EventLog e in _eventBundle)
        {
            EventForm eventForm = new EventForm();

            eventForm.AddField("PlayerID", playerID);
            eventForm.AddField("OrganizationID", OrganizationID);
            eventForm.AddField("GameID", GameID);
            eventForm.AddField("DeviceID", DeviceID);

            eventForm.AddField("Time", e.Time);
            eventForm.AddField("Event", (int)e.Event);
            eventForm.AddField("CardID", e.CardID);
            int newChoice = e.Choice + 1;               // Iterate by one for readability on server
            eventForm.AddField("Choice", newChoice);


            string totalScores = JsonConvert.SerializeObject(PlayerManager.Instance.GetSubStatsList());
            eventForm.AddField("TotalScoreList", totalScores);

            string          postURL = "https://laeringsliv.azurewebsites.net/PlayerEvents/Create";
            UnityWebRequest www     = UnityWebRequest.Post(postURL, eventForm);

            yield return(www.SendWebRequest());

            counter++;
        }
        Debug.Log(counter + " logs successfully sent to server.");
        //Debug.Log($"Log sent: {string.Concat(www.GetResponseHeaders().Select(x => $"{x.Key} {x.Value} \n ")) }");
    }
Ejemplo n.º 4
0
        private void CancelEventButton_Click(object sender, EventArgs e)
        {
            Form newform = new EventForm();

            this.Hide();
            this.Close();
            newform.Show();
        }
Ejemplo n.º 5
0
 public ActionResult AddEvent(EventForm ef)
 {
     if (!ModelState.IsValid)
     {
         return(PartialView("_AddEvent", ef));
     }
     eventsRepo.Create(ef.ToEvent());
     return(RedirectToAction("List", new { leagueId = ef.LeagueId, clubId = ef.ClubId }));
 }
        public void CreateEvent_NullContent_EventNotCreated()
        {
            var eventContent = new EventForm(null);

            _eventService.CreateEvent(_userOne.Id, _trackerUserOne.Id, eventContent);

            var eventsCount = _mockEventRepository.GetAll().Count;

            Assert.AreEqual(0, eventsCount);
        }
Ejemplo n.º 7
0
        private void btnEventInfo_Click(object sender, EventArgs e)
        {
            Event     Event = cbSelectEvent.SelectedItem as Event;
            EventForm Form  = new EventForm();

            Form.GetData(Event);
            Form.ShowDialog();
            LoadEvents();
            DisableButtons();
        }
        public void CreateEvent_ValidData_EventCreated()
        {
            var eventContent = new EventForm("testTitle");

            _eventService.CreateEvent(_userOne.Id, _trackerUserOne.Id, eventContent);

            var @event = _mockEventRepository.GetAll().First();

            Assert.AreEqual(_trackerUserOne.Id, @event.TrackerId);
            Assert.AreEqual(eventContent.Title, @event.Title);
        }
Ejemplo n.º 9
0
        public ActionResult AddEvent(int?leagueId, int?clubId)
        {
            var ef = new EventForm
            {
                LeagueId   = leagueId,
                LeagueName = leagueId.HasValue ? leagueRepo.GetById(leagueId.Value).Name : null,
                ClubId     = clubId,
                ClubName   = clubId.HasValue ? leagueRepo.GetClubById(clubId.Value).Name : null
            };

            return(PartialView("_AddEvent", ef));
        }
        protected void EventSaveHandler(object sender, EventArgs e)
        {
            var formView = EventDialog.FindControl("EventForm") as FormView;

            if (formView.CurrentMode == FormViewMode.Edit)
            {
                EventForm.UpdateItem(false);
            }
            else if (formView.CurrentMode == FormViewMode.Insert)
            {
                EventForm.InsertItem(false);
            }
            EventDialog.Close();
        }
Ejemplo n.º 11
0
 public static Event ToEvent(this EventForm ef)
 {
     return(new Event {
         CreateDate = ef.CreateDate == default(DateTime) ?
                      DateTime.Now : ef.CreateDate,
         EventId = ef.EventId,
         EventTime = ef.EventTime,
         IsPublished = ef.IsPublished,
         LeagueId = ef.LeagueId,
         ClubId = ef.ClubId,
         Place = ef.Place,
         Title = ef.Title
     });
 }
Ejemplo n.º 12
0
        public abstract void Destroy();         // called by AssignSwitches to remove old one

        #endregion

        #region Global indexed list
        /// <summary>Must be called once before using other methods.  Further calls ignored</summary>
        static public void Initialise()
        {
            if (g_Switches != null)
            {
                return;
            }
            // faster(?) than using Shared Sub?.  Should be called on app startup
            g_Switches          = new List <PhysicalSwitch>();
            m_EventForm         = new EventForm();
            m_EventForm.Visible = true;
            KeySwitch.Initialise();
            JoySwitch.Initialise();
            // PointerSwitch doesn't require anything
        }
Ejemplo n.º 13
0
        public async Task <IActionResult> Create(EventForm form)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.GetUserAsync(User);

                var eventModel = new Event(user);
                _context.Events.Add(eventModel);
                var content = new EventContent(eventModel.Id, form.Title, form.EventDate, eventModel, form.Description, form.Address, form.Phone);
                _context.EventContents.Add(content);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(form));
        }
Ejemplo n.º 14
0
        public bool ShowEventUpdateForm(int eventId)
        {
            bool      result    = false;
            EventForm eventForm = new EventForm();

            eventForm.ShowEvent(eventId);
            DialogResult dialogResult = eventForm.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                result = true;
                this.RefreshEventList(eventForm.DossierID);
            }

            return(result);
        }
Ejemplo n.º 15
0
    // Old, not used atm
    private IEnumerator SendEvent(EventLog eventLog)
    {
        EventForm eventForm = new EventForm();

        eventForm.AddField("PlayerID", int.Parse(playerID));
        eventForm.AddField("Time", eventLog.Time);
        eventForm.AddField("Event", (int)eventLog.Event);
        eventForm.AddField("CardID", eventLog.CardID);
        eventForm.AddField("Choice", eventLog.Choice + 1); // Iterate by one for readability on server

        string          postURL = "https://laeringsliv.azurewebsites.net/PlayerEvents/Create";
        UnityWebRequest www     = UnityWebRequest.Post(postURL, eventForm);

        yield return(www.SendWebRequest());

        Debug.Log($"Log sent: {string.Concat(www.GetResponseHeaders().Select(x => $"{x.Key} {x.Value} \n ")) }");
    }
Ejemplo n.º 16
0
        public bool ShowEventAddForm(DateTime date)
        {
            bool      result    = false;
            EventForm eventForm = new EventForm();

            eventForm.DossierID = this.DossierId;
            eventForm.SetDeadlineDate(date);
            DialogResult dialogResult = eventForm.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                result = true;
                this.RefreshEventList(eventForm.DossierID);
            }

            return(result);
        }
Ejemplo n.º 17
0
        public EventForm CreateFormEvent(EventForm eventForm, string kindEvent)
        {
            eventForm.NumbersOfCurrentParticipants = 0;
            eventForm.KindEvent = kindEvent;

            switch (kindEvent)
            {
            case "football":
                _context.EventFormFootball.Add(eventForm);
                break;
                //case "concert":
                //	_context.EventFormConcert.Add(eventForm);
                //	break;
            }
            _context.SaveChanges();

            return(eventForm);
        }
Ejemplo n.º 18
0
        //private IList<EventForm> getListOfConcertEventsForUser(int userID)
        //{
        //	IList<EventForm> eventForms = new List<EventForm>();
        //	IList<UserConcertEvent> formsConcertEvents;

        //	var findUserAssignToConcert = _context.Users.Where(x => x.UserID == userID).Include(x => x.UserConcertEvent).ThenInclude(x => x.EventForm).ToList();
        //	if (findUserAssignToConcert.First().UserConcertEvent == null)
        //	{
        //		return null;
        //	}
        //	formsConcertEvents = findUserAssignToConcert.First().UserConcertEvent;

        //	foreach (var form in formsConcertEvents)
        //	{
        //		eventForms.Add(form.EventForm);
        //	}

        //	return eventForms;
        //}

        public EventForm GetFormById(int id, string kindEvent)
        {
            EventForm eventForm = null;

            switch (kindEvent)
            {
            case "football":
                eventForm = _context.EventFormFootball.Find(id);
                break;

            case "concert":
                //eventForm = _context.EventFormConcert.Find(id);
                break;

            default:
                throw new Exception("don't find datebase");
            }
            return(eventForm);
        }
Ejemplo n.º 19
0
        //private void AssingUserToConcertEvent(int idEvent, int idUser)
        //{
        //	//var formEvent = _context.EventFormConcert.Find(idEvent);
        //	var user = _context.Users.Find(idUser);


        //	VerifyIfUserIsAssignToConcertEvent(formEvent, user);

        //	if (formEvent.NumberPlacesEvent + 1 > formEvent.NumbersOfCurrentParticipants)
        //	{
        //		throw new AppException("User cannot join to event");
        //	}

        //	formEvent.NumbersOfCurrentParticipants += 1;

        //	//_context.UserConcertEvent.Add(new UserFootballEvent
        //	//{
        //	//	User = user,
        //	//	EventForm = formEvent
        //	//});
        //	_context.SaveChanges();
        //	formEvent.NumbersOfCurrentParticipants += 1;
        //	_context.EventFormConcert.Update(formEvent);
        //}

        private void VerifyIfUserIsAssignToFootballEvent(EventForm formEvent, User user)
        {
            IList <UserFootballEvent> forms;

            var findUser = _context.Users.Where(x => x.UserID == user.UserID).Include(x => x.UserFootballEvent).ThenInclude(x => x.EventForm).ToList();

            if (findUser.First().UserFootballEvent == null)
            {
                return;
            }
            forms = findUser.First().UserFootballEvent;

            foreach (var form in forms)
            {
                if (form.EventForm.EventID == formEvent.EventID)
                {
                    throw new AppException("User is assign to this event");
                }
            }
        }
Ejemplo n.º 20
0
        public void UpdateFormEvent(EventForm EventForm, string kindEvent)
        {
            EventForm form;

            switch (kindEvent)
            {
            case "football":
                form = _context.EventFormFootball.Find(EventForm.EventID);
                break;

            //case "concert":
            //	//form = _context.EventFormConcert.Find(EventForm.EventID);
            //	break;
            default:
                throw new Exception("don't find datebase");
            }

            if (form == null || EventForm == null)
            {
                throw new AppException("Form not found");
            }

            form.DateEvent         = EventForm.DateEvent;
            form.NameEvent         = EventForm.NameEvent;
            form.DescEvent         = EventForm.DescEvent;
            form.TimeEvent         = EventForm.TimeEvent;
            form.PlaceEvent        = EventForm.PlaceEvent;
            form.NumberPlacesEvent = EventForm.NumberPlacesEvent;

            switch (kindEvent)
            {
            case "football":
                _context.EventFormFootball.Update(form);
                break;

            case "concert":
                //_context.EventFormConcert.Update(form);
                break;
            }
            _context.SaveChanges();
        }
        public IActionResult UpdateEvent([FromRoute] Guid eventId, [FromBody] EventCreateRequest request)
        {
            var actorId     = Guid.Parse(User.FindFirstValue(JwtClaimTypes.Id));
            var optionEvent = _eventService.GetEvent(actorId, eventId);

            return(optionEvent.Match <IActionResult>(
                       Some: tracker =>
            {
                var form = new EventForm(request.Title);
                _eventService.EditEvent(actorId, eventId, form);
                return NoContent();
            },
                       None: NotFound(new
            {
                errors = new
                {
                    commonError = "Event doesn't exist."
                }
            }
                                      )));
        }
Ejemplo n.º 22
0
    // TODO: Currently not in use, event forms and Json don't play well with nested Lists
    private IEnumerator NewSendEventBundle(List <EventLog> _eventBundle)
    {
        int counter = 0;

        EventForm eventFormBundle = new EventForm();

        eventFormBundle.AddField("PlayerID", int.Parse(playerID));
        eventFormBundle.AddField("FormCounter", _eventBundle.Count);

        List <EventForm> eventFormList = new List <EventForm>();

        foreach (EventLog e in _eventBundle)
        {
            EventForm eventForm = new EventForm();
            eventForm.AddField("Time", e.Time);
            eventForm.AddField("Event", (int)e.Event);
            eventForm.AddField("CardID", e.CardID);
            eventForm.AddField("Choice", e.Choice);

            eventFormList.Add(eventForm);

            eventFormBundle.AddField("EventEntry" + counter, JsonUtility.ToJson(eventForm));

            counter++;
        }

        string postURL = "https://laeringsliv.azurewebsites.net/PlayerEvents/Create";

        EventForm stringBundle = new EventForm();

        stringBundle.AddField("EventString", JsonUtility.ToJson(eventFormBundle));


        UnityWebRequest www = UnityWebRequest.Post(postURL, stringBundle);

        yield return(www.SendWebRequest());

        Debug.Log(counter + " logs successfully sent to server.");
    }
Ejemplo n.º 23
0
        public async Task <IActionResult> AddEventAsync(
            [FromBody] EventForm eventForm,
            CancellationToken ct)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(ModelState)));
            }

            var eventId = await _eventService.CreateEventAsync(
                eventForm.meetId,
                eventForm.EventNum,
                eventForm.RoundNum,
                eventForm.FlightNum,
                eventForm.EventName,
                ct);

            return(Created(
                       Url.Link(nameof(EventsController.GetEventByIdAsync),
                                new { eventId }),
                       null));
        }
        public IActionResult CreateEvent([FromRoute] Guid trackerId, [FromBody] EventCreateRequest request)
        {
            var actorId = Guid.Parse(User.FindFirstValue(JwtClaimTypes.Id));
            var form    = new EventForm(request.Title);
            var eventId = _eventService.CreateEvent(actorId, trackerId, form);

            if (eventId == Guid.Empty)
            {
                return(NotFound(new
                {
                    errors = new
                    {
                        commonError = $"Tracker {trackerId} doesn't exists or no permissions to create."
                    }
                }));
            }
            if (!request.Customizations.IsNull())
            {
                AddCustomizationsToEvent(actorId, trackerId, eventId, request.Customizations);
            }

            return(NoContent());
        }
Ejemplo n.º 25
0
        public async Task <IActionResult> CreateEventAsync(
            [FromBody] EventForm eventForm,
            CancellationToken ct)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(ModelState)));
            }

            var eventId = await _eventService.CreateEventAsync(
                eventForm.Name,
                eventForm.Location,
                eventForm.Description,
                eventForm.From,
                eventForm.To,
                eventForm.Expire,
                ct);

            return(Created(
                       Url.Link(nameof(GetEventByIdAsync),
                                new { eventId }),
                       null));
        }
Ejemplo n.º 26
0
 // TODO: should figure out mouse clicks/drags for pctView
 private void lstBlocks_SelectedIndexChanged(object sender, EventArgs e)
 {
     pctView.Refresh();
     if (_film.Blocks[lstBlocks.SelectedIndex].TypeNum == 3)
     {
         BoxImage(lstBlocks.SelectedIndex);
     }
     if (_film.Blocks[lstBlocks.SelectedIndex].Type == Film.Block.BlockType.Voic)
     {
         playWav(lstBlocks.SelectedIndex, 100, 0);
     }
     if (_fEvent == null || !_fEvent.Created)
     {
         _fEvent = new EventForm(ref _film.Blocks[lstBlocks.SelectedIndex]);
         _fEvent.Show();
         _fEvent.Left = Left + Width + 5;
         _fEvent.Top  = Top;
     }
     else
     {
         _fEvent.LoadBlock(ref _film.Blocks[lstBlocks.SelectedIndex]);
     }
 }
Ejemplo n.º 27
0
        public IActionResult CreateEvent(EventForm Input, String ListingId)
        {
            if (ModelState.IsValid)
            {
                if (Int32.TryParse(ListingId, out int id))
                {
                    Listing thisListing = _context.listings
                                          .FirstOrDefault(l => l.ListingId == id);

                    int?   ID   = HttpContext.Session.GetInt32("userid");
                    Broker user = _context.users
                                  .OfType <Broker>()
                                  .Where(broker => broker.UserId == ID)
                                  .FirstOrDefault();

                    if (user == null)
                    {
                        return(Redirect("/fail"));
                    }
                    if (thisListing.BrokerId != user.UserId)
                    {
                        return(Redirect("/fail"));
                    }

                    Event NewEvent = new Event(Input, user, thisListing);


                    _context.events.Add(NewEvent);
                    user.Events.Add(NewEvent);
                    thisListing.Events.Add(NewEvent);

                    _context.SaveChanges();
                    return(Redirect("/listing-details/" + id));
                }
            }
            return(View("AddEvents"));
        }
Ejemplo n.º 28
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     EventForm.DisplayEventForm();
 }
Ejemplo n.º 29
0
 public EventViewService(EventViewUIMrg eum, EventForm ef)
 {
     this.m_EventViewUIManager = eum;
     this.EventFormInstance = ef;
 }
 private void eventLogViewerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     EventForm.DisplayEventForm();
 }
Ejemplo n.º 31
0
        public async Task <string> SubmitEventForm(CancellationToken cancellationToken, EventForm inputForm)
        {
            var user    = HttpContext.KmIdentity();
            var WFMUser = getWFMUser(user.LdapUserId);

            if (WFMUser == null)
            {
                return(JsonConvert.SerializeObject(new { success = false, msg = "You are not authorized to access WFM Dashboard" }));
            }
            log.Info($"User {user.LdapUserId} called SubmitEventForm \r\n Params: InputForm: {inputForm.ToString()}");
            string msg        = "";
            var    googleAuth = await new AuthorizationCodeMvcAppOverride(this, new AppFlowMetadata(user.LdapUserId)).AuthorizeAsync(cancellationToken);

            if (googleAuth.Credential == null)
            {
                return(JsonConvert.SerializeObject(new { success = false, msg = "Error - please refresh page and log back into Google Calendar" }));
            }
            else
            {
                //List<ViewEvent> eventObject = WFMHelper.SubmitEventForm(googleAuth, inputForm, user.LdapUserId, out msg);
                var success = WFMHelper.SubmitEventForm(googleAuth, inputForm, user.LdapUserId, out msg);

                return(JsonConvert.SerializeObject(new { success = success, msg = msg }));
            }
        }