public async Task RemovePledgeAsync(EventRegistration registration, GGCharityUser Donor) { var pledge = await (from p in _context.Pledges where p.Receiver.UserId.Equals(registration.UserId) && p.Receiver.EventId.Equals(registration.EventId) && p.DonorId.Equals(Donor.Id) select p).SingleOrDefaultAsync(); _context.Pledges.Remove(pledge); }
//AddEvetnRegistration public JsonExecuteResult AddEventRegistration(long event_id, long user_id, bool ishb) { try { EventRegistration er = new EventRegistration(); if (!ishb) { er = dataContext.EventRegistrations.Where(ER => ER.Event_ID == event_id && ER.User_ID == user_id).FirstOrDefault(); if (er != null) return new JsonExecuteResult(JsonExecuteResultTypes.ERROR, "This user already registered for this event."); er = new EventRegistration(); er.Event_ID = event_id; er.User_ID = user_id; dataContext.EventRegistrations.InsertOnSubmit(er); } else { List<User> users = dataContext.Users.Where(U => U.UserType_ID == (byte)Consts.UserTypes.HouseBidder && U.UserStatus_ID == (byte)Consts.UserStatus.Active).ToList(); int hbamount = (user_id < 1) ? Consts.HouseBiddersAmountForEventRegstration : (int)user_id; if (users.Count() > hbamount) { int index; while (users.Count() > hbamount) { Random r = new Random(); index = r.Next(hbamount + 1); if (index <= users.Count()) users.RemoveAt(index); } } foreach (User user in users) { er = dataContext.EventRegistrations.Where(ER => ER.User_ID == user.ID && ER.Event_ID == event_id).FirstOrDefault(); if (er != null) continue; er = new EventRegistration(); er.Event_ID = event_id; er.User_ID = user.ID; dataContext.EventRegistrations.InsertOnSubmit(er); } } GeneralRepository.SubmitChanges(dataContext); } catch (Exception ex) { return new JsonExecuteResult(JsonExecuteResultTypes.ERROR, ex.Message); } return new JsonExecuteResult(JsonExecuteResultTypes.SUCCESS); }
public Pledge AddPledge(EventRegistration PlayerRegistration, GGCharityUser donor, Decimal Amount) { var pledge = new Pledge(PlayerRegistration, donor, Amount); _context.Pledges.Add(pledge); return pledge; }
/// <inheritdoc/> public override async Task <IList <string> > PublishAsync <TEvent>(IList <EventContext <TEvent> > events, EventRegistration registration, DateTimeOffset?scheduled = null, CancellationToken cancellationToken = default) { using var scope = CreateScope(); var messages = new List <ServiceBusMessage>(); foreach (var @event in events) { using var ms = new MemoryStream(); await SerializeAsync(body : ms, @event : @event, registration : registration, scope : scope, cancellationToken : cancellationToken); var message = new ServiceBusMessage(ms.ToArray()) { MessageId = @event.Id, ContentType = @event.ContentType.ToString(), }; // If CorrelationId is present, set it if (@event.CorrelationId != null) { message.CorrelationId = @event.CorrelationId; } // If scheduled for later, set the value in the message if (scheduled != null && scheduled > DateTimeOffset.UtcNow) { message.ScheduledEnqueueTime = scheduled.Value.UtcDateTime; } // If expiry is set in the future, set the ttl in the message if (@event.Expires != null && @event.Expires > DateTimeOffset.UtcNow) { var ttl = @event.Expires.Value - DateTimeOffset.UtcNow; message.TimeToLive = ttl; } // Add custom properties message.ApplicationProperties.AddIfNotDefault(AttributeNames.RequestId, @event.RequestId) .AddIfNotDefault(AttributeNames.InitiatorId, @event.InitiatorId) .AddIfNotDefault(AttributeNames.ActivityId, Activity.Current?.Id); messages.Add(message); } // Get the sender and send the messages accordingly var sender = await GetSenderAsync(registration, cancellationToken); Logger.LogInformation("Sending {EventsCount} messages to '{EntityPath}'. Scheduled: {Scheduled}. Events:\r\n- {Ids}", events.Count, sender.EntityPath, scheduled, string.Join("\r\n- ", events.Select(e => e.Id))); if (scheduled != null) { var seqNums = await sender.ScheduleMessagesAsync(messages : messages, scheduledEnqueueTime : messages.First().ScheduledEnqueueTime, cancellationToken : cancellationToken); return(seqNums.Select(sn => sn.ToString()).ToList()); // return the sequence numbers } else { await sender.SendMessagesAsync(messages : messages, cancellationToken : cancellationToken); return(Array.Empty <string>()); // no sequence numbers available } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='eventRegistration'> /// </param> public static EventRegistration PostEventRegistration(this IEventRegistrations operations, EventRegistration eventRegistration) { return(Task.Factory.StartNew(s => ((IEventRegistrations)s).PostEventRegistrationAsync(eventRegistration), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
static private void GetCheckInOutAccessTableData(string[] args) { //SMCHDBEntities _entities = new SMCHDBEntities(); string conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Program Files\\att2008\\att2000.mdb"; string strSql = "SELECT CHECKINOUT.CHECKTIME, USERINFO.Badgenumber FROM (CHECKINOUT INNER JOIN USERINFO ON CHECKINOUT.USERID = USERINFO.USERID) "; OleDbConnection con = new OleDbConnection(conString); DataTable AttendanceTable = new DataTable(); System.Console.WriteLine("Opening MDB connection..."); con.Open(); OleDbDataAdapter dAdapter = new OleDbDataAdapter(); dAdapter.SelectCommand = new OleDbCommand(strSql, con); dAdapter.Fill(AttendanceTable); con.Close(); System.Console.WriteLine("Data loaded from MDB file. Updating database, please wait..."); // get latest time in GroupMeditationAttendance table DateTime latestGroupMeditationAttendanceDB = _entities.GroupMeditationAttendances.OrderByDescending(a => a.CheckInTime).Select(a => a.CheckInTime).FirstOrDefault(); if (latestGroupMeditationAttendanceDB < new DateTime(2011, 12, 1) || args.Length == 1 && args[0].ToLower() == "all") { latestGroupMeditationAttendanceDB = new DateTime(2011, 12, 1); } else { latestGroupMeditationAttendanceDB = latestGroupMeditationAttendanceDB.AddDays(-3); } // Filter old record and no member person //var attendanceList = AttendanceTable.AsEnumerable().Where( // a => a.Field<DateTime>("CHECKTIME") >= latestGroupMeditationAttendanceDB).ToList(); var attendanceList = AttendanceTable.AsEnumerable().Where( a => a.Field <DateTime>("CHECKTIME") >= latestGroupMeditationAttendanceDB).OrderBy(a => a.Field <DateTime>("CHECKTIME")).ToList(); List <int> memberNoList = _entities.MemberInfos.Where(a => a.MemberNo.HasValue).Select(a => a.MemberNo.Value).ToList(); foreach (DataRow dr in attendanceList) { DateTime checkInTime = (DateTime)dr["CHECKTIME"]; int memberNo = int.Parse((string)dr["Badgenumber"]); if (!memberNoList.Contains(memberNo)) { continue; } //System.Console.WriteLine("Uploading record of member " + memberNo.ToString() + " at " + checkInTime.ToString()); Guid memberID = _entities.MemberInfos.SingleOrDefault(a => a.MemberNo == memberNo).MemberID; DateTime checkInTimeStart = checkInTime.AddMinutes(90 + 15); DateTime checkInTimeEnd = checkInTime.AddMinutes(-15); //if (_entities.Events.Any(a => a.StartDateTime <= checkInTimeStart && a.StartDateTime >= checkInTime)) if (_entities.Events.Any(a => a.StartDateTime <= checkInTimeStart && a.StartDateTime >= checkInTimeEnd)) { //int eventID = _entities.Events.Where(a => a.StartDateTime <= checkInTimeStart && a.StartDateTime >= checkInTime).FirstOrDefault().ID; Event aEvent = _entities.Events.Where(a => a.StartDateTime <= checkInTimeStart && a.StartDateTime >= checkInTimeEnd).FirstOrDefault(); if (!_entities.EventRegistrations.Any(a => a.EventID == aEvent.ID && a.MemberID == memberID)) { EventRegistration eventRegistration = new EventRegistration(); eventRegistration.MemberID = memberID; eventRegistration.EventID = aEvent.ID; eventRegistration.SignTime = checkInTime; _entities.AddToEventRegistrations(eventRegistration); _entities.SaveChanges(); System.Console.WriteLine("Uploading" + aEvent.Title + " MemberNo: " + memberNo.ToString() + " at " + checkInTime.ToString()); //System.Console.WriteLine("Updated Event checkin"); continue; } } //if (_entities.GroupMeditations.Any(a => a.StartDateTime <= checkInTimeStart && a.StartDateTime >= checkInTime)) if (_entities.GroupMeditations.Any(a => a.StartDateTime <= checkInTimeStart && a.StartDateTime >= checkInTimeEnd)) { //int groupMeditaionID = _entities.GroupMeditations.Where(a => a.StartDateTime <= checkInTimeStart && a.StartDateTime >= checkInTime).FirstOrDefault().ID; int groupMeditaionID = _entities.GroupMeditations.Where(a => a.StartDateTime <= checkInTimeStart && a.StartDateTime >= checkInTimeEnd).FirstOrDefault().ID; if (!_entities.GroupMeditationAttendances.Any(a => a.GroupMeditationID == groupMeditaionID && a.MemberID == memberID)) { GroupMeditationAttendance groupMeditationAttendance = new GroupMeditationAttendance(); groupMeditationAttendance.MemberID = memberID; groupMeditationAttendance.GroupMeditationID = groupMeditaionID; groupMeditationAttendance.CheckInTime = checkInTime; _entities.AddToGroupMeditationAttendances(groupMeditationAttendance); _entities.SaveChanges(); System.Console.WriteLine("Uploading GM: MemberNo " + memberNo.ToString() + " at " + checkInTime.ToString()); } } } }
private void UnregisterViaDictionary(EventRegistration <T> registration) => dictionary.UnregisterTagId(registration.TagId);
public WebBrowserPage(IServiceDispatcher serviceDispatcher, IPlatformProvider platformProvider) { webView = new ShellWebView(); eventRegistrations = new ConcurrentDictionary <string, EventRegistration>(); webView.RegisterCallback("initialize", args => { platformProvider.ExecuteOnUIThread(() => webView.InjectJavaScript(string.Format("serviceDispatcher._initializeCallback({0});", JsonConvert.SerializeObject(serviceDispatcher.Services)))); }); webView.RegisterCallback("dispatch", args => { DispatchData dispatchData = JsonConvert.DeserializeObject <DispatchData>(args); string result = string.IsNullOrEmpty(dispatchData.InstanceName) ? JsonConvert.SerializeObject(serviceDispatcher.Dispatch(dispatchData.ServiceName, dispatchData.MethodName, dispatchData.Arguments)) : JsonConvert.SerializeObject(serviceDispatcher.Dispatch(dispatchData.ServiceName, dispatchData.InstanceName, dispatchData.MethodName, dispatchData.Arguments)); if (dispatchData.CallbackId != null) { platformProvider.ExecuteOnUIThread(() => webView.InjectJavaScript(string.Format("serviceDispatcher._dispatchCallback('{0}', {1});", dispatchData.CallbackId, result))); } }); webView.RegisterCallback("subscribeEvent", args => { SubscribeEventData subscribeEventData = JsonConvert.DeserializeObject <SubscribeEventData>(args); EventRegistration eventRegistration = serviceDispatcher.SubscribeEvent(subscribeEventData.ServiceName, subscribeEventData.EventName, this, (s, e) => { if (subscribeEventData.CallbackId != null) { platformProvider.ExecuteOnUIThread(() => webView.InjectJavaScript(string.Format("serviceDispatcher._eventCallback('{0}', '{1}');", subscribeEventData.CallbackId, JsonConvert.SerializeObject(e)))); } }); eventRegistrations.AddOrUpdate(subscribeEventData.CallbackId, eventRegistration, (k, e) => e); }); webView.RegisterCallback("unsubscribeEvent", args => { UnsubscribeEventData unsubscribeEventData = JsonConvert.DeserializeObject <UnsubscribeEventData>(args); EventRegistration eventRegistration = null; if (eventRegistrations.TryRemove(unsubscribeEventData.CallbackId, out eventRegistration)) { serviceDispatcher.UnsubscribeEvent(unsubscribeEventData.ServiceName, eventRegistration); } }); Content = webView; SetBinding(UrlProperty, new Binding("Url")); SetBinding(HtmlProperty, new Binding("Html")); webView.NavigationCompleted += (s, e) => { if (webView.Source is UrlWebViewSource) { Url = e; } }; }
public void Unregister(EventRegistration <T> registration) { }
public int AddRegistration(EventRegistration er) { _context.EventRegistrations.Add(er); return(_context.SaveChanges()); }
public EventRegistration findEventRegistrationById(int eventRegistrationId) { EventRegistration er = _context.EventRegistrations.Where(er => er.Id == eventRegistrationId).Select(er => er).FirstOrDefault(); return(er); }
public void Update(string id, EventRegistration eventRegistrationIn) => _eventRegistrations.ReplaceOne(contact => contact.Id == id, eventRegistrationIn);
public void Remove(EventRegistration eventRegistrationIn) => _eventRegistrations.DeleteOne(eventRegistration => eventRegistration.Id == eventRegistrationIn.Id);
public EventRegistration Create(EventRegistration eventRegistration) { _eventRegistrations.InsertOne(eventRegistration); return(eventRegistration); }
public MessageDelivery(EventRegistration eventRegistration, ServerDomainMessage message) { _eventRegistration = eventRegistration; _message = message; }
private async Task <ServiceBusProcessor> GetProcessorAsync(EventRegistration ereg, EventConsumerRegistration creg, CancellationToken cancellationToken) { await processorsCacheLock.WaitAsync(cancellationToken); try { var topicName = ereg.EventName; var subscriptionName = creg.ConsumerName; var key = $"{topicName}/{subscriptionName}"; if (!processorsCache.TryGetValue(key, out var processor)) { // Create the processor options var sbpo = TransportOptions.CreateProcessorOptions?.Invoke() ?? new ServiceBusProcessorOptions(); // Maximum number of concurrent calls to the callback ProcessMessagesAsync(), set to 1 for simplicity. // Set it according to how many messages the application wants to process in parallel. sbpo.MaxConcurrentCalls = 1; // Indicates whether MessagePump should automatically complete the messages after returning from User Callback. // False below indicates the Complete will be handled by the User Callback as in `ProcessMessagesAsync` below. sbpo.AutoCompleteMessages = false; // Create the processor. Queues are used in the basic tier or when explicitly mapped to Queue. // Otherwise, Topics and Subscriptions are used. if (TransportOptions.UseBasicTier || ereg.UseQueueInsteadOfTopic()) { // Ensure Queue is created await CreateQueueIfNotExistsAsync(name : topicName, cancellationToken : cancellationToken); // Create the processor for the Queue Logger.LogDebug("Creating processor for queue '{QueueName}'", topicName); processor = serviceBusClient.CreateProcessor(queueName: topicName, options: sbpo); } else { // Ensure Topic is created before creating the Subscription await CreateTopicIfNotExistsAsync(name : topicName, cancellationToken : cancellationToken); // Ensure Subscription is created await CreateSubscriptionIfNotExistsAsync(topicName : topicName, subscriptionName : subscriptionName, cancellationToken : cancellationToken); // Create the processor for the Subscription Logger.LogDebug("Creating processor for topic '{TopicName}' and subscription '{Subscription}'", topicName, subscriptionName); processor = serviceBusClient.CreateProcessor(topicName: topicName, subscriptionName: subscriptionName, options: sbpo); } processorsCache[key] = processor; } return(processor); } finally { processorsCacheLock.Release(); } }
public EventRegistration Register(EventRegistration reg) { return(_eventRegistrationRepository.Register(reg)); }
public EventRegistration findEventRegistrationByUserIdAndEventId(int userId, int eventId) { EventRegistration er = _context.EventRegistrations.Where(er => er.UserId == userId && er.EventId == eventId).Select(er => er).FirstOrDefault(); return(er); }
public string fetchPrerequisites(int eventRegistrationId) { EventRegistration eventRegistration = _IEventRegistrationRepository.findEventRegistrationById(eventRegistrationId); return(eventRegistration.PreRequisite); }
public int UpdateEventRegistration(EventRegistration er) { _context.Entry(er).State = EntityState.Modified; return(_context.SaveChanges()); }
public InstructionInfo(EventRegistration eventRegistration, Instruction instruction, IList <Instruction> collection) { EventRegistration = eventRegistration; Instruction = instruction; Collection = collection; }
public static string PledgeCreateLink(this UrlHelper Url, EventRegistration receiver) { return Url.Action("Create", "Pledge", new { EventId = receiver.EventId, username = receiver.User.UserName }); }
/// <inheritdoc/> public override Task CancelAsync <TEvent>(string id, EventRegistration registration, CancellationToken cancellationToken = default) { throw new NotSupportedException("Kafka does not support canceling published events."); }
/// <inheritdoc/> public override Task CancelAsync <TEvent>(IList <string> ids, EventRegistration registration, CancellationToken cancellationToken = default) { throw new NotSupportedException("Amazon Kinesis does not support canceling published events."); }
public void Unregister(EventRegistration <T> registration) => unregisterWithDexterity(registration);
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='eventRegistration'> /// </param> public static void PutEventRegistration(this IEventRegistrations operations, int id, EventRegistration eventRegistration) { Task.Factory.StartNew(s => ((IEventRegistrations)s).PutEventRegistrationAsync(id, eventRegistration), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
public static EventRegistration UpdateRegistration(EventServiceConfiguration settings, EventRegistration registrationToUpdate) { using (var client = new HttpClient()) { client.BaseAddress = new Uri(settings.BaseUrl); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("api-version", "1.0"); var stringContent = new StringContent(JsonConvert.SerializeObject(registrationToUpdate), Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PutAsync(settings.ResourceRoot + "/registrations/" + registrationToUpdate.RegistrationId.ToString(), stringContent).Result; if (response.IsSuccessStatusCode) { string stringData = response.Content.ReadAsStringAsync().Result; return(JsonConvert.DeserializeObject <EventRegistration>(stringData)); } } return(null); }
/// <inheritdoc/> public override async Task <string> PublishAsync <TEvent>(EventContext <TEvent> @event, EventRegistration registration, DateTimeOffset?scheduled = null, CancellationToken cancellationToken = default) { using var scope = CreateScope(); using var ms = new MemoryStream(); await SerializeAsync(body : ms, @event : @event, registration : registration, scope : scope, cancellationToken : cancellationToken); var message = new ServiceBusMessage(ms.ToArray()) { MessageId = @event.Id, ContentType = @event.ContentType.ToString(), }; // If CorrelationId is present, set it if (@event.CorrelationId != null) { message.CorrelationId = @event.CorrelationId; } // If scheduled for later, set the value in the message if (scheduled != null && scheduled > DateTimeOffset.UtcNow) { message.ScheduledEnqueueTime = scheduled.Value.UtcDateTime; } // If expiry is set in the future, set the ttl in the message if (@event.Expires != null && @event.Expires > DateTimeOffset.UtcNow) { var ttl = @event.Expires.Value - DateTimeOffset.UtcNow; message.TimeToLive = ttl; } // Add custom properties message.ApplicationProperties.AddIfNotDefault(AttributeNames.RequestId, @event.RequestId) .AddIfNotDefault(AttributeNames.InitiatorId, @event.InitiatorId) .AddIfNotDefault(AttributeNames.ActivityId, Activity.Current?.Id); // Get the sender and send the message accordingly var sender = await GetSenderAsync(registration, cancellationToken); Logger.LogInformation("Sending {Id} to '{EntityPath}'. Scheduled: {Scheduled}", @event.Id, sender.EntityPath, scheduled); if (scheduled != null) { var seqNum = await sender.ScheduleMessageAsync(message : message, scheduledEnqueueTime : message.ScheduledEnqueueTime, cancellationToken : cancellationToken); return(seqNum.ToString()); // return the sequence number } else { await sender.SendMessageAsync(message, cancellationToken); return(null); // no sequence number available } }
/// <summary> /// Register user on the event /// </summary> /// <param name="event"></param> /// <param name="user"></param> /// <returns></returns> public async Task <EventRegistration> RegisterParticipantAsync(Event @event, ApplicationUser user) { var registration = EventRegistration.Create(@event, user);//, _registrationPolicy); return(await _eventRegistrationRepository.Insert(registration)); }
public EventRegistrationViewModel(EventRegistration registration) { WinsGoal = registration.WinsGoal; EventId = registration.EventId; }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> /// <param name='eventRegistration'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task PutEventRegistrationAsync(this IEventRegistrations operations, int id, EventRegistration eventRegistration, CancellationToken cancellationToken = default(CancellationToken)) { await operations.PutEventRegistrationWithHttpMessagesAsync(id, eventRegistration, null, cancellationToken).ConfigureAwait(false); }
public async Task <EventRegistration> CreateRegistration([Body] EventRegistration registration) { return(await _client.CreateRegistration(registration, token)); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='eventRegistration'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <EventRegistration> PostEventRegistrationAsync(this IEventRegistrations operations, EventRegistration eventRegistration, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PostEventRegistrationWithHttpMessagesAsync(eventRegistration, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public int UpdateEventRegistration(EventRegistration er) { return(_IEventRegistrationRepository.UpdateEventRegistration(er)); }
public EventRegistration fetchEventRegistrationById(int eventRegistrationId) { EventRegistration er = _IEventRegistrationRepository.findEventRegistrationById(eventRegistrationId); return(er); }
//RegisterForEvent public bool RegisterForEvent(long user_id, long event_id) { try { EventRegistration registration = GetEventRegistration(user_id, event_id); if (registration != null) return true; registration = new EventRegistration(); registration.Event_ID = event_id; registration.User_ID = user_id; dataContext.EventRegistrations.InsertOnSubmit(registration); SubmitChanges(); CacheRepository.Put(new DataCacheObject(DataCacheType.ACTIVITY, DataCacheRegions.EVENTREGISTRATIONS, "GETEVENTREGISTRATION", new object[] { user_id, event_id }, CachingExpirationTime.Days_01, registration)); } catch (Exception ex) { Logger.LogException("[user_id=" + user_id.ToString() + ";event_id=" + event_id.ToString() + "]", ex); return false; } return true; }