Example #1
0
    private void CheckForValidatedConnections(Object sender, EventArgs e)
    {
        Collection <ValidatedPatientConnection> connectionList = HVHelper.GetValidatedConnectionsInPastDays(0);

        using (var db = new ParticipantContext())
        {
            try {
                foreach (ValidatedPatientConnection connection in connectionList)
                {
                    Guid        participantId = Guid.Parse(connection.ApplicationPatientId);
                    Participant participant   = db.Participants.Find(participantId);
                    if (participant.HasAuthorised)
                    {
                        continue;
                    }
                    participant.HasAuthorised = true;
                    participant.PersonId      = connection.PersonId;
                    participant.RecordId      = connection.RecordId;
                    db.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("ERROR: Unable to update Participants information: " + ex.Message.ToString(), ex);
            }
        }
    }
 internal void AddWinnerToDatabase(Participant participant)
 {
     if (participant.Id == 0)
     {
         context.PokerWinners.Add(new PokerWinners
         {
             Name            = participant.Name,
             ShortHandSyntax = participant.Hand.ShortHandSyntax,
             HandDescription = participant.Hand.HandDescription,
             Date            = DateTime.Now
         });
         context.SaveChanges();
     }
 }
Example #3
0
    void SubmitForm(Object sender, EventArgs e)
    {
        string name     = NameTextBox.Text;
        string question = QuestionTextBox.Text;
        string answer   = AnswerTextBox.Text;

        Guid id = Guid.NewGuid();

        string code = HVHelper.CreateParticipantIdentityCode(name, question, answer, id.ToString());

        CodeTextBox.Text = code;

        Participant participant = new Participant
        {
            ParticipantId      = id,
            ParticipantName    = name,
            TimeTokenGenerated = DateTime.Now,
            ParticipantCode    = code,
            SecurityQuestion   = question,
            SecurityAnswer     = answer,
            HasAuthorised      = false,
            PersonId           = null,
            RecordId           = null
        };

        using (var db = new ParticipantContext())
        {
            try
            {
                db.Participants.Add(participant);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                throw new Exception("ERROR: Unable to save a new Participant: " + ex.Message.ToString(), ex);
            }
        }
    }