예제 #1
0
 private void ButtonAdd_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textboxName.Text))
     {
         MessageBox.Show("Please input name", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     else
     {
         List <Destination> destinations   = new List <Destination>(PartialDB.GetDestinations());
         Destination        oldDestination = destinations.FirstOrDefault(item => item.Name.Equals(textboxName.Text));
         if (oldDestination != null)
         {
             MessageBox.Show("Destination name already added", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
         else
         {
             Destination destination = new Destination(textboxName.Text);
             PartialDB.SetDestination(destination);
             MessageBox.Show("Destination successfully added", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Close();
         }
     }
     textboxName.Select();
 }
예제 #2
0
 public AnswerKeyItem90()
 {
     InitializeComponent();
     assessment = PartialDB.GetAssessment(AssessmentType.Item90);
     comboBoxSet.SelectedIndex      = 0;
     numericUpDownPassingRate.Value = (decimal)assessment.PassingRate;
 }
예제 #3
0
 public OldVisitor()
 {
     InitializeComponent();
     foreach (Destination destination in PartialDB.GetDestinations())
     {
         comboBoxDestination.Items.Add(destination.Name);
     }
     comboBoxDestination.SelectedIndex = 0;
     StartCamera();
     StartBiometric();
     ML.FaceRecognition.OnFaceRecognized = label =>
     {
         User user = users.FirstOrDefault(item => item.Id.Equals(label));
         if (user != null)
         {
             Invoke(new MethodInvoker(delegate
             {
                 if (userName.Equals(user.Name) || string.IsNullOrEmpty(userName))
                 {
                     labelGreetings.Text   = "Welcome," + Environment.NewLine + user.Name + "!";
                     userName              = user.Name;
                     panelOverride.Visible = false;
                 }
                 else
                 {
                     labelOverride.Text    = "New user detected: " + user.Name;
                     userNameOverride      = user.Name;
                     panelOverride.Visible = true;
                 }
             }));
         }
     };
     ML.FaceRecognition.ShowLabel = false;
 }
예제 #4
0
 private void ButtonRegister_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textboxName.Text))
     {
         MessageBox.Show("Please input name", "No Name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (string.IsNullOrEmpty(textboxContactNumber.Text))
     {
         MessageBox.Show("Please input contact number", "No Contact Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (!long.TryParse(textboxContactNumber.Text, out long contNum))
     {
         MessageBox.Show("Please input valid contact number", "Invalid Contact Number", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (comboBoxGender.SelectedIndex == 0)
     {
         MessageBox.Show("Please select gender", "No Name", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (comboBoxDestination.SelectedIndex == 0)
     {
         MessageBox.Show("Please select destination", "No Destination", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (capturedImages.Count < 3)
     {
         MessageBox.Show("Please take picture", "Incomplete Picture", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (leftId == -1)
     {
         MessageBox.Show("Please scan left fingerprint", "No Left Fingerprint", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (rightId == -1)
     {
         MessageBox.Show("Please scan right fingerprint", "No Right Fingerprint", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         Destination destination = PartialDB.GetDestinations().FirstOrDefault(
             item => item.Name.Equals((string)comboBoxDestination.SelectedItem));
         if (destination != null)
         {
             destination.VisitCount++;
             PartialDB.SetDestination(destination);
             PartialDB.AddHistory(new History(textboxName.Text, destination.Name, DateTime.Now));
         }
         foreach (var img in capturedImages)
         {
             ML.FaceRecognition.AddDataset(img, nextId.ToString());
         }
         PartialDB.SetUser(new User(
                               nextId,
                               textboxName.Text,
                               (string)comboBoxGender.SelectedItem,
                               Convert.ToInt64(textboxContactNumber.Text),
                               leftId,
                               rightId));
         MessageBox.Show("User registered successfully", "Registered", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Close();
     }
 }
예제 #5
0
 public AdminHistory()
 {
     InitializeComponent();
     foreach (History hist in PartialDB.GetHistory())
     {
         dataGridView.Rows.Add(hist.UserName, hist.Destination, hist.DateTime.ToString("MM/dd/yyyy HH:mm:ss"));
     }
 }
예제 #6
0
 public AdminDashboard()
 {
     InitializeComponent();
     foreach (Destination destination in PartialDB.GetDestinations())
     {
         dataGridView.Rows.Add(destination.Name, destination.VisitCount.ToString());
     }
 }
예제 #7
0
 private void ButtonAdd_Click(object sender, EventArgs e)
 {
     new AdminAddDest().ShowDialog();
     dataGridView.Rows.Clear();
     foreach (Destination destination in PartialDB.GetDestinations())
     {
         dataGridView.Rows.Add(destination.Name, destination.VisitCount.ToString());
     }
 }
예제 #8
0
 private void ButtonClear_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure to clear history?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         PartialDB.ClearHistory();
         dataGridView.Rows.Clear();
         foreach (History hist in PartialDB.GetHistory())
         {
             dataGridView.Rows.Add(hist.UserName, hist.Destination, hist.DateTime.ToString("MM/dd/yyyy HH:mm:ss"));
         }
     }
 }
예제 #9
0
 private void ButtonClearData_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure to clear data?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         PartialDB.ClearData();
         dataGridView.Rows.Clear();
         foreach (Destination destination in PartialDB.GetDestinations())
         {
             dataGridView.Rows.Add(destination.Name, destination.VisitCount.ToString());
         }
     }
 }
예제 #10
0
 public NewVisitor()
 {
     InitializeComponent();
     foreach (Destination destination in PartialDB.GetDestinations())
     {
         comboBoxDestination.Items.Add(destination.Name);
     }
     comboBoxGender.SelectedIndex      = 0;
     comboBoxDestination.SelectedIndex = 0;
     StartCamera();
     labelIndicator.Text          = "Face straight to the camera (0/3)";
     ML.FaceRecognition.ShowLabel = false;
 }
예제 #11
0
        private void ButtonScanBioRight_Click(object sender, EventArgs e)
        {
            if (leftId == -1)
            {
                labelFingerLeft.Text      = "Left fingerprint not scanned";
                labelFingerLeft.ForeColor = Color.DarkGray;
            }
            rightId = -1;
            int id = PartialDB.GetNextRightFingerprintId();

            labelFingerRight.Text      = "Right fingerprint waiting to scan";
            labelFingerRight.ForeColor = Color.DarkGray;
            Biometric.Set(id,
                          delegate
            {
                Invoke(new MethodInvoker(delegate
                {
                    labelFingerRight.Text      = "Remove right finger";
                    labelFingerRight.ForeColor = Color.DarkGray;
                }));
            },
                          delegate
            {
                Invoke(new MethodInvoker(delegate
                {
                    labelFingerRight.Text      = "Place right finger again to confirm";
                    labelFingerRight.ForeColor = Color.DarkGray;
                }));
            },
                          delegate
            {
                rightId = id;
                Invoke(new MethodInvoker(delegate
                {
                    labelFingerRight.Text      = "Right fingerprint scanned";
                    labelFingerRight.ForeColor = Color.Green;
                }));
            },
                          delegate
            {
                Invoke(new MethodInvoker(delegate
                {
                    labelFingerRight.Text      = "Right fingerprint scan failed";
                    labelFingerRight.ForeColor = Color.DarkGray;
                }));
            });
        }
예제 #12
0
 private void ButtonRemove_Click(object sender, EventArgs e)
 {
     if (dataGridView.SelectedCells.Count > 0)
     {
         int             selectedrowindex = dataGridView.SelectedCells[0].RowIndex;
         DataGridViewRow selectedRow      = dataGridView.Rows[selectedrowindex];
         string          name             = Convert.ToString(selectedRow.Cells[0].Value);
         if (MessageBox.Show("Are you sure to remove destination \"" + name + "\"?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
         {
             PartialDB.DeleteDestination(name);
             dataGridView.Rows.Clear();
             foreach (Destination destination in PartialDB.GetDestinations())
             {
                 dataGridView.Rows.Add(destination.Name, destination.VisitCount.ToString());
             }
         }
     }
 }
예제 #13
0
파일: Admin.cs 프로젝트: Kiryuumaru/VMS
 private void ButtonLogin_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(textboxPassword.Text))
     {
         MessageBox.Show("Please enter password", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         textboxPassword.Text = "";
         textboxPassword.Select();
     }
     else if (!PartialDB.TryPassword(textboxPassword.Text))
     {
         MessageBox.Show("Please enter correct password", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         textboxPassword.Text = "";
         textboxPassword.Select();
     }
     else
     {
         new AdminDashboard().ShowDialog();
         Close();
     }
 }
예제 #14
0
 private void ButtonLogin_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(userName))
     {
         MessageBox.Show("No recognized user", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else if (comboBoxDestination.SelectedIndex == 0)
     {
         MessageBox.Show("Please select destination", "No Destination", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
     }
     else
     {
         Destination destination = PartialDB.GetDestinations().FirstOrDefault(
             item => item.Name.Equals((string)comboBoxDestination.SelectedItem));
         if (destination != null)
         {
             destination.VisitCount++;
             PartialDB.SetDestination(destination);
             PartialDB.AddHistory(new History(userName, destination.Name, DateTime.Now));
         }
         MessageBox.Show("Successfully logged in", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
         Close();
     }
 }
예제 #15
0
 private void ButtonSave_Click(object sender, EventArgs e)
 {
     if (assessmentSet == AssessmentSet.SetB)
     {
         assessment.SetBEnabled = checkBoxEnabled.Checked;
     }
     else if (assessmentSet == AssessmentSet.SetC)
     {
         assessment.SetCEnabled = checkBoxEnabled.Checked;
     }
     AssessmentItem[] assessmentItems = Assessment.CreateItems(assessment.AssessmentType);
     assessmentItems[0]  = new AssessmentItem(keyHolder1.Get());
     assessmentItems[1]  = new AssessmentItem(keyHolder2.Get());
     assessmentItems[2]  = new AssessmentItem(keyHolder3.Get());
     assessmentItems[3]  = new AssessmentItem(keyHolder4.Get());
     assessmentItems[4]  = new AssessmentItem(keyHolder5.Get());
     assessmentItems[5]  = new AssessmentItem(keyHolder6.Get());
     assessmentItems[6]  = new AssessmentItem(keyHolder7.Get());
     assessmentItems[7]  = new AssessmentItem(keyHolder8.Get());
     assessmentItems[8]  = new AssessmentItem(keyHolder9.Get());
     assessmentItems[9]  = new AssessmentItem(keyHolder10.Get());
     assessmentItems[10] = new AssessmentItem(keyHolder11.Get());
     assessmentItems[11] = new AssessmentItem(keyHolder12.Get());
     assessmentItems[12] = new AssessmentItem(keyHolder13.Get());
     assessmentItems[13] = new AssessmentItem(keyHolder14.Get());
     assessmentItems[14] = new AssessmentItem(keyHolder15.Get());
     assessmentItems[15] = new AssessmentItem(keyHolder16.Get());
     assessmentItems[16] = new AssessmentItem(keyHolder17.Get());
     assessmentItems[17] = new AssessmentItem(keyHolder18.Get());
     assessmentItems[18] = new AssessmentItem(keyHolder19.Get());
     assessmentItems[19] = new AssessmentItem(keyHolder20.Get());
     assessmentItems[20] = new AssessmentItem(keyHolder21.Get());
     assessmentItems[21] = new AssessmentItem(keyHolder22.Get());
     assessmentItems[22] = new AssessmentItem(keyHolder23.Get());
     assessmentItems[23] = new AssessmentItem(keyHolder24.Get());
     assessmentItems[24] = new AssessmentItem(keyHolder25.Get());
     assessmentItems[25] = new AssessmentItem(keyHolder26.Get());
     assessmentItems[26] = new AssessmentItem(keyHolder27.Get());
     assessmentItems[27] = new AssessmentItem(keyHolder28.Get());
     assessmentItems[28] = new AssessmentItem(keyHolder29.Get());
     assessmentItems[29] = new AssessmentItem(keyHolder30.Get());
     assessmentItems[30] = new AssessmentItem(keyHolder31.Get());
     assessmentItems[31] = new AssessmentItem(keyHolder32.Get());
     assessmentItems[32] = new AssessmentItem(keyHolder33.Get());
     assessmentItems[33] = new AssessmentItem(keyHolder34.Get());
     assessmentItems[34] = new AssessmentItem(keyHolder35.Get());
     assessmentItems[35] = new AssessmentItem(keyHolder36.Get());
     assessmentItems[36] = new AssessmentItem(keyHolder37.Get());
     assessmentItems[37] = new AssessmentItem(keyHolder38.Get());
     assessmentItems[38] = new AssessmentItem(keyHolder39.Get());
     assessmentItems[39] = new AssessmentItem(keyHolder40.Get());
     assessmentItems[40] = new AssessmentItem(keyHolder41.Get());
     assessmentItems[41] = new AssessmentItem(keyHolder42.Get());
     assessmentItems[42] = new AssessmentItem(keyHolder43.Get());
     assessmentItems[43] = new AssessmentItem(keyHolder44.Get());
     assessmentItems[44] = new AssessmentItem(keyHolder45.Get());
     assessmentItems[45] = new AssessmentItem(keyHolder46.Get());
     assessmentItems[46] = new AssessmentItem(keyHolder47.Get());
     assessmentItems[47] = new AssessmentItem(keyHolder48.Get());
     assessmentItems[48] = new AssessmentItem(keyHolder49.Get());
     assessmentItems[49] = new AssessmentItem(keyHolder50.Get());
     assessmentItems[50] = new AssessmentItem(keyHolder51.Get());
     assessmentItems[51] = new AssessmentItem(keyHolder52.Get());
     assessmentItems[52] = new AssessmentItem(keyHolder53.Get());
     assessmentItems[53] = new AssessmentItem(keyHolder54.Get());
     assessmentItems[54] = new AssessmentItem(keyHolder55.Get());
     assessmentItems[55] = new AssessmentItem(keyHolder56.Get());
     assessmentItems[56] = new AssessmentItem(keyHolder57.Get());
     assessmentItems[57] = new AssessmentItem(keyHolder58.Get());
     assessmentItems[58] = new AssessmentItem(keyHolder59.Get());
     assessmentItems[59] = new AssessmentItem(keyHolder60.Get());
     assessmentItems[60] = new AssessmentItem(keyHolder61.Get());
     assessmentItems[61] = new AssessmentItem(keyHolder62.Get());
     assessmentItems[62] = new AssessmentItem(keyHolder63.Get());
     assessmentItems[63] = new AssessmentItem(keyHolder64.Get());
     assessmentItems[64] = new AssessmentItem(keyHolder65.Get());
     assessmentItems[65] = new AssessmentItem(keyHolder66.Get());
     assessmentItems[66] = new AssessmentItem(keyHolder67.Get());
     assessmentItems[67] = new AssessmentItem(keyHolder68.Get());
     assessmentItems[68] = new AssessmentItem(keyHolder69.Get());
     assessmentItems[69] = new AssessmentItem(keyHolder70.Get());
     assessmentItems[70] = new AssessmentItem(keyHolder71.Get());
     assessmentItems[71] = new AssessmentItem(keyHolder72.Get());
     assessmentItems[72] = new AssessmentItem(keyHolder73.Get());
     assessmentItems[73] = new AssessmentItem(keyHolder74.Get());
     assessmentItems[74] = new AssessmentItem(keyHolder75.Get());
     assessmentItems[75] = new AssessmentItem(keyHolder76.Get());
     assessmentItems[76] = new AssessmentItem(keyHolder77.Get());
     assessmentItems[77] = new AssessmentItem(keyHolder78.Get());
     assessmentItems[78] = new AssessmentItem(keyHolder79.Get());
     assessmentItems[79] = new AssessmentItem(keyHolder80.Get());
     assessmentItems[80] = new AssessmentItem(keyHolder81.Get());
     assessmentItems[81] = new AssessmentItem(keyHolder82.Get());
     assessmentItems[82] = new AssessmentItem(keyHolder83.Get());
     assessmentItems[83] = new AssessmentItem(keyHolder84.Get());
     assessmentItems[84] = new AssessmentItem(keyHolder85.Get());
     assessmentItems[85] = new AssessmentItem(keyHolder86.Get());
     assessmentItems[86] = new AssessmentItem(keyHolder87.Get());
     assessmentItems[87] = new AssessmentItem(keyHolder88.Get());
     assessmentItems[88] = new AssessmentItem(keyHolder89.Get());
     assessmentItems[89] = new AssessmentItem(keyHolder90.Get());
     assessment.SetItems(assessmentItems, assessmentSet);
     assessment.PassingRate = (double)numericUpDownPassingRate.Value;
     PartialDB.SetAssessment(assessment);
     MessageBox.Show("Answer key save successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }
예제 #16
0
 private void ButtonSave_Click(object sender, EventArgs e)
 {
     if (assessmentSet == AssessmentSet.SetB)
     {
         assessment.SetBEnabled = checkBoxEnabled.Checked;
     }
     else if (assessmentSet == AssessmentSet.SetC)
     {
         assessment.SetCEnabled = checkBoxEnabled.Checked;
     }
     AssessmentItem[] assessmentItems = Assessment.CreateItems(assessment.AssessmentType);
     assessmentItems[0]  = new AssessmentItem(keyHolder1.Get());
     assessmentItems[1]  = new AssessmentItem(keyHolder2.Get());
     assessmentItems[2]  = new AssessmentItem(keyHolder3.Get());
     assessmentItems[3]  = new AssessmentItem(keyHolder4.Get());
     assessmentItems[4]  = new AssessmentItem(keyHolder5.Get());
     assessmentItems[5]  = new AssessmentItem(keyHolder6.Get());
     assessmentItems[6]  = new AssessmentItem(keyHolder7.Get());
     assessmentItems[7]  = new AssessmentItem(keyHolder8.Get());
     assessmentItems[8]  = new AssessmentItem(keyHolder9.Get());
     assessmentItems[9]  = new AssessmentItem(keyHolder10.Get());
     assessmentItems[10] = new AssessmentItem(keyHolder11.Get());
     assessmentItems[11] = new AssessmentItem(keyHolder12.Get());
     assessmentItems[12] = new AssessmentItem(keyHolder13.Get());
     assessmentItems[13] = new AssessmentItem(keyHolder14.Get());
     assessmentItems[14] = new AssessmentItem(keyHolder15.Get());
     assessmentItems[15] = new AssessmentItem(keyHolder16.Get());
     assessmentItems[16] = new AssessmentItem(keyHolder17.Get());
     assessmentItems[17] = new AssessmentItem(keyHolder18.Get());
     assessmentItems[18] = new AssessmentItem(keyHolder19.Get());
     assessmentItems[19] = new AssessmentItem(keyHolder20.Get());
     assessmentItems[20] = new AssessmentItem(keyHolder21.Get());
     assessmentItems[21] = new AssessmentItem(keyHolder22.Get());
     assessmentItems[22] = new AssessmentItem(keyHolder23.Get());
     assessmentItems[23] = new AssessmentItem(keyHolder24.Get());
     assessmentItems[24] = new AssessmentItem(keyHolder25.Get());
     assessmentItems[25] = new AssessmentItem(keyHolder26.Get());
     assessmentItems[26] = new AssessmentItem(keyHolder27.Get());
     assessmentItems[27] = new AssessmentItem(keyHolder28.Get());
     assessmentItems[28] = new AssessmentItem(keyHolder29.Get());
     assessmentItems[29] = new AssessmentItem(keyHolder30.Get());
     assessmentItems[30] = new AssessmentItem(keyHolder31.Get());
     assessmentItems[31] = new AssessmentItem(keyHolder32.Get());
     assessmentItems[32] = new AssessmentItem(keyHolder33.Get());
     assessmentItems[33] = new AssessmentItem(keyHolder34.Get());
     assessmentItems[34] = new AssessmentItem(keyHolder35.Get());
     assessmentItems[35] = new AssessmentItem(keyHolder36.Get());
     assessmentItems[36] = new AssessmentItem(keyHolder37.Get());
     assessmentItems[37] = new AssessmentItem(keyHolder38.Get());
     assessmentItems[38] = new AssessmentItem(keyHolder39.Get());
     assessmentItems[39] = new AssessmentItem(keyHolder40.Get());
     assessmentItems[40] = new AssessmentItem(keyHolder41.Get());
     assessmentItems[41] = new AssessmentItem(keyHolder42.Get());
     assessmentItems[42] = new AssessmentItem(keyHolder43.Get());
     assessmentItems[43] = new AssessmentItem(keyHolder44.Get());
     assessmentItems[44] = new AssessmentItem(keyHolder45.Get());
     assessmentItems[45] = new AssessmentItem(keyHolder46.Get());
     assessmentItems[46] = new AssessmentItem(keyHolder47.Get());
     assessmentItems[47] = new AssessmentItem(keyHolder48.Get());
     assessmentItems[48] = new AssessmentItem(keyHolder49.Get());
     assessmentItems[49] = new AssessmentItem(keyHolder50.Get());
     assessment.SetItems(assessmentItems, assessmentSet);
     assessment.PassingRate = (double)numericUpDownPassingRate.Value;
     PartialDB.SetAssessment(assessment);
     MessageBox.Show("Answer key save successfully", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
 }