Ejemplo n.º 1
0
 /// <summary>
 /// Sets the current voter
 /// </summary>
 /// <param name="voter">The voter to be set</param>
 private void SetVoter(Person voter)
 {
     if (voter == null)
     {
         MessageBox.Show("No network connection");
     }
     else if (!voter.Exists)
     {
         MessageBox.Show("No voter found matching this criteria");
     }
     else
     {
         this.currentVoter = voter;
         this.mainForm.RegisterButton.Enabled   = true;
         this.mainForm.UnregisterButton.Enabled = true;
         this.mainForm.ClearButton.Enabled      = true;
         this.mainForm.ID.Text        = voter.VoterId.ToString();
         this.mainForm.FirstName.Text = voter.FirstName;
         this.mainForm.LastName.Text  = voter.LastName;
         this.mainForm.Cpr.Text       = voter.Cpr.ToString();
         this.mainForm.Voted.Text     = voter.Voted.ToString();
         if (voter.Voted)
         {
             this.mainForm.Table.Text = voter.VotedPollingTable;
             DateTime time = TimeConverter.ConvertFromUnixTimestamp(voter.VotedTime);
             this.mainForm.Time.Text = time.ToLocalTime().Hour.ToString() + ":" + time.ToLocalTime().Minute.ToString();
         }
         else
         {
             this.mainForm.Table.Text = string.Empty;
             this.mainForm.Time.Text  = string.Empty;
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Represent instance as a string.
 /// </summary>
 /// <returns>The current person instance represented as a string.</returns>
 public override string ToString()
 {
     return(DbId + "," + Cpr + "," + FirstName + "," + LastName + ", " + PollingTable + ", " + TimeConverter.ConvertFromUnixTimestamp(VotedTime) + ", " + Voted);
 }