/// <summary>
        /// Carga el formato del botón y desserializa los registros de prueba.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrmPrincipal_Load(object sender, EventArgs e)
        {
            FormatoButton(gridDocumentos, button);
            try
            {
                procesador.Documentos = DocumentosDAO.GetAllDocumentos();
            }
            catch (Exception)
            {
                MessageBox.Show("Problema al cargar la base de datos");
            }

            /*List<Documento> listaDeserializadora = new List<Documento>();
             * Xml<List<Documento>> miVariable = new Xml<List<Documento>>();
             *
             * try
             * {
             *  miVariable.Importar(Environment.CurrentDirectory + @"\ImportXml\Inicio.xml", out listaDeserializadora);
             * }
             * catch (Exception exc)
             * {
             * MessageBox.Show(exc.Message);
             * }
             *
             * this.procesador.Documentos = listaDeserializadora;*/

            ultimoPresionado = "btnTodos";
            RefrescarDatagrid(gridDocumentos, PasosProceso.Todos);
        }
        public static eAjax fnFirmasDisponibles()
        {
            eAjax oeAjax = new eAjax();

            System.Web.HttpContext context = System.Web.HttpContext.Current;
            context.Response.ContentType = "application/json";
            if (HttpContext.Current.Session["leSeguridad"] == null)
            {
                oeAjax.iTipoResultado = 99;
                oeAjax.sMensajeError  = "Fin Session";
                return(oeAjax);
            }

            try
            {
                List <eSeguridad> lstSeguridad = new List <eSeguridad>();
                lstSeguridad = (List <eSeguridad>)HttpContext.Current.Session["leSeguridad"];
                string        sUsuarioAuditoria = lstSeguridad[0].strUsuario;
                int           iIdEmpres         = Convert.ToInt32(lstSeguridad[0].iIdEmpresa);
                int           iIdTrabajador     = Convert.ToInt32(lstSeguridad[0].iIdTrabajador);
                DocumentosDAO dao     = new DocumentosDAO();
                string        sresult = dao.fnCantFirmasDisponibles(iIdEmpres);
                oeAjax.iTipoResultado = 1;
                oeAjax.sValor1        = sresult;
            }
            catch (Exception ex)
            {
                oeAjax.sMensajeError = ex.Message;
            }
            return(oeAjax);
        }
Esempio n. 3
0
        public static eAjax fnEliminaDocumento(int sCodigo, string sRuta)
        {
            eAjax oeAjax = new eAjax();

            System.Web.HttpContext context = System.Web.HttpContext.Current;
            context.Response.ContentType = "application/json";
            if (HttpContext.Current.Session["leSeguridad"] == null)
            {
                oeAjax.iTipoResultado = 99;
                oeAjax.sMensajeError  = "Fin Session";
                return(oeAjax);
            }
            try
            {
                DocumentosDAO dao    = new DocumentosDAO();
                var           result = dao.fnEliminaDocumento(sCodigo);
                if (result >= 1)
                {
                    DeleteFile("ftp://ftp.site4now.net" + sRuta, "xxeguxx-001", "tornadesco.1");
                    oeAjax.iTipoResultado = 1;
                }
                else
                {
                    oeAjax.iTipoResultado = -1;
                    oeAjax.sMensajeError  = "Ocurrio Un Error Al Eliminar Documento";
                }
            }
            catch (Exception ex) {
                oeAjax.sMensajeError = ex.Message;
            }

            return(oeAjax);
        }
Esempio n. 4
0
        public void guardarDocumentos(int idCliente)
        {
            if (txtComprobanteDom.Text == "" || txtIne.Text == "")
            {
                System.Windows.MessageBox.Show("Escoja los archivos correspondientes");
            }
            else if (txtNombreCD.Text == "" || txtNombreIne.Text == "")
            {
                System.Windows.MessageBox.Show("Escoja los archivos correspondientes");
            }
            else
            {
                bool resultadoIne = DocumentosDAO.saveDocuments(txtIne.Text, txtNombreIne.Text, idCliente);
                bool resultadoCD  = DocumentosDAO.saveDocuments(txtComprobanteDom.Text, txtNombreCD.Text, idCliente);

                if (resultadoCD && resultadoIne)
                {
                    System.Windows.MessageBox.Show("Se guardaron los documentos");
                }
            }
        }
Esempio n. 5
0
        public static eAjax fnGuardaDocumento(string sNombreDocumento, string sDescripcion, int iTrabajador, string sNomDoc, string sFormato)
        {
            eAjax oeAjax = new eAjax();

            System.Web.HttpContext context = System.Web.HttpContext.Current;
            context.Response.ContentType = "application/json";
            if (HttpContext.Current.Session["leSeguridad"] == null)
            {
                oeAjax.iTipoResultado = 99;
                oeAjax.sMensajeError  = "Fin Session";
                return(oeAjax);
            }

            try
            {
                //DownloadFile("ftp://ftp.site4now.net//documentos//cargados//", "AVISO.pdf", "xxeguxx-001", "tornadesco.1", @AppDomain.CurrentDomain.BaseDirectory + "Documentos\\");

                List <eSeguridad> lstSeguridad = new List <eSeguridad>();
                lstSeguridad = (List <eSeguridad>)HttpContext.Current.Session["leSeguridad"];
                int           iIdTrabajador = Convert.ToInt32(lstSeguridad[0].iIdTrabajador);
                int           iIdEmpres     = Convert.ToInt32(lstSeguridad[0].iIdEmpresa);
                DocumentosDAO dao           = new DocumentosDAO();

                var vruta = @AppDomain.CurrentDomain.BaseDirectory + "Documentos\\" + sNomDoc;
                var i     = dao.fnRegistraDocumento(iIdEmpres, sNombreDocumento, sDescripcion, sFormato, iIdTrabajador, iTrabajador, "\\documentos\\cargados\\" + sNomDoc);
                if (i >= 1)
                {
                    UploadFTP(vruta, "ftp://ftp.site4now.net/", "xxeguxx-001", "tornadesco.1");
                }
                File.Delete(vruta);
                oeAjax.iTipoResultado = 1;
            }
            catch (Exception ex)
            {
                oeAjax.sMensajeError = ex.Message;
            }
            return(oeAjax);
        }
        public static eAjax fnFirmaDocumento(string sCodigo, string sRuta, string sNombre, string sFormato)
        {
            eAjax oeAjax = new eAjax();

            System.Web.HttpContext context = System.Web.HttpContext.Current;
            context.Response.ContentType = "application/json";
            if (HttpContext.Current.Session["leSeguridad"] == null)
            {
                oeAjax.iTipoResultado = 99;
                oeAjax.sMensajeError  = "Fin Session";
                return(oeAjax);
            }

            try
            {
                List <eSeguridad> lstSeguridad = new List <eSeguridad>();
                lstSeguridad = (List <eSeguridad>)HttpContext.Current.Session["leSeguridad"];
                string    sUsuarioAuditoria = lstSeguridad[0].strUsuario;
                int       iIdEmpres         = Convert.ToInt32(lstSeguridad[0].iIdEmpresa);
                int       iIdTrabajador     = Convert.ToInt32(lstSeguridad[0].iIdTrabajador);
                string    sCertificado      = Convert.ToString(lstSeguridad[0].sRutaCertificado);
                PlanesDAO daoplan           = new PlanesDAO();
                int       iresult           = daoplan.fnListafirmaDisponibles(iIdEmpres);
                if (iresult == 0)
                {
                    oeAjax.iTipoResultado = -1;
                    oeAjax.sMensajeError  = "No Cuenta Con Firmas Disponibles";
                }
                else
                {
                    if (sCertificado != "")
                    {
                        DocumentosDAO dao     = new DocumentosDAO();
                        var           vresult = DownloadFileNODELETE("ftp://ftp.site4now.net//documentos//cargados//", sNombre, "xxeguxx-001", "tornadesco.1", @AppDomain.CurrentDomain.BaseDirectory + "Documentos\\");
                        //Si Descargo El Documento
                        if (vresult != "")
                        {
                            var certificado      = new Certificado(sCertificado);
                            var firmante         = new Firmante(certificado);
                            var vrutaDocOriginal = @AppDomain.CurrentDomain.BaseDirectory + "Documentos\\" + sNombre;
                            var vrutaDocFirma    = @AppDomain.CurrentDomain.BaseDirectory + "Documentos\\Firmados\\" + sNombre;
                            //firmante.Firmar(@"c:\demos\documento.pdf", @"c:\demos\documento-firmado.pdf");
                            firmante.Firmar(vrutaDocOriginal, vrutaDocFirma);
                            var notario         = new Notario(certificado);
                            var documentoValido = notario.CertificarDocumento(vrutaDocFirma);
                            if (documentoValido == true)
                            {
                                //transfiere el documento firmado
                                UploadFTP(vrutaDocFirma, "ftp://ftp.site4now.net/", "firmante", "tornadesco.1");
                                var i = dao.fnFirmaDocumento(Convert.ToInt32(sCodigo), @"\\documentos\\firmados\\" + sNombre);
                                File.Delete(vrutaDocOriginal);
                                File.Delete(vrutaDocFirma);
                                oeAjax.iTipoResultado = 1;
                            }
                        }
                    }
                    else
                    {
                        oeAjax.iTipoResultado = -1;
                        oeAjax.sMensajeError  = "No Cuenta Con Un Certificado Asignado";
                    }
                }



                //string sresult = dao.fnListaDocumentoPendientes(iIdEmpres, iIdTrabajador);
                //oeAjax.iTipoResultado = 1;
                //oeAjax.sValor1 = sresult;
            }
            catch (Exception ex)
            {
                oeAjax.sMensajeError = ex.Message;
            }
            return(oeAjax);
        }
Esempio n. 7
0
        public static IDao DaoFactory(Type type)
        {
            IDao dao = null;

            if (type == typeof(EstadoDAO))
            {
                dao = new EstadoDAO();
            }
            else if (type == typeof(MunicipioDAO))
            {
                dao = new MunicipioDAO();
            }
            else if (type == typeof(FrecuenciaAbonoDAO))
            {
                dao = new FrecuenciaAbonoDAO();
            }
            else if (type == typeof(PaqueteServicioDAO))
            {
                dao = new PaqueteServicioDAO();
            }
            else if (type == typeof(TipoTelefonoDAO))
            {
                dao = new TipoTelefonoDAO();
            }
            else if (type == typeof(ClienteDAO))
            {
                dao = new ClienteDAO();
            }
            else if (type == typeof(AsesorDAO))
            {
                dao = new AsesorDAO();
            }
            else if (type == typeof(DocumentosDAO))
            {
                dao = new DocumentosDAO();
            }
            else if (type == typeof(DomiciliosDAO))
            {
                dao = new DomiciliosDAO();
            }
            else if (type == typeof(TelefonosDAO))
            {
                dao = new TelefonosDAO();
            }
            else if (type == typeof(RelacionAsesoresDocumentosDAO))
            {
                dao = new RelacionAsesoresDocumentosDAO();
            }
            else if (type == typeof(CargosDAO))
            {
                dao = new CargosDAO();
            }
            else if (type == typeof(ServicioFunerarioDAO))
            {
                dao = new ServicioFunerarioDAO();
            }
            else
            {
                throw new Exception("Tipo de Dao Desconocido: " + type.ToString());
            }

            dao.SqlConString = WebConfigHelper.GetConnectionString();
            return(dao);
        }