private async Task DelEmploee() { await OpEmploee.DeleteDuty(ID, client); dataGridView1.Rows.Clear(); await GetEmploees(client); }
private async Task addEmploe() { if (FingePrintTB.Text != "" && LastNameTB.Text != "" && FirstNameTB.Text != "" && FatherNameTB.Text != "" && PositionTB.Text != "" && SubdivisionCB.Text != "" && BirthdateDT.Text != "") { string filename = FingePrintTB.Text; byte[] array = ImageToByteArray(Image.FromFile(filename)); Emploee emploee = new Emploee { LastName = LastNameTB.Text, FirstName = FirstNameTB.Text, FatherName = FatherNameTB.Text, Position = PositionTB.Text, subvision = SubdivisionCB.Text, Birthdate = BirthdateDT.Value, }; Emploee emp = await OpEmploee.CreateD(emploee, client); dataGridView1.Rows.Clear(); GetEmploees(client).GetAwaiter(); FPforSend fingerprint = new FPforSend { FingerImage = array, EmploeeId = emp.Id }; await OpFingerprints.Add(fingerprint, client); } else { MessageBox.Show("Заполнены не все поля"); } }
private async Task Search() { if (textBox1.Text != null) { listBox1.Items.Clear(); listBox2.Items.Clear(); listBox3.Items.Clear(); string filename = textBox1.Text; pictureBox4.Image = Image.FromFile(filename); byte[] array = ImageToByteArray(Image.FromFile(filename)); List <MyDictionary> dic = await OpRecognition.CreateD(array, client); pictureBox1.Image = ByteToImage(dic[0].fingerprint.FingerImage); pictureBox2.Image = ByteToImage(dic[1].fingerprint.FingerImage); pictureBox3.Image = ByteToImage(dic[2].fingerprint.FingerImage); List <Emploee> emploees = await OpEmploee.GetD(client); List <Emploee> forRes = new List <Emploee>(); for (int i = 0; i < 3; i++) { var searchVar = dic[i].fingerprint.EmploeeId; var emp = emploees.FirstOrDefault(x => x.Id == searchVar); forRes.Add(emp); } listBox1.Items.Add("ФИО: " + forRes[0].LastName + " " + forRes[0].FirstName + " " + forRes[0].FatherName); listBox1.Items.Add("Отдел: " + forRes[0].subvision); listBox1.Items.Add("Должность: " + forRes[0].Position); listBox2.Items.Add("ФИО: " + forRes[1].LastName + " " + forRes[1].FirstName + " " + forRes[1].FatherName); listBox2.Items.Add("Отдел: " + forRes[1].subvision); listBox2.Items.Add("Должность: " + forRes[1].Position); listBox3.Items.Add("ФИО: " + forRes[2].LastName + " " + forRes[2].FirstName + " " + forRes[2].FatherName); listBox3.Items.Add("Отдел: " + forRes[2].subvision); listBox3.Items.Add("Должность: " + forRes[2].Position); labelBest1.BackColor = Color.Transparent; label2.BackColor = Color.Transparent; label3.BackColor = Color.Transparent; labelBest1.Text = Math.Round(dic[0].score, 2).ToString() + "%"; label2.Text = Math.Round(dic[1].score, 2).ToString() + "%"; label3.Text = Math.Round(dic[2].score, 2).ToString() + "%"; } else { MessageBox.Show("Выберите отпечаток для идентификации"); } }
private async Task GetEmploees(HttpClient client) { try { List <Emploee> emploees = await OpEmploee.GetD(client); int rowNum = 0; foreach (var item in emploees) { dataGridView1.Rows.Add(); dataGridView1.Rows[rowNum].Cells[0].Value = item.Id; dataGridView1.Rows[rowNum].Cells[1].Value = item.FirstName; dataGridView1.Rows[rowNum].Cells[2].Value = item.LastName; dataGridView1.Rows[rowNum].Cells[3].Value = item.FatherName; dataGridView1.Rows[rowNum].Cells[4].Value = item.Position; dataGridView1.Rows[rowNum].Cells[5].Value = item.Birthdate.ToShortDateString(); dataGridView1.Rows[rowNum].Cells[6].Value = item.subvision; rowNum++; } } catch (Exception) { }; }