コード例 #1
0
        public async Task <ActionResult <Fingerprint> > PostFingerprint([FromBody] FPforSend fingerprint)
        {
            byte[]         arr       = fingerprint.FingerImage;
            bool[][]       array     = OperationsWithImage.ImgOperations(arr);
            MinutionsIssue minutions = new MinutionsIssue();

            minutions.SearchMinutions(array);
            int[,] minutiaArr = minutions.GeneralPoints;

            int[] qq      = MinutionsIssue.Make1DArray(minutiaArr, 338, 248);
            int   qqscore = 0;

            for (int i = 0; i < qq.Length; i++)
            {
                if (qq[i] != 0)
                {
                    qqscore++;
                }
            }
            byte[] minutiaB = MinutionsIssue.IntToByteArr(qq);
            // int[] aa = MinutionsIssue.ByteToIntArray(minutiaB);
            Fingerprint fingerprintForADD = new Fingerprint
            {
                FingerImage = arr,
                Minutions   = minutiaB,
                EmploeeId   = fingerprint.EmploeeId
            };

            db.Fingerprints.Add(fingerprintForADD);
            await db.SaveChangesAsync();

            return(CreatedAtAction(nameof(GetFingerprint), new { id = fingerprint.Id }, fingerprint));
        }
コード例 #2
0
        public static async Task <Uri> CreateD(FPforSend Fingerprint, HttpClient client)
        {
            HttpResponseMessage response = await client.PostAsJsonAsync("api/Fingerprint", Fingerprint);

            response.EnsureSuccessStatusCode();
            return(response.Headers.Location);
        }
コード例 #3
0
        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("Заполнены не все поля");
            }
        }
コード例 #4
0
        public static async Task <FPforSend> UpdateDuty(FPforSend Fingerprint, HttpClient client)
        {
            HttpResponseMessage response = await client.PutAsJsonAsync($"api/Fingerprint/{Fingerprint.Id}", Fingerprint);

            response.EnsureSuccessStatusCode();
            Fingerprint = await response.Content.ReadAsAsync <FPforSend>();

            return(Fingerprint);
        }
コード例 #5
0
 public static async Task Redact(FPforSend duty, HttpClient client)
 {
     await UpdateDuty(duty, client);
 }
コード例 #6
0
 public static async Task Add(FPforSend duty, HttpClient client)
 {
     await OpFingerprints.CreateD(duty, client);
 }