Пример #1
0
        public static bool ValidarTexto(Formato P_formato)
        {
            try
            {
                //Clase pertenciente al Framework de System.Text.RegularExpresion
                Regex regex = new Regex(P_formato.PatronValidacion);

                //Ejecución de método encapsulado donde se valida el texto recibido
                MatchCollection lstcoincidencias = regex.Matches(P_formato.Texto);

                //Respuesta del método con base a las coincidencias recibidas
                if (lstcoincidencias.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public override void Salvar(EntidadeDominio entidade)
        {
            connection.Open();
            formato = (Formato)entidade;
            pst.Dispose();
            pst.CommandText = "insert into formato (cod_Formato, altura, largura, diametro, comprimento , peso , dimensoes ) values ( :cod , :altura, :larg , :diame , :compr , :peso , :dimen )";
            OracleParameter[] parameters = new OracleParameter[]
            {
                new OracleParameter("cod", formato.CodFormato),
                new OracleParameter("altura", formato.Altura),
                new OracleParameter("larg", formato.Largura),
                new OracleParameter("diame", formato.Diametro),
                new OracleParameter("compr", formato.Comprimento),
                new OracleParameter("peso", formato.Peso),
                new OracleParameter("dimen", formato.Dimensoes)
            };


            pst.Parameters.Clear();
            pst.Parameters.AddRange(parameters);
            pst.Connection  = connection;
            pst.CommandType = CommandType.Text;
            pst.ExecuteNonQuery();
            pst.CommandText = "commit work";
            pst.ExecuteNonQuery();
            connection.Close();
            return;
        }
Пример #3
0
        public void TestMethod1()
        {
            Formato formato = new Formato();

            byte[] documento = formato.retorno(13);
            Assert.IsNotNull(documento);
        }
Пример #4
0
        private StringBuilder ObtenerEstilo(Formato formato)
        {
            StringBuilder st2 = new StringBuilder();

            if (formato.ObtenerNegrilla())
            {
                st2.Append("font-weight:bold;");
            }
            if (formato.ObtenerCursiva())
            {
                st2.Append("font-style:italic;");
            }
            st2.Append("font-family:" + formato.ObtenerFamiliaLetra() + ";");
            if (formato.ObtenerSubrayado())
            {
                st2.Append("text-decoration:underline;");
            }
            st2.Append("font-size:");
            st2.Append(formato.ObtenerTamLetraEscalado().ConvertirA(Unidad.Puntos).Valor.ToString(System.Globalization.CultureInfo.InvariantCulture));
            st2.Append("pt;");

            if (formato.ColorLetra.HasValue)
            {
                st2.Append("color:");
                st2.Append(ObtenerColorHTML(formato.ColorLetra.Value));
                st2.Append(";");
            }
            if (formato.ColorFondo.HasValue)
            {
                st2.Append("background-color:");
                st2.Append(ObtenerColorHTML(formato.ColorFondo.Value));
                st2.Append(";");
            }
            return(st2);
        }
        public ActionResult AdicionarItem(int id, Formato formato)
        {
            Livro livro = dao.BuscaPorId(id);

            carrinho.AdicionarOuIncremantarQuantidadeDoItem(livro, formato);
            return(RedirectToAction("Listar"));
        }
Пример #6
0
        public void CambiarTamLetra(Medicion tamLetra)
        {
            Formato f = Formato.CrearTamLetra(tamLetra);

            AplicarFormato(f);
            anteriorFormato = f;
        }
Пример #7
0
        public void CambiarTipoLetra(string familia)
        {
            Formato f = Formato.CrearTipoLetra(familia);

            AplicarFormato(f);
            anteriorFormato = f;
        }
Пример #8
0
        public void CambiarLetra(string familia, Medicion tamLetra)
        {
            Formato f = Formato.CrearLetra(familia, tamLetra);

            AplicarFormato(f);
            anteriorFormato = f;
        }
Пример #9
0
 public override string Processar(EntidadeDominio entidade)
 {
     try
     {
         Livro                  liv      = (Livro)entidade;
         Formato                endereco = liv.Formato;
         FormatoDAO             forn     = new FormatoDAO();
         List <EntidadeDominio> ende     = forn.Consultar(endereco);
         if (ende.Count > 0)
         {
             liv.Formato = (Formato)ende.ElementAt(0);
         }
         else
         {
             forn.Salvar(liv.Formato);
             ende        = forn.Consultar(liv.Formato);
             liv.Formato = (Formato)ende.ElementAt(0);
         }
         return(null);
     }
     catch (Exception e)
     {
         return(e.Message);
     }
 }
        public async Task <Formato> ConsultarFormatoPorInspeccionConexion(InspeccionConexion inspeccionConexion, UsuarioDTO usuarioDTO)
        {
            try
            {
                var query = _context.Formato
                            .Include(d => d.Adendum)
                            .Include(d => d.Planos)
                            .Include(d => d.Adjunto)
                            .Include(t => t.FormatoTiposConexion)
                            .Include(t => t.FormatoFormatoParametro).ThenInclude(a => a.FormatoParametro);
                if (inspeccionConexion.TipoConexionId == 111 || inspeccionConexion.TipoConexionId == null)
                {
                    Formato formato = await query.FirstOrDefaultAsync(t => t.ConexionId == inspeccionConexion.ConexionId);

                    return(formato);
                }
                else
                {
                    Formato formato = await query.FirstOrDefaultAsync(t => t.ConexionId == inspeccionConexion.ConexionId && t.FormatoTiposConexion.Any(d => d.TipoConexionId == inspeccionConexion.TipoConexionId && d.Estado == true));

                    return(formato);
                }

                throw new NotImplementedException();
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void gvEnfermedad_Actualizar(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row = gv_Enfermedad.Rows[e.RowIndex];

            gv_Enfermedad.EditIndex = -1;
            String codigo = row.Cells[1].Text;

            DropDownList combo   = (DropDownList)gv_Enfermedad.Rows[e.RowIndex].Cells[3].FindControl("ddl_formato");
            string       formato = combo.SelectedValue;

            format = IFormat.getPorCriterio <Formato>(formato).First();

            DropDownList comboUM      = (DropDownList)gv_Enfermedad.Rows[e.RowIndex].Cells[3].FindControl("ddl_unidadMed");
            string       unidadMedida = comboUM.SelectedValue;

            UM = IUnidadM.getPorCriterio <UnidadMedida>(unidadMedida).First();

            String descripcionAmpl = ((TextBox)(row.Cells[4].Controls[0])).Text;
            String nombre          = row.Cells[2].Text;
            String monodroga       = ((TextBox)(row.Cells[3].Controls[0])).Text;

            //String formato = ((TextBox)(row.Cells[5].Controls[0])).Text;
            //String undidadMedida = ((TextBox)(row.Cells[6].Controls[0])).Text;

            ActualizarEnfermedades(nombre, descripcionAmpl, monodroga, format.codigoPresentacion, UM.codigoUnidadMed);
            llenar(nombre);
        }
Пример #12
0
 public ItemCompra(Livro livro, Formato formato)
 {
     this.Livro             = livro;
     this.Formato           = formato;
     this.Quantidade        = 1;
     this.QuantidadeEstoque = 0;
 }
Пример #13
0
        public void ReducirLetra()
        {
            Formato f = Formato.CrearEscalaLetra(1 / 1.1f);

            AplicarFormato(f);
            anteriorFormato = f;
        }
Пример #14
0
    protected void btnDescargar_Click(object sender, ImageClickEventArgs e)
    {
        if (lblId.Text.Equals(""))
        {
            Response.Write("<script type='text/javascript'> alert('NO SELECCIONO NINGUN ARCHIVO') </script>");
        }
        else
        {
            if (vistaDocumentos.SelectedRow.Cells[3].Text.Equals("&nbsp;"))
            {
                Response.Write("<script type='text/javascript'> alert('FORMATO EN MANTENIMIENTO') </script>");
            }
            else
            {
                Formato auxiliarDescarga = consultasFormato.retorno(Convert.ToInt16(lblId.Text));
                byte[]  archivo          = auxiliarDescarga.Documento;
                Response.Clear();

                Response.AddHeader("content-disposition", string.Format("attachment;filename={0}", "" + auxiliarDescarga.nomFormato + "." + auxiliarDescarga.Extension + ""));
                Response.ContentType = "application/octet-stream";
                Response.BinaryWrite(archivo);
                Response.End();
            }
        }
    }
Пример #15
0
        public async Task <Guid> CrearFormato(Formato formato, UsuarioDTO usuario)
        {
            try
            {
                if (formato.Adjunto != null)
                {
                    await _serviceDocumentoAdjunto.CrearDocumentoAdjunto(formato.Adjunto);
                }

                if (formato.Planos != null)
                {
                    foreach (var plano in formato.Planos)
                    {
                        await _serviceDocumentoAdjunto.CrearDocumentoAdjunto(plano);
                    }
                }
                if (formato.Herramienta != null)
                {
                    formato.Herramienta = await _serviceHerramientaService.ConsultarHerramientaPorId(formato.Herramienta.Id, usuario);
                }


                return(await _repository.CrearFormato(formato, usuario));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        private void btnagregar2_Click(object sender, EventArgs e)
        {
            try
            {
                PRUEBAS_PARTICIPANTES p = new PRUEBAS_PARTICIPANTES();


                p.ID_Pruebas       = Convert.ToInt32(IdPruebas);
                p.ID_Participantes = Convert.ToInt32(IdParticipantes);

                Formato objformato = new Formato();
                objformato                  = new Formato();
                objformato.Texto            = txtnota.Text.Trim();
                objformato.PatronValidacion = Constantes.PatronTEL;

                if (!R_Humanos.ValidarTexto(objformato))
                {
                    MessageBox.Show("El formato de la NOTA no es valido, corregir por favor");
                    return;
                }
                p.Nota = Convert.ToInt32(txtnota.Text.Trim());

                R_Humanos.AgregarNotaPruebas(p);
                MessageBox.Show("Nota agregada correctamente");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #17
0
    protected void btnActualizar_Click(object sender, ImageClickEventArgs e)
    {
        if (documento.HasFile)
        {
            HttpPostedFile file = documento.PostedFile;
            foreach (Formato aux in listaForamto)
            {
                if (aux.idFormato.Equals(Convert.ToInt32(lblId.Text)))
                {
                    string ext = file.FileName;
                    ext = ext.Substring(ext.LastIndexOf(".") + 1).ToLower();
                    string[] formatos =
                        new string[] { "pdf", "docx", "xlsx" };
                    if (Array.IndexOf(formatos, ext) < 0)
                    {
                        Response.Write("<script type='text/javascript'> alert('NO VALIDO') </script>");
                    }
                    byte[] nuevoFormato = new byte[file.InputStream.Length];
                    file.InputStream.Read(nuevoFormato, 0, nuevoFormato.Length);
                    Formato envioFormato = new Formato(aux.idFormato, aux.nomFormato, nuevoFormato, ext);

                    consultasFormato.registrarNuevoDocumento(envioFormato);
                    break;
                }
            }
        }
        else
        {
            Response.Write("<script type='text/javascript'> alert('NO SELECCIONO NINGUN ARCHIVO') </script>");
        }
        lblId.Text  = "";
        lblNom.Text = "";
        actualizarDocumento();
    }
Пример #18
0
        public void CambiarColorFondo(ColorDocumento nuevoColorFondo)
        {
            Formato f = Formato.CrearColorFondo(nuevoColorFondo);

            AplicarFormato(f);
            anteriorFormato = f;
        }
Пример #19
0
 internal Formato ObtenerFormatoComun(Parrafo parrafoInicio, int posicionInicio,
                                      Parrafo parrafoFin, int posicionFin)
 {
     lock (m_Parrafos)
     {
         if (parrafoInicio == parrafoFin)
         {
             return(parrafoInicio.ObtenerFormatoComun(posicionInicio, posicionFin - posicionInicio));
         }
         else
         {
             Formato f      = Formato.ObtenerPredefinido().Clonar();
             Parrafo p      = parrafoInicio;
             int     inicio = posicionInicio;
             while (p != parrafoFin)
             {
                 f      = f.ObtenerInterseccion(p.ObtenerFormatoComun(inicio, p.Longitud - inicio));
                 p      = p.Siguiente;
                 inicio = 0;
             }
             f = f.ObtenerInterseccion(parrafoFin.ObtenerFormatoComun(0, posicionFin));
             return(f);
         }
     }
 }
Пример #20
0
 internal void CambiarFormato(Formato formato,
                              Parrafo parrafoInicio, int posicionInicio,
                              Parrafo parrafoFin, int posicionFin)
 {
     lock (m_Parrafos)
     {
         if (parrafoInicio == parrafoFin)
         {
             parrafoInicio.CambiarFormato(formato, posicionInicio, posicionFin - posicionInicio);
             EnCambioParrafo(parrafoInicio);
         }
         else
         {
             Parrafo p = parrafoInicio.Siguiente;
             while (p != parrafoFin)
             {
                 p.CambiarFormato(formato, 0, p.Longitud);
                 p = p.Siguiente;
             }
             parrafoInicio.CambiarFormato(formato, posicionInicio, parrafoInicio.Longitud - posicionInicio);
             parrafoFin.CambiarFormato(formato, 0, posicionFin);
             EnParrafosCambiados(parrafoInicio, parrafoFin);
         }
     }
 }
Пример #21
0
        public Formato ObtenerPropiedades(string propiedadNombre)
        {
            Formato formato = null;
            var     cmd     = new SqlCommand("dbo.usp_ObtenerFormatoPorPropiedadNombre", this.Conexion);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@propiedadNombre", SqlDbType.VarChar, 20)).Value = propiedadNombre;
            try
            {
                Conexion.Open();
                var sdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                if (sdr.Read())
                {
                    formato = new Formato
                    {
                        Codigo      = sdr["Codigo"].ToString(),
                        Version     = sdr["Version"].ToString(),
                        CarpetaBase = sdr["CarpetaBase"].ToString()
                    };
                }
                sdr.Close();
                return(formato);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (Conexion.State == ConnectionState.Open)
                {
                    Conexion.Close();
                }
            }
        }
Пример #22
0
        public Formato ObtenerArchivo(int id)
        {
            SqlCommand cmd = new SqlCommand("dbo.usp_ObtenerArchivoFormato", this.Conexion);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int)).Value = id;
            try
            {
                Formato formato = new Formato();
                this.Conexion.Open();
                SqlDataReader sdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
                if (sdr.Read())
                {
                    formato.Archivo.Contenido = (byte[])sdr[0];
                    formato.Archivo.Nombre    = sdr[1].ToString();
                    formato.Codigo            = sdr["codigo"].ToString();
                    formato.Version           = sdr["version"].ToString();
                    formato.CarpetaBase       = sdr["carpetabase"].ToString();
                }
                return(formato);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (Conexion.State == ConnectionState.Open)
                {
                    Conexion.Close();
                }
            }
        }
Пример #23
0
        public PeliculaPorFormato obtener(int idPelicula, int idFormato)
        {
            try
            {
                IPeliculaDao peliculaDao = new PeliculaDao();
                IFormatoDao  formatoDao  = new FormatoDao();

                conexion.abrir();
                query = "SELECT * FROM PeliculasXFormato WHERE CodPelicula_PXF = " + idPelicula + " AND CodFormato_PXF = " + idFormato;

                comando = new SqlCommand(query, conexion.getSqlConnection());
                reader  = comando.ExecuteReader();
                reader.Read();

                PeliculaPorFormato pxf      = new PeliculaPorFormato();
                Pelicula           pelicula = peliculaDao.obtener((int)reader[0]);
                pxf.setPelicula(pelicula);
                Formato formato = formatoDao.obtener((int)reader[1]);
                pxf.setFormato(formato);
                pxf.setEstado((bool)reader[2]);

                reader.Close();
                conexion.cerrar();
                return(pxf);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                reader.Close();
                conexion.cerrar();
                return(null);
            }
        }
Пример #24
0
        public Formato ActualizarArchivo(int id, Formato formato)
        {
            SqlCommand cmd = new SqlCommand("dbo.usp_ActualizarArchivoFormato", this.Conexion);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@id", SqlDbType.Int)).Value = id;
            cmd.Parameters.Add(new SqlParameter("@contenido", SqlDbType.VarBinary)).Value     = formato.Archivo.Contenido;
            cmd.Parameters.Add(new SqlParameter("@nombre", SqlDbType.VarChar, 100)).Value     = formato.Archivo.Nombre;
            cmd.Parameters.Add(new SqlParameter("@codigo", SqlDbType.VarChar, 20)).Value      = formato.Codigo;
            cmd.Parameters.Add(new SqlParameter("@version", SqlDbType.VarChar, 30)).Value     = formato.Version;
            cmd.Parameters.Add(new SqlParameter("@carpetabase", SqlDbType.VarChar, 50)).Value = formato.CarpetaBase;
            try
            {
                this.Conexion.Open();
                cmd.ExecuteNonQuery();
                this.Conexion.Close();
                return(formato);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (this.Conexion.State == ConnectionState.Open)
                {
                    this.Conexion.Close();
                }
            }
        }
Пример #25
0
        public FileResult ObtenerArchivo(string id)
        {
            FormatoRepository fr      = new FormatoRepository();
            Formato           formato = fr.ObtenerArchivo(int.Parse(id));

            return(File(formato.Archivo.Contenido, System.Net.Mime.MediaTypeNames.Application.Octet, formato.Archivo.Nombre));
        }
Пример #26
0
 public GeradorReportViewer(
     Formato reportFormat,
     string reportPath,
     IEnumerable <KeyValuePair <string, object> > reportParameters,
     ModoProcessamento mode = ModoProcessamento.Remote,
     IDictionary <string, DataTable> localReportDataSources    = null,
     IDictionary <string, IEnumerable> localReportEnumerable   = null,
     IDictionary <string, IDataSource> localReportUiDataSource = null,
     string filename               = null,
     string eventsHandlerType      = null,
     Stream embeddedResourceStream = null,
     string embeddedResourcePath   = null)
     : this(reportFormat,
            reportPath,
            null,
            null,
            null,
            reportParameters.ToList(),
            mode,
            localReportDataSources,
            localReportEnumerable,
            localReportUiDataSource,
            filename,
            eventsHandlerType,
            embeddedResourceStream,
            embeddedResourcePath)
 {
 }
Пример #27
0
        public Formato obtenerUltimo()
        {
            try
            {
                conexion.abrir();
                query = "SELECT TOP 1 * FROM Formatos ORDER BY CodFormato_Form DESC";

                comando = new SqlCommand(query, conexion.getSqlConnection());
                reader  = comando.ExecuteReader();
                reader.Read();

                Formato formato = new Formato();
                formato.setId((int)reader[0]);
                formato.setDescripcion((string)reader[1]);

                reader.Close();
                conexion.cerrar();
                return(formato);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                reader.Close();
                conexion.cerrar();
                return(null);
            }
        }
Пример #28
0
        public List <Formato> obtenerTodos()
        {
            try
            {
                List <Formato> lista = new List <Formato>();

                conexion.abrir();
                query = "SELECT * FROM Formatos ORDER BY Descripcion_Form ASC";

                comando = new SqlCommand(query, conexion.getSqlConnection());
                reader  = comando.ExecuteReader();

                while (reader.Read())
                {
                    Formato formato = new Formato();
                    formato.setId((int)reader[0]);
                    formato.setDescripcion((string)reader[1]);
                    lista.Add(formato);
                }

                reader.Close();
                conexion.cerrar();
                return(lista);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                reader.Close();
                conexion.cerrar();
                return(null);
            }
        }
Пример #29
0
        public async Task <Object []> EliminarFormato(int id_formato)
        {
            Object [] response = new Object [2];
            try {
                Formato formatToDelete = await AppDbContext.formatos.Where(f =>
                                                                           f.id_formato == id_formato).FirstOrDefaultAsync();

                List <DetalleTecnico> detallesTecnicos = await AppDbContext.detallesTecnicos.Where(dt =>
                                                                                                   dt.id_formato == formatToDelete.id_formato).ToListAsync();

                foreach (DetalleTecnico detalleTecnico in detallesTecnicos)
                {
                    await EliminarDetalleTecnico(detalleTecnico.id_detalle);
                }
                AppDbContext.formatos.Remove(formatToDelete);
                await AppDbContext.SaveChangesAsync();

                response[0] = true;
            }
            catch (Exception exception) {
                response[1] = (exception.InnerException != null) ?
                              exception.InnerException.Message : exception.Message;
            }
            return(response);
        }
Пример #30
0
 public static ActionResult GenerarActionResultExcelServiciosCuotas(IEnumerable <ServicioCuota> items,
                                                                    int cuotasPendientes, int cuotasImpagas, int cuotasPagas, decimal totalPagado)
 {
     return(ReportesExcelHelper.GenerarReporteExcelFileResult(
                items, Configuracion.Configuracion.ServiciosCuotasTitulo,
                encabezados: new string[] { "Fecha", "Servicio", "Importe", "Gastos", "Total", "Fecha Pago", "Cuota" },
                mapeoItemValores:
                (item) => new object[]
     {
         Formato.FormatoFecha(item.Fecha),
         item.Nombre,
         item.Importe,
         item.Gastos,
         item.Total,
         Formato.FormatoFecha(item.FechaPago),
         item.Cuota,
     },
                valoresAdicionales: new Dictionary <string, object>
     {
         { "Cuotas pendientes", cuotasPendientes },
         { "Cuotas impagas", cuotasImpagas },
         { "Cuotas pagas", cuotasPagas },
         { "Total pagado", totalPagado },
     }));
 }
Пример #31
0
        /// </summary>
        /// <param name="parameters">Lista de parametros de reporte</param>
        /// <param name="ds">Data set </param>
        /// <param name="rutareporte">ruta fisica del reporte en el servidor</param>
        /// <param name="formato">formato de salida</param>
        /// <param name="page">Pagina aspx donde se va a renderizar el reporte</param>
        public ExportadorReportes(List<ReportParameter> parametros, DataSet ds, string rutareporte, Formato formato, System.Web.UI.Page page)
        {
            this.Parameters = parametros;
            this.DataSet = ds;
            this.RutaReporte = rutareporte;
            this.Formato = formato;
            this.Page = page;

            this.Report_Viewer = new ReportViewer();

            Report_Viewer.LocalReport.EnableExternalImages = true;

            Report_Viewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(CargarSubReporte);
        }
Пример #32
0
 private string GetExtencion(Formato f)
 {
     switch (f)
     {
         case Formato.Excel:
             {
                 return "xls";
             }
         case Formato.Pdf:
             {
                 return "pdf";
             }
         default:
             {
                 return "xls";
             }
     }
 }
Пример #33
0
 private string GetContentType(Formato f)
 {
     switch (f)
     {
         case Formato.Excel:
             {
                 return "application/vnd.xls"; ;
             }
         case Formato.Pdf:
             {
                 return "application/pdf";
             }
         default:
             {
                 return "application/vnd.xls"; ;
             }
     }
 }
Пример #34
0
 private string GetNombreFormato(Formato f)
 {
     switch (f)
     {
         case Formato.Excel:
             {
                 return "Excel";
             }
         case Formato.Pdf:
             {
                 return "PDF";
             }
         default:
             {
                 return "Excel";
             }
     }
 }