示例#1
0
    private string obtenerCostes()
    {
        try
        {
            StringBuilder sb = new StringBuilder();
            SqlDataReader dr = CATEGSUPER.Catalogo(null, "", null, null, 2, 0);

            sb.Append("<table id='tblDatos' class='texto MANO' style='WIDTH: 500px;' mantenimiento='1'>");
            sb.Append("<colgroup><col style='width:10px;' /><col style='width:290px;' /><col style='width:100px;' /><col style='width:100px;' /></colgroup>");
            sb.Append("<tbody id='tbodyDatos'>");

            while (dr.Read())
            {
                sb.Append("<tr id='" + dr["t450_idcategsuper"].ToString() + "' bd='' onclick='mm(event)' style='height:20px'>");
                sb.Append("<td><img src='../../../images/imgFN.gif'></td>");
                sb.Append("<td style='padding-left:5px;'><input type='text' class='txtL' style='width:270px' value=\"" + dr["t450_denominacion"].ToString() + "\" maxlength='25' onKeyUp='fm(event)'></td>");
                sb.Append("<td><input type='text' class='txtNumL' style='width:95px;' value=\"" + decimal.Parse(dr["t450_costemediohora"].ToString()).ToString("N") + "\" onKeyUp='fm(event)' onfocus='fn(this,4,2)'></td>");
                sb.Append("<td><input type='text' class='txtNumL' style='width:95px;' value=\"" + decimal.Parse(dr["t450_costemediojornada"].ToString()).ToString("N") + "\" onKeyUp='fm(event)' onfocus='fn(this,4,2)'></td>");
                sb.Append("</tr>");
            }
            dr.Close();
            dr.Dispose();
            sb.Append("</tbody>");
            sb.Append("</table>");

            return("OK@#@" + sb.ToString());
        }
        catch (Exception ex)
        {
            return("Error@#@" + Errores.mostrarError("Error al obtener las categorías.", ex));
        }
    }
    private void CargarCategorias()
    {
        //cboCategoria.DataValueField = "t450_idcategsuper";
        //cboCategoria.DataTextField = "t450_denominacion";
        //cboCategoria.DataSource = CATEGSUPER.Catalogo(null, "", null, null, 2, 0);
        //cboCategoria.DataBind();

        ListItem      oLI = null;
        SqlDataReader dr  = CATEGSUPER.Catalogo(null, "", null, null, 2, 0);

        while (dr.Read())
        {
            oLI = new ListItem(dr["t450_denominacion"].ToString(), dr["t450_idcategsuper"].ToString());
            oLI.Attributes.Add("sCosteHora", decimal.Parse(dr["t450_costemediohora"].ToString()).ToString("#,###.0000"));
            oLI.Attributes.Add("sCosteJornada", decimal.Parse(dr["t450_costemediojornada"].ToString()).ToString("#,###.0000"));
            cboCategoria.Items.Add(oLI);
        }
        dr.Close();
        dr.Dispose();
    }