public ActionResult ActualizaSimpe(Dto_Sinpe sinpe)
        {
            ManagerSolcitudes mang = new ManagerSolcitudes();
            var dto_ret            = mang.ConsultaSolicitudSinpe(sinpe);

            return(Json(dto_ret));
        }
        public ActionResult CargaMontosProductos(string id = null)
        {
            ManagerSolcitudes manage = new ManagerSolcitudes();

            try
            {
                if (Session["agente"] == null)
                {
                    return(RedirectToAction("LogOff", "Login"));
                }
                MontoCredito montoCredito = new MontoCredito();
                var          result       = manage.CargarProductos(montoCredito);
                if (result == null)
                {
                    List <MontoCredito> objetoNulo    = new List <MontoCredito>();
                    objetoNulo.FirstOrDefault().Monto = 0;
                    result = objetoNulo;
                }
                return(Json(result));
            }
            catch
            {
                throw;
            }
        }
        public ActionResult ListarProductos(string Id)
        {
            ManagerSolcitudes      manage    = new ManagerSolcitudes();
            ProductosMantenimiento productos = new ProductosMantenimiento();

            try
            {
                productos.MontoProducto = Convert.ToDecimal(Id);
                if (Session["agente"] == null)
                {
                    return(RedirectToAction("LogOff", "Login"));
                }

                var result = manage.ConsultaProductos(productos);
                if (result == null)
                {
                    List <ProductosMantenimiento> objetoNulo = new List <ProductosMantenimiento>();
                    objetoNulo.FirstOrDefault().Id           = 0;
                    result = objetoNulo;
                }
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                throw;
            }
        }
        public ActionResult CargaTipos(Tipos tipos)
        {
            ManagerSolcitudes mang = new ManagerSolcitudes();
            var dto_ret            = mang.CargarTipos(tipos.Id.ToString());

            return(Json(dto_ret.Where(x => x.Id == 113 || x.Id == 110)));
        }
        public ActionResult CargarResultadoScore(Score score)
        {
            ManagerSolcitudes mang = new ManagerSolcitudes();
            var res = mang.ConsultaResultadoScore(score);

            return(Json(res));
        }
        public ActionResult GuardaFotoCedulaDorso(DTO_SOLICITUD_VENTAS solicitudes)
        {
            ManagerSolcitudes    manager = new ManagerSolcitudes();
            List <Tab_ConfigSys> CONF    = new List <Tab_ConfigSys>();
            string xClase      = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name);
            string xProceso    = MethodBase.GetCurrentMethod().Name;
            string strHostName = System.Net.Dns.GetHostName();
            //IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); <-- Obsolete
            IPHostEntry ipHostInfo = Dns.GetHostEntry(strHostName);
            IPAddress   ipAddress  = ipHostInfo.AddressList[0];

            var dto_excepcion = new UTL_TRA_EXCEPCION
            {
                STR_CLASE      = xClase,
                STR_EVENTO     = xProceso,
                STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(),
                STR_SERVIDOR   = System.Net.Dns.GetHostName(),
                STR_PARAMETROS = JsonConvert.SerializeObject(solicitudes),
                FEC_CREACION   = DateTime.Now
            };

            Tab_ConfigSys dto_Config = new Tab_ConfigSys();

            dto_Config.llave_Config1 = "SERVICIO";
            dto_Config.llave_Config2 = "CONFIGURACION";
            dto_Config.llave_Config3 = "SERVIDOR";
            dto_Config.llave_Config4 = "URL";
            dto_Config.llave_Config5 = "FOTOCEDULATRASERA";

            try
            {
                var    dto_interval = manager.ConsultaConfiUrlImagen(dto_Config);
                string URL          = dto_interval.Where(x => x.llave_Config5 == "FOTOCEDULATRASERA").Select(x => x.Dato_Char1).FirstOrDefault();

                solicitudes.UrlFoto = URL + solicitudes.Identificacion + "/" + solicitudes.Identificacion;

                FileStream fileStream = new FileStream(solicitudes.UrlFotoCedulaTrasera, FileMode.Open);

                Image image = Image.FromStream(fileStream);
                fileStream.Close();


                if (manager.ValidarFichero(solicitudes.UrlFotoCedulaTrasera))
                {
                    image.Save(solicitudes.UrlFotoCedulaTrasera);
                    image.Dispose();
                }
                var dto_listLogin = manager.MetodoGuardaFoto(solicitudes);

                return(View());

                //	return Ok();
            }
            catch (ArgumentException)
            {
                solicitudes.Respuesta = "Ocurrio un Error";
            }
            return(View());
        }
        public ActionResult GetImagenSinpe(ImagenSinpe imagen)
        {
            ManagerSolcitudes mang = new ManagerSolcitudes();

            try
            {
                if (Session["agente"] == null)
                {
                    return(RedirectToAction("LogOff", "Login"));
                }
                Tab_ConfigSys        dto_Config         = new Tab_ConfigSys();
                ManagerSolcitudes    managerSolicitudes = new ManagerSolcitudes();
                List <Tab_ConfigSys> CONF = new List <Tab_ConfigSys>();
                dto_Config.llave_Config1 = "SERVICIO";
                dto_Config.llave_Config2 = "CONFIGURACION";
                dto_Config.llave_Config3 = "SERVIDOR";
                dto_Config.llave_Config4 = "URL";
                var dto_interval = managerSolicitudes.ConsultaConfiUrlImagen(dto_Config);
                var dir          = dto_interval.Where(x => x.llave_Config5 == "RUTA_BLOB_IMAGENSINPE").Select(x => x.Dato_Char1).FirstOrDefault(); //Server.MapPath("/");
                var blobDowland  = new blobStorage
                {
                    ImageToUploadByte = null,
                    ContainerPrefix   = string.Concat(dto_interval.Where(x => x.llave_Config5 == "RUTA_BLOB_IMAGENSINPE").Select(x => x.Dato_Char1).FirstOrDefault(), "/", imagen.Identificacion), //"documentos/FotoCedula/206560175",
                    ImageExtencion    = ".jpg",
                    ImageToUpload     = imagen.Identificacion,
                    ConnectionString  = dto_interval.Where(x => x.llave_Config5 == "CONECTION").Select(x => x.Dato_Char1).FirstOrDefault(),
                    PatchTempToSave   = AppDomain.CurrentDomain.BaseDirectory + string.Concat(dto_interval.Where(x => x.llave_Config5 == "IMAGENSINPE").Select(x => x.Dato_Char1).FirstOrDefault(), imagen.Identificacion)//@"C:\IVAN\images\FotoCedulas\206560175"
                };
                string LimpiarCarpeta = blobDowland.PatchTempToSave;
                if (Directory.Exists(LimpiarCarpeta))
                {
                    List <string> strDirectories = Directory.GetDirectories(LimpiarCarpeta, "*", SearchOption.AllDirectories).ToList();
                    foreach (string directorio in strDirectories)
                    {
                        Directory.Delete(directorio, true);
                    }
                }
                if (!Directory.Exists(blobDowland.PatchTempToSave))
                {
                    Directory.CreateDirectory(blobDowland.PatchTempToSave);
                }
                if (UtilBlobStorageAzure.ExistsFileInBlob(blobDowland))
                {
                    UtilBlobStorageAzure.DownloadBlobStorage(blobDowland);
                    imagen.UrlImagenSinpe = string.Concat(dto_interval.Where(x => x.llave_Config5 == "IMAGENSINPE").Select(x => x.Dato_Char1).FirstOrDefault()) + @"\" + imagen.Identificacion + @"\" + imagen.Identificacion + blobDowland.ImageExtencion;
                    imagen.Mensaje        = "Completo";
                }
                else
                {
                    imagen.Mensaje = "Este cliente no tiene imagen sinpe.";
                }
                return(Json(imagen));
            }
            catch (Exception ex)
            {
                imagen.Mensaje = "Error al mostrar la imagen";
                return(Json(imagen));
            }
        }
        public ActionResult ActualizarSolicitud(DTO_SOLICITUD_VENTAS solicitudes)
        {
            ManagerSolcitudes mang = NewMethod();

            solicitudes.USUARIO_MODIFICACION = Session["agente"].ToString();
            var res = mang.CambiarEstadoRevisionDocumentos(solicitudes);

            return(Json(res));
        }
        public ActionResult Encabezado()
        {
            ManagerSolcitudes mang = new ManagerSolcitudes();

            //
            solicitudes.ListTipos     = mang.CargarTipos("5");
            solicitudes.ListSolicitud = mang.ConsultaSolicitudDocumentos(solicitudes);
            var res = mang.ConsultaSolicitudDocumentos(solicitudes);

            return(Json(res));
        }
        //AVARGAS fin Inserción de solicitudes por ventas
        //jabarca obtener status solicitud
        public ActionResult getEstadoSolicitud(ConsultaEstadoSolicitud idEstado)
        {
            ManagerSolcitudes mang = new ManagerSolcitudes();

            try
            {
                var resul = mang.consultaEstadoSolicitud(idEstado);
                return(Json(resul));
            }
            catch { throw; }
        }
        public ActionResult cargaComboSubOrigenes()
        {
            ManagerSolcitudes mang = new ManagerSolcitudes();

            try
            {
                var resul = mang.consultaSubOrigenes();
                return(Json(resul));
            }
            catch { throw; }
        }
        public ActionResult EditaComprobante(comprobantepago compPago)
        {
            ManagerUser       manager            = new ManagerUser();
            ManagerSolcitudes managerSolicitudes = new ManagerSolcitudes();
            var dto_ret = new System.Collections.Generic.List <comprobantepago>();
            var tempId  = compPago.Identificacion;

            compPago.Identificacion = null;
            try
            {
                compPago.Accion = "CONSULTA";
                compPago.UsuarioModificacion = Session["agente"].ToString();
                dto_ret = manager.comrobantePago(compPago);

                Tab_ConfigSys dto_Config = new Tab_ConfigSys();


                dto_Config.llave_Config1 = "SERVICIO";
                dto_Config.llave_Config2 = "CONFIGURACION";
                dto_Config.llave_Config3 = "SERVIDOR";
                dto_Config.llave_Config4 = "URL";

                var dto_interval = managerSolicitudes.ConsultaConfiUrlImagen(dto_Config);

                compPago.Identificacion = tempId;

                var blob = new blobStorage
                {
                    ImageToUploadByte = null,
                    ContainerPrefix   = string.Concat(dto_interval.Where(x => x.llave_Config5 == "RUTA_BLOB_COMP_PAGO").Select(x => x.Dato_Char1).FirstOrDefault(), "/", compPago.Identificacion), //"documentos/FotoCedula/206560175",
                    ImageExtencion    = ".jpg",
                    ImageToUpload     = Path.GetFileName(dto_ret.FirstOrDefault().RutaBlob).Replace(".jpg", string.Empty),
                    ConnectionString  = dto_interval.Where(x => x.llave_Config5 == "CONECTION").Select(x => x.Dato_Char1).FirstOrDefault(),// "DefaultEndpointsProtocol=https;AccountName=fenix2fun2me;AccountKey=qEZhKqhySrIvLgiplmWIVwTR9kCFtznIFEmMhrfF56jWwlSnUJuh2fCXYmBtKl2dafQb+f/UYBUv1RQP5n9/Mg==;EndpointSuffix=core.windows.net",
                    PatchTempToSave   = string.Empty
                };
                UtilBlobStorageAzure.DownloadBlobStorageBytes(blob);
                if (blob.ImageToUploadByte != null)
                {
                    dto_ret.FirstOrDefault().ImageComprobante = Convert.ToBase64String(blob.ImageToUploadByte);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(Json(dto_ret));
        }
        public ActionResult BuscarDocumentos(string id = "0", int tipo = 0)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ManagerSolcitudes mang = new ManagerSolcitudes();
                    //
                    solicitudes.ListTipos     = mang.CargarTipos("5");
                    solicitudes.Solicitud     = id;
                    solicitudes.tipo          = tipo;
                    solicitudes.ListSolicitud = mang.ConsultaSolicitudDocumentos(solicitudes);


                    if (solicitudes.ListSolicitud.Count() == 0)
                    {
                        solicitudes.ListSolicitud = null;
                    }
                    else
                    {
                        Tab_ConfigSys dto_Config = new Tab_ConfigSys();
                        dto_Config.llave_Config1 = "SERVICIO";
                        dto_Config.llave_Config2 = "CONFIGURACION";
                        dto_Config.llave_Config3 = "SERVIDOR";
                        dto_Config.llave_Config4 = "URL";
                        var dto_interval = mang.ConsultaConfiUrlImagen(dto_Config);


                        descargarImagenes(solicitudes.ListSolicitud.FirstOrDefault(), dto_interval, 1);
                        descargarImagenes(solicitudes.ListSolicitud.FirstOrDefault(), dto_interval, 2);
                        descargarImagenes(solicitudes.ListSolicitud.FirstOrDefault(), dto_interval, 3);
                        descargarImagenes(solicitudes.ListSolicitud.FirstOrDefault(), dto_interval, 4);
                        descargarImagenes(solicitudes.ListSolicitud.FirstOrDefault(), dto_interval, 5);
                    }

                    solicitudes._PasosCredito = mang.ConsultaSolicitudPasos(solicitudes);
                }
            }
            catch (ArgumentException)
            {
                solicitudes.Respuesta = "Ocurrio un Error";
            }
            //return View(asignacionbuckets);
            return(View("Details", solicitudes));
        }
        //
        // GET: /Solicitudes/Edit/5

        public ActionResult Buscar(string id = "0", string estado = "0", string agente = "0")
        {
            try
            {
                if (ModelState.IsValid)
                {
                    ManagerSolcitudes mang = new ManagerSolcitudes();
                    solicitudes.Identificacion = id;
                    ///solicitudes.Status = estado;
                    solicitudes.FiltroAsesor  = agente;
                    solicitudes.ListSolicitud = mang.ConsultaSolicitudPendientes(solicitudes);
                }
            }
            catch (ArgumentException)
            {
                solicitudes.Respuesta = "Ocurrio un Error";
            }
            //return View(asignacionbuckets);
            return(View("Details", solicitudes));
        }
        //
        // GET: /Solicitudes/Details/5

        public ActionResult Details(string id = "0")
        {
            solicitudes.Identificacion = id;
            solicitudes.ListSolicitud  = new System.Collections.Generic.List <DTO_SOLICITUD_VENTAS>();
            //solicitudes.ListProductos = new List<productos>();
            //solicitudes.ListTipos = new List<Tipos>();
            // solicitudes.ListadoScore = new List<Score>();
            solicitudes.ListSolicitud.Add(solicitudes);

            ManagerSolcitudes manage = new ManagerSolcitudes();

            try
            {
                ViewBag.ListSolicitud = solicitudes;
            }
            catch
            {
                ViewBag.ErrorMessage = "Ocurrio un Error";
            }
            return(View(solicitudes));
        }
        public ActionResult CreaContratoPagare(PagareContrato pagareContrato)
        {
            ManagerSolcitudes manager = new ManagerSolcitudes();

            string xClase        = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name);
            string xProceso      = MethodBase.GetCurrentMethod().Name;
            string strHostName   = System.Net.Dns.GetHostName();
            var    dto_listLogin = new List <DTO_SOLICITUD_VENTAS>();
            //IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); <-- Obsolete
            IPHostEntry ipHostInfo = Dns.GetHostEntry(strHostName);
            IPAddress   ipAddress  = ipHostInfo.AddressList[0];

            var dto_excepcion = new UTL_TRA_EXCEPCION
            {
                STR_CLASE      = xClase,
                STR_EVENTO     = xProceso,
                STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(),
                STR_SERVIDOR   = System.Net.Dns.GetHostName(),
                STR_PARAMETROS = JsonConvert.SerializeObject(pagareContrato),
                FEC_CREACION   = DateTime.Now
            };

            DTO_SOLICITUD_VENTAS solicitudes = new DTO_SOLICITUD_VENTAS();

            solicitudes.Identificacion = pagareContrato.Identificacion;
            solicitudes.IdSolicitud    = pagareContrato.IdSolicitud;
            try
            {
                solicitudes.UrlDirectorioPagare = manager.CrearPdf(pagareContrato);

                dto_listLogin = manager.MetodoGuardaFoto(solicitudes);
                return(Json(dto_listLogin));
            }
            catch (ArgumentException)
            {
                solicitudes.Respuesta = "Ocurrio un Error";
            }
            return(Json(dto_listLogin));
        }
        public ActionResult CrearDocumentoDom(PagareContrato documentoDom)
        {
            ManagerSolcitudes manager     = new ManagerSolcitudes();
            dto_file          dto_File    = new dto_file();
            string            xClase      = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name);
            string            xProceso    = MethodBase.GetCurrentMethod().Name;
            string            strHostName = System.Net.Dns.GetHostName();
            var dto_listLogin             = new List <DTO_SOLICITUD_VENTAS>();
            //IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); <-- Obsolete
            IPHostEntry ipHostInfo = Dns.GetHostEntry(strHostName);
            IPAddress   ipAddress  = ipHostInfo.AddressList[0];

            var dto_excepcion = new UTL_TRA_EXCEPCION
            {
                STR_CLASE      = xClase,
                STR_EVENTO     = xProceso,
                STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(),
                STR_SERVIDOR   = System.Net.Dns.GetHostName(),
                STR_PARAMETROS = JsonConvert.SerializeObject(documentoDom),
                FEC_CREACION   = DateTime.Now
            };

            DTO_SOLICITUD_VENTAS solicitudes = new DTO_SOLICITUD_VENTAS();

            solicitudes.Identificacion = documentoDom.Identificacion;
            solicitudes.IdSolicitud    = documentoDom.IdSolicitud;
            try
            {
                //creamos el documento de domiciliacion y guardamos al url del archivo
                dto_File = manager.CrearDocDom(documentoDom);
            }
            catch (ArgumentException)
            {
                dto_File.Respuesta = "Ocurrio un Error";
            }

            return(Json(dto_File));
            ///System.IO.File.Delete(rutaDocDom);
        }
Beispiel #18
0
        public ActionResult SubirArchivosCobros(ArchivoCobros[] cobros)
        {
            //ManagerUser mang = new ManagerUser();
            ManagerSolcitudes    mang       = new ManagerSolcitudes();
            Tab_ConfigSys        dto_Config = new Tab_ConfigSys();
            List <Tab_ConfigSys> CONF       = new List <Tab_ConfigSys>();

            dto_Config.llave_Config1 = "SERVICIO";
            dto_Config.llave_Config2 = "CONFIGURACION";
            dto_Config.llave_Config3 = "SERVIDOR";
            dto_Config.llave_Config4 = "URL";

            try
            {
                var dto_interval = mang.ConsultaConfiUrlImagen(dto_Config);

                //creamos el grupo de byte para guardarlos
                byte[] bytesBCR = Convert.FromBase64String(cobros[0].Base64);
                byte[] bytesBAC = Convert.FromBase64String(cobros[1].Base64);
                byte[] bytesBN  = Convert.FromBase64String(cobros[2].Base64);

                //guardamos los grupos de bytes con los nombres y rutas por defecto
                //System.IO.File.WriteAllBytes(path + "ECBCR.xlsx", bytesBCR);
                //System.IO.File.WriteAllBytes(path + "ECBAC.xlsx", bytesBCR);
                //System.IO.File.WriteAllBytes(path + "ECBN.csv", bytesBCR);
                var fileBCR = new blobStorage
                {
                    ImageToUploadByte = bytesBCR,
                    ContainerPrefix   = dto_interval.Where(x => x.llave_Config5 == "RUTA_BLOB_DOC_DOMICILIACION").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ImageExtencion    = dto_interval.Where(x => x.llave_Config5 == "EXTENCION_DESCARGA_2").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ImageToUpload     = dto_interval.Where(x => x.llave_Config5 == "ENTIDA_DESCARGA_1").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ConnectionString  = dto_interval.Where(x => x.llave_Config5 == "CONECTION").Select(x => x.Dato_Char1).FirstOrDefault(),
                    PatchTempToSave   = dto_interval.Where(x => x.llave_Config5 == "RUTA_DESCARGA").Select(x => x.Dato_Char1).FirstOrDefault()
                                        //ContainerPrefix = "documentosdomiciliacion",
                                        //ImageExtencion = ".xlsx",
                                        //ImageToUpload = "ECBCR",
                                        //ConnectionString = "DefaultEndpointsProtocol=https;AccountName=fenix2fun2me;AccountKey=qEZhKqhySrIvLgiplmWIVwTR9kCFtznIFEmMhrfF56jWwlSnUJuh2fCXYmBtKl2dafQb+f/UYBUv1RQP5n9/Mg==;EndpointSuffix=core.windows.net",
                                        //PatchTempToSave = @"C:\IVAN\"
                };
                var fileBAC = new blobStorage
                {
                    ImageToUploadByte = bytesBAC,
                    ContainerPrefix   = dto_interval.Where(x => x.llave_Config5 == "RUTA_BLOB_DOC_DOMICILIACION").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ImageExtencion    = dto_interval.Where(x => x.llave_Config5 == "EXTENCION_DESCARGA_2").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ImageToUpload     = dto_interval.Where(x => x.llave_Config5 == "ENTIDA_DESCARGA_2").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ConnectionString  = dto_interval.Where(x => x.llave_Config5 == "CONECTION").Select(x => x.Dato_Char1).FirstOrDefault(),
                    PatchTempToSave   = dto_interval.Where(x => x.llave_Config5 == "RUTA_DESCARGA").Select(x => x.Dato_Char1).FirstOrDefault()
                                        //ContainerPrefix = "documentosdomiciliacion",
                                        //ImageExtencion = ".xlsx",
                                        //ImageToUpload = "ECBAC",
                                        //ConnectionString = "DefaultEndpointsProtocol=https;AccountName=fenix2fun2me;AccountKey=qEZhKqhySrIvLgiplmWIVwTR9kCFtznIFEmMhrfF56jWwlSnUJuh2fCXYmBtKl2dafQb+f/UYBUv1RQP5n9/Mg==;EndpointSuffix=core.windows.net",
                                        //PatchTempToSave = @"C:\IVAN\"
                };
                var fileBN = new blobStorage
                {
                    ImageToUploadByte = bytesBN,
                    ContainerPrefix   = dto_interval.Where(x => x.llave_Config5 == "RUTA_BLOB_DOC_DOMICILIACION").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ImageExtencion    = dto_interval.Where(x => x.llave_Config5 == "EXTENCION_DESCARGA_1").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ImageToUpload     = dto_interval.Where(x => x.llave_Config5 == "ENTIDA_DESCARGA_3").Select(x => x.Dato_Char1).FirstOrDefault(),
                    ConnectionString  = dto_interval.Where(x => x.llave_Config5 == "CONECTION").Select(x => x.Dato_Char1).FirstOrDefault(),
                    PatchTempToSave   = dto_interval.Where(x => x.llave_Config5 == "RUTA_DESCARGA").Select(x => x.Dato_Char1).FirstOrDefault()
                                        //ContainerPrefix = "documentosdomiciliacion",
                                        //ImageExtencion = ".csv",
                                        //ImageToUpload = "ECBN",
                                        //ConnectionString = "DefaultEndpointsProtocol=https;AccountName=fenix2fun2me;AccountKey=qEZhKqhySrIvLgiplmWIVwTR9kCFtznIFEmMhrfF56jWwlSnUJuh2fCXYmBtKl2dafQb+f/UYBUv1RQP5n9/Mg==;EndpointSuffix=core.windows.net",
                                        //PatchTempToSave = @"C:\IVAN\"
                };
                //Thread threadObj = new Thread(new ThreadStart(()=>UtilBlobStorageAzure.UploadBlobStorage(fileBCR)));
                //threadObj.Start();
                UtilBlobStorageAzure.UploadBlobStorage(fileBCR, false); // el segundo parametro nos dira si desea hacer copia de respaldo o no, su valor por default es true.
                UtilBlobStorageAzure.UploadBlobStorage(fileBAC, false);
                UtilBlobStorageAzure.UploadBlobStorage(fileBN, false);
                //mang.bndSubirArchivos(1);
                mang.InsertaCobroAutomatico(new AplicaCobrosAutomaticos {
                    Action = "INSERTA"
                });
                return(Json("Los archivos se subieron correctamente"));
            }
            catch (Exception ex)
            {
                return(Json("Error al Subir los Archivos"));
            }
        }
        public ActionResult GiraFotoFirma(DTO_SOLICITUD_VENTAS solicitudes)
        {
            ManagerSolcitudes    manager = new ManagerSolcitudes();
            List <Tab_ConfigSys> CONF    = new List <Tab_ConfigSys>();
            string xClase        = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name);
            string xProceso      = MethodBase.GetCurrentMethod().Name;
            string strHostName   = System.Net.Dns.GetHostName();
            var    dto_listLogin = new List <DTO_SOLICITUD_VENTAS>();
            //IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName()); <-- Obsolete
            IPHostEntry ipHostInfo    = Dns.GetHostEntry(strHostName);
            IPAddress   ipAddress     = ipHostInfo.AddressList[0];
            AWSAccess   wSAccess      = new AWSAccess();
            var         dto_excepcion = new UTL_TRA_EXCEPCION
            {
                STR_CLASE      = xClase,
                STR_EVENTO     = xProceso,
                STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString(),
                STR_SERVIDOR   = System.Net.Dns.GetHostName(),
                STR_PARAMETROS = JsonConvert.SerializeObject(solicitudes),
                FEC_CREACION   = DateTime.Now
            };

            Tab_ConfigSys dto_Config = new Tab_ConfigSys();

            dto_Config.llave_Config1 = "SERVICIO";
            dto_Config.llave_Config2 = "CONFIGURACION";
            dto_Config.llave_Config3 = "SERVIDOR";
            dto_Config.llave_Config4 = "URL";
            //dto_Config.llave_Config5 = "FOTOFIRMA";
            byte[] bytes = null;
            try
            {
                int    rotate       = 0;
                var    dto_interval = manager.ConsultaConfiUrlImagen(dto_Config);
                string URL          = dto_interval.Where(x => x.llave_Config5 == "FOTOFIRMA").Select(x => x.Dato_Char1).FirstOrDefault();


                var    SOL_TEMP = manager.ConsultaDirectorioImagen(solicitudes);
                string ext      = Path.GetExtension(SOL_TEMP.FirstOrDefault().UrlFotoFirma);
                ext = ext == null ? ".jpg" : ext;
                //solicitudes.UrlFotoFirma = String.Concat(URL + solicitudes.Identificacion + "/" + solicitudes.Identificacion, ext);

                // FileStream fileStream = new FileStream(SOL_TEMP.FirstOrDefault().UrlFotoCedula, FileMode.Open);

                var blobDowland = new blobStorage
                {
                    ImageToUploadByte = null,
                    ContainerPrefix   = string.Concat(dto_interval.Where(x => x.llave_Config5 == "RUTA_BLOB_FOTOFIRMA").Select(x => x.Dato_Char1).FirstOrDefault(), "/", solicitudes.Identificacion), //"documentos/FotoCedula/206560175",
                    ImageExtencion    = ".jpg",
                    ImageToUpload     = solicitudes.Identificacion,
                    ConnectionString  = dto_interval.Where(x => x.llave_Config5 == "CONECTION").Select(x => x.Dato_Char1).FirstOrDefault(), // "DefaultEndpointsProtocol=https;AccountName=fenix2fun2me;AccountKey=qEZhKqhySrIvLgiplmWIVwTR9kCFtznIFEmMhrfF56jWwlSnUJuh2fCXYmBtKl2dafQb+f/UYBUv1RQP5n9/Mg==;EndpointSuffix=core.windows.net",
                    PatchTempToSave   = dto_interval.Where(x => x.llave_Config5 == "FOTOFIRMA").Select(x => x.Dato_Char1).FirstOrDefault()  //@"C:\IVAN\images\FotoCedulas\206560175"
                };

                //FileStream fileStream = new FileStream(solicitudes.UrlFotoFirma, FileMode.Open);

                UtilBlobStorageAzure.DownloadBlobStorageBytes(blobDowland);

                if (blobDowland.ImageToUploadByte != null)
                {
                    bytes = blobDowland.ImageToUploadByte;
                }

                Image image = Image.FromStream(new MemoryStream(bytes));
                //fileStream.Close();
                rotate = 8;
                //int orientationValue = image.GetPropertyItem(prop.Id).Value[0];
                RotateFlipType rotateFlipType = wSAccess.GetOrientationToFlipType(rotate);
                image.RotateFlip(rotateFlipType);
                bytes = (byte[])(new ImageConverter()).ConvertTo(image, typeof(byte[]));
                //if (Utilitarios.ValidarFichero(solicitudes.UrlFotoFirma))
                //{
                //    image.Save(solicitudes.UrlFotoFirma);
                //    image.Dispose();
                //}

                var blob = new blobStorage
                {
                    ImageToUploadByte = bytes,
                    ContainerPrefix   = string.Concat(dto_interval.Where(x => x.llave_Config5 == "RUTA_BLOB_FOTOFIRMA").Select(x => x.Dato_Char1).FirstOrDefault(), "/", solicitudes.Identificacion), //"documentos/FotoCedula/206560175",
                    ImageExtencion    = ext,
                    ImageToUpload     = solicitudes.Identificacion,
                    ConnectionString  = dto_interval.Where(x => x.llave_Config5 == "CONECTION").Select(x => x.Dato_Char1).FirstOrDefault(), // "DefaultEndpointsProtocol=https;AccountName=fenix2fun2me;AccountKey=qEZhKqhySrIvLgiplmWIVwTR9kCFtznIFEmMhrfF56jWwlSnUJuh2fCXYmBtKl2dafQb+f/UYBUv1RQP5n9/Mg==;EndpointSuffix=core.windows.net",
                    PatchTempToSave   = dto_interval.Where(x => x.llave_Config5 == "FOTOFIRMA").Select(x => x.Dato_Char1).FirstOrDefault()  //@"C:\IVAN\images\FotoCedulas\206560175"
                };
                UtilBlobStorageAzure.UploadBlobStorage(blob);
                //Thread threadObj = new Thread(new ThreadStart(() => UtilBlobStorageAzure.UploadBlobStorage(blob)));
                //threadObj.Start();

                solicitudes.UrlFotoFirma = string.Concat(blob.ContainerPrefix, "/", solicitudes.Identificacion, blob.ImageExtencion);

                dto_listLogin = manager.MetodoGuardaFoto(solicitudes);

                return(Json(dto_listLogin));

                //	return Ok();
            }
            catch (ArgumentException)
            {
                solicitudes.Respuesta = "Ocurrio un Error";
            }
            return(Json(dto_listLogin));
        }
Beispiel #20
0
        public Solicitudes DetectText(List <Tab_ConfigSys> Tab_ConfigSys, byte[] bytes, string Identificacion, int IdTipoIdentificacion, int?OPC)
        {
            string xClase   = string.Format("{0}|{1}", MethodBase.GetCurrentMethod().Module.Name, MethodBase.GetCurrentMethod().DeclaringType.Name);
            string xProceso = MethodBase.GetCurrentMethod().Name;

            bool resp  = false;
            var  param = new
            {
                UriFoto            = bytes,
                TipoIdentificacion = IdTipoIdentificacion,
                cedula             = Identificacion,
                OPCe = OPC
            };
            var dto_excepcion = new UTL_TRA_EXCEPCION
            {
                STR_CLASE      = xClase,
                STR_EVENTO     = xProceso,
                FEC_CREACION   = DateTime.Now,
                STR_PARAMETROS = JsonConvert.SerializeObject(param),
                STR_SERVIDOR   = System.Net.Dns.GetHostName(),
                STR_APLICATIVO = ConfigurationManager.AppSettings["APLICATIVO"].ToString()
            };
            Solicitudes _Solicitudes = new Solicitudes();

            _Solicitudes.Identificacion = Identificacion;
            ManagerSolcitudes managerSolcitudes = new ManagerSolcitudes();
            var FecVencCedula = managerSolcitudes.ConsultaFechaVencimientoCedula(_Solicitudes);

            var options = new CredentialProfileOptions
            {
                AccessKey = Tab_ConfigSys[0].llave_Config1,
                SecretKey = Tab_ConfigSys[0].llave_Config2
            };

            try
            {
                var profile = new Amazon.Runtime.CredentialManagement.CredentialProfile("AWSProfileName", options);
                profile.Region = RegionEndpoint.USWest1;
                var netSDKFile = new NetSDKCredentialsFile();
                netSDKFile.RegisterProfile(profile);

                using (AmazonRekognitionClient rekoClient = new AmazonRekognitionClient(Tab_ConfigSys[0].llave_Config1, Tab_ConfigSys[0].llave_Config2, RegionEndpoint.USEast1))
                {
                    Amazon.Rekognition.Model.Image img = new Amazon.Rekognition.Model.Image();

                    img.Bytes = new MemoryStream(bytes);

                    DetectTextRequest dfr = new DetectTextRequest();

                    dfr.Image = img;
                    var  outcome = rekoClient.DetectText(dfr);
                    bool dia     = false;
                    bool mes     = false;
                    bool anio    = false;
                    foreach (var texto in outcome.TextDetections)
                    {
                        string cedula = "";

                        cedula = texto.DetectedText;
                        cedula = cedula.Replace(" ", "").Trim();


                        var cedresp   = cedula.Split(':');
                        var respuesta = cedresp.Where(x => x.ToString().Equals(Identificacion) || cedula.Equals(Identificacion)).Any();
                        if (respuesta)
                        {
                            resp = respuesta;
                        }
                        if (FecVencCedula != null)
                        {
                            var resDia = cedresp.Where(x => x.ToString().Equals(Convert.ToString(FecVencCedula.Dia)) || cedula.Equals(Convert.ToString(FecVencCedula.Dia))).Any();
                            if (resDia)
                            {
                                dia = resDia;
                            }
                            var resMes = cedresp.Where(x => x.ToString().Equals(Convert.ToString(FecVencCedula.Mes)) || cedula.Equals(Convert.ToString(FecVencCedula.Mes))).Any();
                            if (resMes)
                            {
                                mes = resMes;
                            }
                            var resAnio = cedresp.Where(x => x.ToString().Equals(Convert.ToString(FecVencCedula.Anio)) || cedula.Equals(Convert.ToString(FecVencCedula.Anio))).Any();
                            if (resAnio)
                            {
                                anio = resAnio;
                            }

                            if (respuesta == true && dia == true && mes == true && anio == true)
                            {
                                break;
                            }
                        }
                        else
                        {
                            if (respuesta)
                            {
                                break;
                            }
                        }
                    }
                    var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(outcome.TextDetections.Select(x => x.DetectedText));


                    _Solicitudes.Result       = resp;
                    _Solicitudes.Dia          = Convert.ToInt32(dia);
                    _Solicitudes.Mes          = Convert.ToInt32(mes);
                    _Solicitudes.Anio         = Convert.ToInt32(anio);
                    _Solicitudes.DetectedText = jsonString;
                }
                //return outcome.TextDetections.Select(x => x.DetectedText).ToList();
                return(_Solicitudes);
            }
            catch (Exception ex)
            {
                dto_excepcion.STR_MENSAJE = ex.Message;
                dto_excepcion.IS_TELEGRAM = true;
                TwoFunTwoMe_DataAccess.Utility.guardaExcepcion(dto_excepcion, ConfigurationManager.ConnectionStrings["TwoFunTwoMeConnection"].ConnectionString);
                _Solicitudes.Mensaje = "ERR_Detect Text";
                throw;
            }
        }