Example #1
0
        public IHttpActionResult Delete([FromUri] EMPLEADO emp)
        {
            using (CICAMEntities entities = new CICAMEntities())
            {
                EMPLEADO empAnt = new EMPLEADO();
                empAnt = entities.EMPLEADO.Where(iid => iid.ID == emp.ID).FirstOrDefault();
                entities.Entry(empAnt).State = System.Data.Entity.EntityState.Deleted;
                entities.SaveChanges();
            }

            return(Ok(new { StatusCode = 200, message = "Empleado eliminado exitosamente" }));
        }
Example #2
0
        public string POST([FromUri] EMPLEADO emp)
        {
            //INICIANDO DISPOSITIVO
            zkfp2.Init();
            mDevHandle = zkfp2.OpenDevice(0);

            //CREANDO VECTOR QUE GUARDA HUELLA
            zkfp2.GetParameters(mDevHandle, 1, paramValue, ref size);
            zkfp2.ByteArray2Int(paramValue, ref mfpWidth);
            size = 4;
            zkfp2.GetParameters(mDevHandle, 2, paramValue, ref size);
            zkfp2.ByteArray2Int(paramValue, ref mfpHeight);


            //CREANDO BYTE PARA HUELLA
            FPBuffer = new byte[mfpWidth * mfpHeight];


            //CREANDO VECTOR PARA DENSIDAD DE HUELLA
            size = 4;
            zkfp2.GetParameters(mDevHandle, 3, paramValue, ref size);
            zkfp2.ByteArray2Int(paramValue, ref mfpDpi);


            //INCIANDO BASE DE DATOS DEL LECTOR
            mDBHandle = zkfp2.DBInit();


            //LIMPIANDO BYTES DE LECTURA
            for (int i = 0; i < 3; i++)
            {
                RegTmps[i] = new byte[2048];
            }

            ret      = zkfp.ZKFP_ERR_FAIL;
            cbCapTmp = 2048;
            while (conteo < 3)
            {
                ret = zkfp2.AcquireFingerprint(mDevHandle, FPBuffer, CapTmp, ref cbCapTmp);
                if (ret == zkfp.ZKFP_ERR_OK)
                {
                    Array.Copy(CapTmp, RegTmps[conteo], cbCapTmp);
                    String strBase64 = zkfp2.BlobToBase64(CapTmp, cbCapTmp);
                    byte[] blob      = zkfp2.Base64ToBlob(strBase64);
                    conteo++;
                }
            }

            conteo = 0;
            zkfp2.DBMerge(mDBHandle, RegTmps[0], RegTmps[1], RegTmps[2], RegTmp, ref cbRegTmp);
            String strShow = zkfp2.BlobToBase64(RegTmp, cbCapTmp);

            using (CICAMEntities entities = new CICAMEntities())
            {
                var empAnt = entities.EMPLEADO.Find(emp.ID);
                empAnt.HUELLA = strShow;
                entities.Entry(empAnt).State = System.Data.Entity.EntityState.Modified;
                entities.SaveChanges();
            }
            zkfp2.DBAdd(mDBHandle, emp.ID, RegTmp);
            return(strShow);
        }