コード例 #1
0
ファイル: HomeController.cs プロジェクト: JesusAMR/Embedidos
        /*
         * [HttpPost]
         * public ActionResult FileUpload(HttpPostedFileBase file)
         * {
         * if (file != null)
         * {
         * byte[] array;
         * StringBuilder lsbQuery = new StringBuilder();
         *
         * // file is uploaded
         *
         * // save the image path path to the database or you can send image
         * // directly to database
         * // in-case if you want to store byte[] ie. for DB
         * using (MemoryStream ms = new MemoryStream())
         * {
         *  file.InputStream.CopyTo(ms);
         *  array = ms.GetBuffer();
         *  lsbQuery.Append(@"insert into imagenes(vbImagen) values (convert(varbinary, '");
         *  foreach(var value in array)
         *  {
         *      lsbQuery.Append(value);
         *  }
         *  lsbQuery.Append(@" '))");
         * }
         *
         *
         * Conneccion.Execute(lsbQuery);
         * }
         * // after successfully uploading redirect the user
         * return RedirectToAction("Index", "Home");
         * }
         */
        public ActionResult ConsultarImagenes()
        {
            StringBuilder lsbQuery = new StringBuilder();
            DataTable     valores  = new DataTable();

            lsbQuery.Append("select * from registros r inner join usuarios u on r.iCodUsuario = u.iCodUsuario");
            ViewBag.valores = Conneccion.ExecuteDataTable(lsbQuery);
            return(View());
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: JesusAMR/Embedidos
        public ActionResult Consultar()
        {
            StringBuilder lsbQuery = new StringBuilder();
            DataTable     valores  = new DataTable();

            lsbQuery.Append("select r.iCodRegistro, case isnull(r.iCodUsuario, -1) when -1 then 'No identificado' else u.vchNombre end as vchNombre, getdate(), cast(r.bValido as tinyint)");
            lsbQuery.Append("from registros r ");
            lsbQuery.AppendLine("left join usuarios u on r.iCodUsuario = u.iCodUsuario");
            ViewBag.valores = Conneccion.ExecuteDataTable(lsbQuery);
            return(View());
        }
コード例 #3
0
ファイル: FaceApi.cs プロジェクト: JesusAMR/Embedidos
        public static async Task <string> MakeAnalysis(Byte[] file)
        {
            try
            {
                StringBuilder lsbQuery = new StringBuilder();
                int?          id;

                if (file == null)
                {
                    throw new ArgumentNullException("Archivo vacio");
                }
                string idCara, json, idCandidato;

                json = await MakeAnalysisRequest(file);

                idCara = Utilerias.findKeyValueinJSon(json, "faceId", 0);

                if (idCara == null)
                {
                    throw new ArgumentNullException("No se encontro cara");
                }

                json = await IdentifyImagePersonGroup(idCara, grupoPersonas, null);

                idCandidato = Utilerias.findKeyValueinJSon(json, "personId", 1);
                if (idCandidato == null)
                {
                    lsbQuery.AppendFormat("insert into registros(bValido) values(1)");
                    Conneccion.Execute(lsbQuery);
                    return(null);
                }
                id = Utilerias.findKey(idCandidato, Candidatos);
                if (id != null)
                {
                    lsbQuery.AppendFormat("insert into registros(iCodUsuario, bValido) values({0}, {1})", id, 0);
                    Conneccion.Execute(lsbQuery);
                }
                else
                {
                    lsbQuery.AppendFormat("insert into registros(bValido) values({0})", 1);
                    Conneccion.Execute(lsbQuery);
                }
                return(idCandidato);
            }
            catch (Exception e)
            {
                throw e;
            }
        }