示例#1
0
 public ActionResult AjaxUserCheck(palabra b)
 {
     try
     {
         BIZUsuario User = new BIZUsuario();
         User.Usuario1 = b.name;
         BLLUsuario DUser = new BLLUsuario();
         b.existe = DUser.CheckByName(User);
         return Json(b, JsonRequestBehavior.AllowGet);
     }
     catch (Exception ex) { return Json(new BIZUsuario(), JsonRequestBehavior.AllowGet); }
 }
示例#2
0
        public ActionResult AjaxRequest(palabra b)
        {
            //Prueba DB, ya no lo uso en este ejemplo
            // var alimento = db.alimento.Where(a => a.Nombre == b.Name)
            SL.Utils utils = new SL.Utils();
            BIZ.BIZCorreo correo = new BIZ.BIZCorreo();
            correo.Body = "Cuerpo";
            correo.To = "*****@*****.**";
            correo.Subject = "subjectttt";
            utils.sendMail(correo);

            return Json(b, JsonRequestBehavior.AllowGet);
        }
        public void ProcesarOCRHilos()
        {
            try
            {
                S.WaitOne();
                int i = -1;

                System.Object obj = (System.Object)procesado;
                System.Threading.Monitor.Enter(obj);
                String campo = "";
                try
                {
                    i = procesado;
                    procesado++;
                }
                finally
                {
                    System.Threading.Monitor.Exit(obj);
                }

                if (i < textArea.Count)
                {
                    var img = Pix.LoadFromFile(ruta + "/files/" + "z-imgtexto-" + i.ToString() + ".bmp");


                    try
                    {
                        using (var engine = new TesseractEngine(unidad + @":\tessdata", "eng", EngineMode.Default))
                        {
                            using (var page = engine.Process(img, Tesseract.PageSegMode.SingleLine))



                            {
                                int    x     = textArea[i].X;
                                int    y     = textArea[i].Y;
                                string field = coincidirCampo(x, y);



                                campo = page.GetText();
                                palabra p = new palabra();
                                p.nombre = field;
                                p.orden  = i;
                                p.texto  = campo.Replace('‘', '\0').Replace("'", "\0");
                                palabrasProc.Add(p);
                                // Console.WriteLine("exito hilo " + i.ToString());
                                if (palabrasProc.Count == textArea.Count)
                                {
                                    Console.WriteLine("Se obtuvo texto de los segmentos, presione una tecla para generar archivo.");
                                }
                            }
                        }
                    }
                    catch (Exception)
                    {
                        //  Console.WriteLine("fallo hilo " + i.ToString());
                    }
                }
            }
            finally
            {
                // release so others can go (increment)
                S.Release();
            }
        }