Beispiel #1
0
 public void addRegistrant(Registrant reg)
 {
     if (!Registrants.Contains(reg))
     {
         Registrants.Add(reg);
     }
 }
        public async Task <List <RegistrantsDto> > GetRegistrants(int id)
        {
            try
            {
                List <Registrants> registrants = new List <Registrants>();

                var regs = await db.u_registration.Where(x => x.course_portal_id == id).OrderBy(x => x.u_user.last_nm).ToListAsync();

                if (regs.Count > 0)
                {
                    foreach (var item in regs)
                    {
                        var newReg = new Registrants
                        {
                            UserId           = item.user_id,
                            FirstName        = item.u_user.first_nm,
                            LastName         = item.u_user.last_nm,
                            RegistrationDate = item.registration_dttm,
                            RegistrationId   = item.registration_id
                        };
                        registrants.Add(newReg);
                    }
                }
                return(Mapper.Map <List <Registrants>, List <RegistrantsDto> >(registrants));;
            }
            catch (Exception)
            {
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RegistrationInfo" /> class.
        /// </summary>
        /// <param name="registration">The registration.</param>
        /// <param name="rockContext">The rock context.</param>
        public RegistrationInfo(Registration registration, RockContext rockContext)
            : this()
        {
            if (registration != null)
            {
                RegistrationId = registration.Id;
                if (registration.PersonAlias != null && registration.PersonAlias.Person != null)
                {
                    FirstName         = registration.PersonAlias.Person.NickName;
                    LastName          = registration.PersonAlias.Person.LastName;
                    ConfirmationEmail = registration.ConfirmationEmail;
                }

                DiscountCode = registration.DiscountCode != null?registration.DiscountCode.Trim() : string.Empty;

                DiscountPercentage = registration.DiscountPercentage;
                DiscountAmount     = registration.DiscountAmount;
                TotalCost          = registration.TotalCost;
                DiscountedCost     = registration.DiscountedCost;

                if (registration.PersonAlias != null && registration.PersonAlias.Person != null)
                {
                    var family = registration.PersonAlias.Person.GetFamilies(rockContext).FirstOrDefault();
                    if (family != null)
                    {
                        FamilyGuid = family.Guid;
                    }
                }

                foreach (var registrant in registration.Registrants)
                {
                    Registrants.Add(new RegistrantInfo(registrant, rockContext));
                }
            }
        }
Beispiel #4
0
 public void RegisterForMessage(Registrant subscriber)
 {
     if (subscriber != null)
     {
         Registrants.Add(subscriber);
     }
 }
Beispiel #5
0
 public void AddSwimmer(Registrant aSwimmer)
 {
     if (Registrants.Contains(aSwimmer))
     {
         throw new Exception(string.Format("Swimmer {0},{1} is already entered", aSwimmer.Name, aSwimmer.Number));
     }
     Registrants.Add(aSwimmer);
 }
Beispiel #6
0
 /// <summary>
 /// Checks to see if the top of the queue has changed.
 /// </summary>
 /// <returns>true or false</returns>
 public bool TopChanged()
 {
     if (top != previousTop)
     {
         previousTop = top;
         top         = Registrants.Peek();
         return(true);
     }
     return(false);
 }
Beispiel #7
0
 public void RemoveRegistration(Registrant subscriber, PulsarMessage.MessageType messageType)
 {
     if (subscriber != null)
     {
         var registrantToRemove = Registrants.Find(reg => reg.Subscriber == subscriber && reg.Type == messageType);
         if (registrantToRemove != null)
         {
             Registrants.Remove(registrantToRemove);
         }
     }
 }
Beispiel #8
0
        public void removeRegistrant(Registrant reg)
        {
            if (reg != null && Registrants.Contains(reg))
            {
                Registrants.Remove(reg);
            }

            if (Registrants.Count < 2)
            {
                Registrants.Clear();
                DataManager.GroupManager.removeGroup(this, Division);
            }
        }
Beispiel #9
0
        public void EnterSwimmersTime(Registrant registrant, string swimTime)
        {
            Swimmer swimmer = registrant as Swimmer;

            if (Registrants.Contains(registrant))
            {
                int  locator           = Registrants.IndexOf(registrant);
                Swim correspondingSwim = Swims[locator] as Swim;
                correspondingSwim.SwimTime = swimTime;
                swimmer.AddAsBestTime(swimMeet.PoolType, Distance, Stroke, TimeSpan.Parse("00:" + swimTime));
                return;
            }
            throw new Exception("Swimmer has not entered event");
        }
Beispiel #10
0
 public void RegisterForMessage(Registrant subscriber)
 {
     if (subscriber != null)
     {
         try
         {
             Registrants.Add(subscriber);
         }
         catch (PulsarMessageException addRegistrantException)
         {
             addRegistrantException.Source  = "[MessageQueue:RegisterForMessage]";
             addRegistrantException.Message = "Unable to add subscriber to Registrant list.";
             throw addRegistrantException;
         }
     }
 }
        void Button_Click_1(object sender, RoutedEventArgs e)
        {
            BlurEffect effect = new BlurEffect {
                Radius = 20
            };

            MainGrid.Effect = effect;

            if (tb_FirstName.Text == "" && tb_secondname.Text == "" && tb_Phone.Text == "")
            {
                MessageBox.Show("Не все требуемые поля заполнены", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
            else
            {
                MessageBoxResult result = MessageBox.Show("Будет произведена регистрация водителя: " + tb_FirstName.Text + " " + tb_secondname.Text + " " + tb_Phone.Text, "Внимание!", MessageBoxButton.YesNo, MessageBoxImage.Question);
                if (result == MessageBoxResult.Yes)
                {
                    try
                    {
                        using (RegistrantEntities ef = new RegistrantEntities())
                        {
                            registrants = new Registrants
                            {
                                FirstName  = tb_FirstName.Text,
                                SecondName = tb_secondname.Text,
                                Phone      = tb_Phone.Text,
                                DateTime   = DateTime.Now,
                                Info       = $"{tb_info.Text}\n-----\n[I]{DateTime.Now} ({Registrant.Default.LastLogin}) создал карточку ({tb_secondname.Text} {tb_secondname.Text}, {tb_secondname.Text})"
                            };

                            ef.Registrants.Add(registrants);
                            ef.SaveChanges();
                            MessageBox.Show("Водитель зарегистрирован", "Готово", MessageBoxButton.OK, MessageBoxImage.Information);
                            tb_FirstName.Text = ""; tb_secondname.Text = ""; tb_Phone.Text = ""; tb_info.Text = "";
                            driver.LoadList();
                            Drivers.ItemsSource = driver.driverVs.ToList();
                        }
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Произошла ошибка при регистрации. Пожалуйста обратитесь к персоналу. Проверьте подключение к БД/интернет или еще что нибудь", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
            }

            MainGrid.Effect = null;
        }
Beispiel #12
0
 public void AddSwimmer(Registrant aRegistrant)
 {
     if (NumRegistrants == 0 || Registrants[NumRegistrants - 1] != aRegistrant)
     {
         if (aRegistrant.Club == null || aRegistrant.Club == this)
         {
             Registrants.Add(aRegistrant);
             NumRegistrants++;
             if (aRegistrant.Club == null)
             {
                 aRegistrant.Club = this;
             }
         }
         else
         {
             throw new Exception(string.Format("Swimmer already assigned to {0} club", aRegistrant.Club.Name));
         }
     }
 }
        /// <summary>
        /// Gets a summary of the registration
        /// </summary>
        /// <param name="registrationInstance">The registration instance.</param>
        /// <returns></returns>
        public string GetSummary(RegistrationInstance registrationInstance = null)
        {
            var result = new StringBuilder();

            result.Append("Event registration payment");

            var instance = registrationInstance ?? RegistrationInstance;

            if (instance != null)
            {
                result.AppendFormat(" for {0} [ID:{1}]", instance.Name, instance.Id);
                if (instance.RegistrationTemplate != null)
                {
                    result.AppendFormat(" (Template: {0} [ID:{1}])", instance.RegistrationTemplate.Name, instance.RegistrationTemplate.Id);
                }
            }

            string registrationPerson = PersonAlias != null && PersonAlias.Person != null ?
                                        PersonAlias.Person.FullName :
                                        string.Format("{0} {1}", FirstName, LastName);

            result.AppendFormat(
                @".
Registration By: {0} Total Cost/Fees:{1}
",
                registrationPerson,
                DiscountedCost.FormatAsCurrency());

            var registrantPersons = new List <string>();

            if (Registrants != null)
            {
                foreach (var registrant in Registrants.Where(r => r.PersonAlias != null && r.PersonAlias.Person != null))
                {
                    registrantPersons.Add($"{registrant.PersonAlias.Person.FullName} Cost/Fees:{registrant.DiscountedCost( DiscountPercentage, DiscountAmount ).FormatAsCurrency()}");
                }
            }

            result.AppendFormat("Registrants: {0}", registrantPersons.AsDelimited(", "));

            return(result.ToString());
        }
Beispiel #14
0
                                                                     
 public void AddSwimmer(Registrant swimmer) 

                                                                     {
                                                                         //if (Registrants[numOfRegistrants].RegistrationNumer == swimmer.RegistrationNumer)
                                                                         //{
                                                                         //    throw new Exception("Swimmer " + Registrants[numOfRegistrants].Name + " " + Registrants[numOfRegistrants].RegistrationNumer + "is already entered");
                                                                         //}
                                                                         //else
                                                                         //{
                                                                         //    registrants[numOfRegistrants++] = swimmer;

                                                                         //}
                                                                         if (Registrants.Contains(swimmer))
                                                                         {
                                                                             throw new Exception("Swimmer " + swimmer.Name + ", " + swimmer.RegistrationNumber + ", is already entered");
                                                                         }
                                                                         else
                                                                         {
                                                                             registrants[numOfRegistrants++] = swimmer;
                                                                         }
                                                                     }
Beispiel #15
0
 public void RemoveRegistration(Registrant subscriber, PulsarMessage.MessageType messageType)
 {
     if (subscriber != null)
     {
         var registrantToRemove = Registrants.Find(reg => reg.Subscriber == subscriber && reg.Type == messageType);
         if (registrantToRemove != null)
         {
             try
             {
                 Registrants.Remove(registrantToRemove);
             }
             catch (PulsarMessageException removeRegistrantException)
             {
                 removeRegistrantException.Source  = "[MessageQueue:RemoveRegistration]";
                 removeRegistrantException.Message = "Unable to remove subscriber from Registrant list";
                 throw removeRegistrantException;
             }
         }
     }
 }
Beispiel #16
0
 
 public void EnterSwimmersTime(Swimmer swimmer, string time) 

 {
     for (int i = 0; i < numOfRegistrants; i++)
     {
         if (Registrants[i].RegistrationNumber == swimmer.RegistrationNumber)
         {
             EventInfo[i].TimeSwam = time;
             swimmer.AddAsBestTime(swimMeet.type, stroke, distance, TimeSpan.ParseExact(time, @"mm\:ss\.ff", System.Globalization.CultureInfo.InvariantCulture));
         }
         else if (!Registrants.Contains(swimmer))
         {
             throw new Exception("Swimmer has not entered event");
         }
     }
 }
Beispiel #17
0
 /// <summary>
 /// Adds a registrant to the line
 /// </summary>
 /// <param name="reg">The registrant to be added</param>
 public void Enqueue(Registrant reg)
 {
     Registrants.Enqueue(reg);
     Count++;
 }
Beispiel #18
0
        private void ProcessMessages()
        {
            if (processing)
            {
                return;
            }

            //no need to carry on if there are no registrants
            if (Registrants.Count == 0)
            {
                processing = false;
                return;
            }

            processing = true;

            //to begin with, a little housekeeping, remove all messages marked for deletion in a previous pass
            //Odd issue where null messages appear - there shouldn't be any
            //using ToList ensures a copy is made and fixes issue where the queue is altered elsewhere (for example
            //by a new message being added to the queue on a different thread) - the copy is only accessible here
            foreach (PulsarMessage message in Queue.ToList())
            {
                if (message == null)
                {
                    try
                    {
                        Queue.Remove(message);
                    }
                    catch (PulsarMessageException removeMessageException)
                    {
                        Debug.Print("Not sure how I'm going to stop this error when processing the message queue to remove null messages\n" + removeMessageException.Message);
                        removeMessageException.Source  = "[MessageQueue:ProcessMessages]";
                        removeMessageException.Message = "Unable to remove message from the System Queue.";
                        throw removeMessageException;
                    }
                }
            }

            try
            {
                Queue.RemoveAll(message => message.MarkedForDeletion);
            }
            catch (PulsarMessageException removeAllMarkedMessagesException)
            {
                Debug.Print("Despite all my efforts, I still am getting null messages, which just SHOULDN'T happen!!!\n" + removeAllMarkedMessagesException.Message);
                removeAllMarkedMessagesException.Source  = "[MessageQueue:ProcessMessages]";
                removeAllMarkedMessagesException.Message = "Unable to remove messages marked for deletion.";
                throw removeAllMarkedMessagesException;
            }

            //add any pending messages to the queue
            if (_pendingMessages.Count > 0)
            {
                //Remove nulls, if any
                _pendingMessages.RemoveAll(nulls => nulls == null);

                try
                {
                    Queue.AddRange(_pendingMessages);
                }
                catch (PulsarMessageException addRangeMessageException)
                {
                    Debug.Print("MessageQueue.ProcessMessages - " + addRangeMessageException.Message);
                }
                _pendingMessages.Clear();
            }

            //if there are no current messages to process
            if (Queue.Count == 0)
            {
                processing = false;
                return;
            }

            //ok, we have messages and registrants so process the queue
            foreach (PulsarMessage message in Queue)
            {
                if (message != null)
                {
                    if (message.HasDependencies)
                    {
                        bool passesDependencyCheck = PerformDependencyCheck(message.Dependencies);
                        //leave message till next pass if dependency doesn't have the correct value
                        if (!passesDependencyCheck)
                        {
                            continue;
                        }
                    }
                    //determine the registrants that are subscribed to this message type
                    var subscribed = Registrants.FindAll(item => item.Type == message.Type);
                    if (subscribed != null)
                    {
                        if (subscribed.Count > 0)
                        {
                            foreach (Registrant registrant in subscribed)
                            {
                                registrant.Subscriber.CallBack(message);
                            }
                        }
                    }

                    //decide what to do now with the message now it has been sent
                    DetermineMessageViability(message);
                }
            }
            processing = false;
        }
Beispiel #19
0
 /// <summary>
 /// Removes the Registrant from the front of the line
 /// </summary>
 public void Dequeue()
 {
     Registrants.Dequeue();
     Count--;
 }
Beispiel #20
0
 /// <summary>
 /// Peeks this instance.
 /// </summary>
 /// <returns>Registrants.Peek()</returns>
 public Registrant Peek()
 {
     return(Registrants.Peek());
 }