public void NotifyEventAddition(Event addedEvent) { if (!EventsList.Contains(addedEvent, new EventComparer())) { UpdateHelper.Instance.EventsListAdditionHelper.Add(addedEvent); } }
protected Simulator(EventsList eventsList, INextEventChooserStrategy nextEventChooserStrategy, Clock clock, double simulationDuration, double warmupDuration, string dumpSimulationStatusFilename) { EventsList = eventsList; this.nextEventChooserStrategy = nextEventChooserStrategy; this.simulationDuration = simulationDuration; WarmupDuration = warmupDuration; warmupDurationForReset = warmupDuration; Clock = clock; executedEvent = new List <Event>(); try { var fs = File.Open(dumpSimulationStatusFilename, FileMode.Open); fs.SetLength(0); fs.Close(); streamWriter = new StreamWriter(dumpSimulationStatusFilename); } catch (Exception) { // ignored } }
public void NotifyEventModification(Event modifiedEvent) { if (EventsList.Contains(modifiedEvent, new EventComparer())) { UpdateHelper.Instance.EventsListModificationHelper.Add(modifiedEvent); } }
async Task ExecuteLoadNextItemsCommand() { position = position + 3; pageNo++; EventsList.Clear(); try { var response = await _client.GetAsync(Uri + position); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); List <Event> items = JsonConvert.DeserializeObject <List <Event> >(content); foreach (var item in items) { EventsList.Add(item); Console.WriteLine(item.Title); } } } catch (Exception ex) { Debug.WriteLine(ex); } }
public JsonResult GetEventsCountCalender(bool isRender = false) { EventsList events = new EventsList(); List <EventsCalender> calenderEvents = new List <EventsCalender>(); try { events.AgencyId = new Guid(Session["AgencyId"].ToString()); events.UserId = new Guid(Session["UserID"].ToString()); events.EmailId = Session["EmailId"].ToString(); if (isRender) { calenderEvents = new EventsData().GetRegisteredEventCalendar(events); } else { calenderEvents = new EventsData().GetRegisteredEventCount(events); } var arr = calenderEvents.ToArray(); return(Json(arr, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { clsError.WriteException(ex); var arr = calenderEvents.ToArray(); return(Json(arr, JsonRequestBehavior.AllowGet)); } }
public ActionResult NewRegistration(string WorkShopName, string CenterName, string Enc_Centerid = "0", string WorkShopId = "0") { List <NewRegistration> list = new List <NewRegistration>(); NewRegistration list1 = new NewRegistration(); WalkinRegistraton registration = new WalkinRegistraton(); try { EventsList events = new EventsList { WorkShopName = WorkShopName, CenterName = CenterName, CenterId = (Enc_Centerid == "0") ? 0 : Convert.ToInt64(EncryptDecrypt.Decrypt64(Enc_Centerid)), WokShopId = (WorkShopId == "0") ? 0 : Convert.ToInt64(EncryptDecrypt.Decrypt64(WorkShopId)), UserId = new Guid(Session["UserID"].ToString()), AgencyId = new Guid(Session["AgencyId"].ToString()) }; List <EventsCenter> centerList = new List <EventsCenter>(); list = new EventsData().GetClientForNewRegistration(ref centerList, events); ViewBag.WorkShopName = WorkShopName; ViewBag.CenterName = CenterName; ViewBag.CenterID = Enc_Centerid; ViewBag.workShopId = WorkShopId; registration.NewRegistrationList = list; registration.CenterList = centerList; } catch (Exception ex) { clsError.WriteException(ex); } return(View(registration)); }
/// <summary> /// Get the events using the events index /// </summary> /// <param name="page"></param> /// <returns></returns> public ActionResult Index(int page = 1) { // get the current context item var contextItem = RenderingContext.Current.ContextItem; //create a new model var model = new EventsList(); //get the index to use var index = GetEventsSearchIndex(); //check the index if (index != null) { //use the indexes search using (var context = index.CreateSearchContext()) { // get the results var results = context.GetQueryable <EventDetails>() .Where(item => item.Paths.Contains(contextItem.ID) && item.Language == contextItem.Language.Name) .Page(page - 1, PageSize) .GetResults(); // assing them to our model model.Events = results.Hits.Select(hit => hit.Document).ToList(); model.TotalResultCount = results.TotalSearchResults; model.PageSize = PageSize; } } //retunr the results in the model return(View(model)); }
private async void SortEvents() { IsBusy = true; await Task.Run(() => { var sortList = new List <EventItemViewModel>(EventsList); if (isNearestEvent) { sortList = sortList.OrderByDescending(x => x.EventStartDate).ToList(); } else { sortList = sortList.OrderBy(x => x.EventStartDate).ToList(); } isNearestEvent = !isNearestEvent; EventsList.Clear(); foreach (var item in sortList) { EventsList.Add(item); } }); IsBusy = false; }
private void SelectEvent(object sender, RoutedEventArgs e) { var item = ((Grid)((Button)sender).Parent).DataContext; var container = (ListViewItem)EventsList.ContainerFromItem(item); container.IsSelected = true; }
public JsonResult GetCancelledEventInfo(int mode) { EventsList events = new EventsList(); List <EventsList> eventsList = new List <EventsList>(); List <ReasonList> reasonList = new List <ReasonList>(); bool isResult = false; try { events.AgencyId = new Guid(Session["AgencyId"].ToString()); events.UserId = new Guid(Session["UserID"].ToString()); events.EmailId = Session["EmailId"].ToString(); if (mode == 1) { isResult = new EventsData().GetUpdatedReasons(events, mode); } else { eventsList = new EventsData().GetChangedEventsForParent(events, mode); } return(Json(new { isResult, eventsList }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { clsError.WriteException(ex); return(Json(new { isResult, eventsList }, JsonRequestBehavior.AllowGet)); } }
public JsonResult ChangeImage(string monitor, string eventId) { string[] _imgpath = new string[System.Web.HttpContext.Current.Request.Files.Count]; bool isResult = false; EventsList events = new EventsList(); try { _imgpath = SaveImageToSource(); if (_imgpath.Count() > 0) { foreach (var image in _imgpath) { events.EventId = Convert.ToInt64(EncryptDecrypt.Decrypt64(eventId)); events.AgencyId = new Guid(Session["AgencyID"].ToString()); events.UserId = new Guid(Session["UserID"].ToString()); events.ImagePath = image; isResult = new EventsData().UpdateEventsImage(events); } } } catch (Exception ex) { clsError.WriteException(ex); } return(Json(new { isResult, _imgpath }, JsonRequestBehavior.AllowGet)); }
public void NotifyEventRemoval(Event removedEvent) { if (EventsList.Contains(removedEvent, new EventComparer())) { UpdateHelper.Instance.EventsListRemovalHelper.Add(removedEvent); } }
public EventsModal GetAllEvents(EventsList list) { EventsModal modal = new EventsModal(); modal = new EventsData().GetEventsListData(list); return(modal); }
private static void Main(string[] args) { const int seed = 1; IRandom random = new RandomGenerator(seed); var eventsList = new EventsList(); var nextEventChooser = new NextEventChooserStrategySmallestTimestamp(); var clock = new Clock(); }
public void Serialize(EventsList events) { using (TextWriter writeFileStream = new StreamWriter(_path)) { Serializer.Serialize(writeFileStream, events); writeFileStream.Close(); } }
private void Events_ScrollChanged(object sender, ScrollChangedEventArgs e) { bool should = EventsList.ShouldScrollToBottom(); if ((!should || ScrollToBottom) && (!ScrollToBottom || should)) { ScrollToBottom = should; } }
private void PopulateListViewWithEvents(List <SystemEventGUImodel> modelsList) { EventsList.Clear(); foreach (var item in modelsList) { EventsList.Add(item); } }
public static EventsList GetInstance() { lock (mutex) { if (instance == null) { instance = new EventsList(); } return(instance); } }
public async Task Init() { Model.Search.Event request; if (SelectedSearchOption == SearchOptions.TeamActive) { request = new Model.Search.Event { InPast = false, FunctionalFieldId = APIService.LoggedUser.FunctionalFieldId, LocalCommitteeId = APIService.LoggedUser.LocalCommitteeId }; if (APIService.LoggedUser.FunctionalFieldId == 1) { request.FunctionalFieldId = 0; } } else if (SelectedSearchOption == SearchOptions.AllActive) { request = new Model.Search.Event { InPast = false }; } else if (SelectedSearchOption == SearchOptions.AllTeam) { request = new Model.Search.Event { FunctionalFieldId = APIService.LoggedUser.FunctionalFieldId, LocalCommitteeId = APIService.LoggedUser.LocalCommitteeId }; if (APIService.LoggedUser.FunctionalFieldId == 1) { request.FunctionalFieldId = 0; } } else { request = null; } try { var list = await _eventService.Get <IEnumerable <Model.Response.Event> >(request); EventsList.Clear(); foreach (var item in list) { EventsList.Add(item); } } catch (Exception ex) { await Application.Current.MainPage.DisplayAlert("Event", "There was an error.", "OK"); } }
public ActionResult EventsReport() { try { EventsList events = new EventsList(); events.AgencyId = new Guid(Session["AgencyId"].ToString()); } catch (Exception ex) { clsError.WriteException(ex); } return(View()); }
protected void Page_Load(object sender, EventArgs e) { //Use the dataset returned from the code to be the //data source of the grid view System.Data.DataSet ds = EventsList.getMusic(); dgvMusic.DataSource = ds.Tables["dtMusic"]; dgvMusic.AllowPaging = true; dgvMusic.PageSize = 10; dgvMusic.DataBind(); }//end of page load
private void printButton_Click(object sender, RoutedEventArgs e) { System.Windows.Controls.PrintDialog prnt = new System.Windows.Controls.PrintDialog(); if (prnt.ShowDialog() == true) { prnt.PrintVisual(EventInvoiceGrid, "Printing Grid"); } EventsList EL = new EventsList(eventIdTextBlock.Text, EventCalculation.eventDate, EventCalculation.eventStartTime, EventCalculation.photographyCost, EventCalculation.decorationCost, EventCalculation.totalcenterCost, EventCalculation.vat, EventCalculation.discount, EventCalculation.totalCostWithVat, EventCalculation.advancePay, EventCalculation.remainingPay, EventCalculation.customerName, EventCalculation.customerContactNumber, EventCalculation.customerEmail, EventCalculation.customerAddress, "Pending"); EventService service = new EventService(); int x = service.AddEvent(EL); CenterService cs = new CenterService(); cs.BookCenter(eventIdTextBlock.Text, EventCalculation.centerId); EventCalculation.eventDate = ""; EventCalculation.eventStartTime = ""; EventCalculation.eventEndTime = ""; EventCalculation.printedPhotos = ""; EventCalculation.eachPhotoCost = ""; EventCalculation.photographyCost = 0; EventCalculation.decorationCost = 0; EventCalculation.stage = ""; EventCalculation.homelight = ""; EventCalculation.homelightDuration = ""; EventCalculation.streetlight = ""; EventCalculation.streetlightDeuration = ""; EventCalculation.gate = ""; EventCalculation.planaquin = ""; EventCalculation.centerName = ""; EventCalculation.centerLoaction = ""; EventCalculation.totalCostWithoutVat = 0; EventCalculation.totalcenterCost = 0; EventCalculation.eventDuration = ""; EventCalculation.CostStage = 0; EventCalculation.CostHomeLight = 0; EventCalculation.CostStreetLight = 0; EventCalculation.CostGate = 0; EventCalculation.CostPlanaquin = 0; EventCalculation.vat = 0; EventCalculation.discount = 0; EventCalculation.totalCostWithVat = 0; EventCalculation.customerName = ""; EventCalculation.customerContactNumber = ""; EventCalculation.customerEmail = ""; EventCalculation.customerAddress = ""; EventCalculation.eventId = ""; EventCalculation.advancePay = ""; EventCalculation.remainingPay = ""; this.Close(); }
public async Task <HttpResponseMessage> DoReservation(string email, DateTime start, DateTime end) { Attende att = new Attende { role = "req-participant", rsvp = true, userType = "room", status = "needs-action", email = email }; List <Attende> at = new List <Attende>(); at.Add(att); List <Events> eveList = new List <Events>(); Events ev = new Events { summary = "Quick Reservation", transparency = "opaque", sequence = 0, organizer = new MeetingOrganizer { displayName = "Quick Reservation", email = this.config["lotus:email"] }, start = new DateMeeting { date = start.Year + "-" + start.Month + "-" + start.Day, time = (start.Hour - int.Parse(this.config["lotus:utc"])) + ":" + start.Minute + ":00", utc = true }, end = new DateMeeting { date = end.Year + "-" + end.Month + "-" + end.Day, time = (end.Hour - int.Parse(this.config["lotus:utc"])) + ":" + end.Minute + ":00", utc = true }, attendees = at }; eveList.Add(ev); EventsList eve = new EventsList { events = eveList }; var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(eve); HttpResponseMessage response = await DoPostAsync(jsonString); return(response); }
public void CreateModal(Event modalEvent) { if (currentEvent != null) return; if(list == null) { master = GetComponentInParent<Game>(); list = master.list; } currentEvent = modalEvent; GetComponent<Image>().sprite = currentEvent.image; description.text = currentEvent.text; if(currentEvent.options.Length == 0) { GameObject button = Instantiate<GameObject>(optionPrefab); RectTransform buttonTransform = button.GetComponent<RectTransform>(); buttonTransform.SetParent(transform, false); buttonTransform.sizeDelta.Set(1f, 1f); button.GetComponentInChildren<Text>().text = "Continuar"; button.GetComponent<ModalButton>().option = EventsList.Events.None; button.GetComponent<ModalButton>().source = GetComponentInParent<AudioSource>(); } else foreach (Option op in currentEvent.options) { bool isOpAvaiable = true; if (list.events[(int)op.consequence] != null) foreach (EventsList.Events req in list.events[(int)op.consequence].requirements) { if (list.completed[(int)req] == false) { isOpAvaiable = false; break; } } if(isOpAvaiable) { GameObject button = Instantiate<GameObject>(optionPrefab); RectTransform buttonTransform = button.GetComponent<RectTransform>(); buttonTransform.SetParent(transform, false); buttonTransform.sizeDelta.Set(1f, 1f); button.GetComponentInChildren<Text>().text = op.optionText; button.GetComponent<ModalButton>().option = op.consequence; button.GetComponent<ModalButton>().source = GetComponentInParent<AudioSource>(); } } }
/// <summary> /// Get the next page of events for the current search and appends it to EventsList /// </summary> /// <returns> Task which is getting the events page asynchronously </returns> public async Task GetNextEventsPage() { List <Event> nextEventsPage; try { nextEventsPage = await Eventbrite.GetNextEventsPage(); } catch (Eventbrite.NoMoreEventsPagesException) { return; } EventsList.AddRange(nextEventsPage); NotifyOfPropertyChange(() => EventsList); }
public async Task GetEvents() { if (UserLoggedIn.User != null) { using (var c = new HttpClient()) { try { c.DefaultRequestHeaders.Add("x-access-token", UserLoggedIn.Token); var response = await c.GetAsync(ConnectionLinks.EventsAddress); Debug.WriteLine(response); var content = await response.Content.ReadAsStringAsync(); EventsList = JsonConvert.DeserializeObject <ObservableCollection <Events> >(content); EventsList = new ObservableCollection <Events>(EventsList.OrderBy(i => i.Name)); IsLoading = false; Debug.WriteLine(EventsList); foreach (var item in EventsList) { //EventDate = Convert.ToDateTime(item.Date); EventDate = DateTime.ParseExact(item.Date, @"d/M/yyyy", System.Globalization.CultureInfo.InvariantCulture); if (EventDate >= TodayDateOnly) { EventsListAfterDate.Add(item); } } EventsListAfterDate = new ObservableCollection <Events>(EventsListAfterDate.OrderBy(i => i.Name)); Debug.WriteLine(EventsList.Count); Debug.WriteLine(EventsListAfterDate.Count); } catch (Exception e) { IsLoading = false; Debug.WriteLine(e.Message); MessagingCenter.Send(this, Constants.MessagingCenter.EventsPage.GoneWrong); } } } else { IsLoading = false; MessagingCenter.Send(this, Constants.MessagingCenter.EventsPage.GoneWrong); } }
public Event(string imgPath, string text, EventsList.Events[] requirements, int reli, int merc, int mili, int ppl, int res, int mor, Option[] opt) { this.defaultImg = imgPath.Equals(EventsList.defaultImg); if (imgPath != null) this.image = Resources.Load<Sprite> ("Sprites/" + imgPath); if (this.image == null) this.image = Resources.Load<Sprite>("Sprites/" + EventsList.defaultImg); this.text = text; this.requirements = requirements; this.religious = reli; this.mercantile = merc; this.military = mili; this.people = ppl; this.resources = res; this.morale = mor; this.options = opt; }
private static EventsList EventsParser(string json) { JObject jsonObj = JsonConvert.DeserializeObject <JObject>(json); EventsList list = new EventsList(); object[] events = ((JArray)jsonObj["events"]).ToObject <object[]>(); foreach (JObject evnt in events) { list.Events.Add(evnt.ToObject <Dictionary <string, object> >()); } list.Status = jsonObj["status"].ToObject <string>(); return(list); }
public ActionResult ParentEventSelection() { ParentSelectionEvent modal = new ParentSelectionEvent(); try { EventsList events = new EventsList(); events.AgencyId = new Guid(Session["AgencyId"].ToString()); events.UserId = new Guid(Session["UserID"].ToString()); modal = new EventsData().GetParentEventSelectionData(events, Session["EmailId"].ToString()); } catch (Exception ex) { clsError.WriteException(ex); } return(View(modal)); }
/// <summary> /// Clears EventsList and populates it with a new page of events for the given location / proximity /// </summary> /// <param name="location"> Location to search </param> /// <param name="proximity"> Proximity in miles to the given location to search </param> /// <returns> Task which is getting the events page asynchronously </returns> public async Task GetNewEventsPage(string location, int proximity = 25) { List <Event> eventsPage; try { eventsPage = await Eventbrite.GetNewEventsPage(location, proximity); } catch (System.Net.WebException) { MessageBox.Show("No results found for your search. Check your internet location and city name / zip code"); return; } EventsList.Clear(); EventsList.AddRange(eventsPage); NotifyOfPropertyChange(() => EventsList); }
private void Handler(JsonApiEvent obj) { Dispatcher.Invoke(() => { if (!Attach) { return; } Events.Add(new EventData(this.StartTime, obj)); if (ScrollToBottom) { EventsList.ScrollToBottom(); } }); }
private EventsList AddEvents(IEnumerable <Event> events) { EventsList eventsList = new EventsList(); List <EventsSummary> eventsSummaries = new List <EventsSummary>(); eventsList.available = events.Count(); eventsList.returned = events.Count(); eventsList.collectionURI = string.Empty; foreach (var item in events) { eventsSummaries.Add(new EventsSummary() { resourceURI = item.ResourceUri, name = item.Title }); } return(eventsList); }
public void Decode(byte[] array) { reader = new KrosmagaReader(); reader.SetData(array); int tag; while (reader.B.BaseStream.Position < reader.B.BaseStream.Length && (tag = reader.ReadTag()) != 0) { if (tag == 10) { Data.GameEvent gameEvent = new Data.GameEvent(); int size = (int)reader.ReadRawVarint32(); gameEvent.Decode(reader.ReadMessage(size)); EventsList.Add(gameEvent); continue; } } }
public void should_serialize_and_deserialize_two_events() { // Arrange var events = new EventsList(new List<Event> { new Event(new DateTime(2012, 12, 12)), new Event(new DateTime(2011, 11, 1)) }); var target = new EventsSerializer("serialized.xml"); // Act target.Serialize(events); var result = target.Deserialize(); // Assert Assert.Equal(2, result.Count); Assert.Equal(new DateTime(2012, 12, 12), result[0].Date); Assert.Equal(new DateTime(2011, 11, 1), result[1].Date); }
void Start() { master = GetComponentInParent<Game>(); canvas = GetComponentInParent<Canvas>(); list = master.list; }
public Option(string optionText, EventsList.Events consequence){ this.optionText = optionText; this.consequence = consequence; }
private void performLoadProcedure() { List<string[]> npcNames = LocalisationMang.getBothNPCnames(); NPCgameNames = new string[npcNames.Count]; NPCserverNamesID = new Dictionary<string,int>(); characterLanguageAreas = new int[npcNames.Count] ; characterDifficulties = new List<int>[npcNames.Count]; //encounters = new Encounter[npcNames.Count]; for(int i = 0; i <npcNames.Count;i++){ NPCgameNames[i] = npcNames[i][0]; NPCserverNamesID[npcNames[i][1]] = i; characterDifficulties[i] = new List<int>(); } profile = WorldViewServerCommunication.userProfile.getLiteracyProfile().getDifficultiesDescription(); for(int lA = 0;lA<profile.getDifficulties().Length;lA++){ for(int diff = 0; diff<profile.getDifficulties()[lA].Length;diff++){ Difficulty difficulty = profile.getDifficulties()[lA][diff]; characterLanguageAreas[ NPCserverNamesID[difficulty.character] ] = lA; characterDifficulties[ NPCserverNamesID[difficulty.character] ].Add(diff); } } events = new EventsList(true); newsfeed = new NewsfeedList(true); //UnityEngine.GameObject poRef = PersistentObjMang.getInstance(); //DatastoreScript ds = poRef.GetComponent<DatastoreScript>(); }
void Start(){ allEvents = new EventsList (); eventCount = 0; }
public void Return(EventsList.Events option) { if (option == EventsList.Events.Lose) { Lose(); return; } else if (option == EventsList.Events.Win) { Win(); return; } ready = true; dummy.SetActive(true); list.completed[(int)currentEvent] = true; Event e = list.events[(int)currentEvent]; status.Add(e.people, e.resources, e.morale); if (e.mercantile == 1) society.AddMercantile(); else if (e.military == 1) society.AddMilitary(); else if (e.religious == 1) society.AddReligious(); if (society.Mercantile > 0) { if (society.Military > 0) mercantileMilitary.Set(); else if (society.Religious > 0) mercantileReligious.Set(); else mercantile.Set(); } else if (society.Military > 0) { if (society.Religious > 0) militaryReligious.Set(); else military.Set(); } else if (society.Religious > 0) religious.Set(); if (option != EventsList.Events.None) { currentEvent = option; immediate = true; list.completed[(int)option] = true; } else if (status.People == 0) { currentEvent = EventsList.Events.BadEndPess; immediate = true; } else if (status.Resources == 0) { currentEvent = EventsList.Events.BadEndRecu; immediate = true; } else if (status.Morale == 0) { currentEvent = EventsList.Events.BadEndMora; immediate = true; } }
void Start() { if (list == null) list = GetComponent<EventsList>(); dummyImage = dummy.GetComponent<Image>(); }
public void Event(EventsList.Events option) { master.Return(option); Destroy(gameObject); }