Пример #1
0
 public static string GetOfertaHtml(Oferta o)
 {
     string html = "";
     string plantilla = @"
     <div class='panel {5}'>
         <div class='panel-heading'>
             <a data-toggle='collapse' data-parent='#accordion' href='#collapse{0}'>
                 <h4>Oferta {0:0000000} de {1:dd/MM/yyyy} # {3:#,###,##0.00 €}</h4>
             </a>
         </div>
         <div id='collapse{0}' class='panel-collapse collapse'>
             <div class='panel-body'>
                 <table class='table table-bordered'>
                     <tr class='info'>
                         <th>Linea</th>
                         <th>Artículo</th>
                         <th class='text-right'>Cantidad</th>
                         <th class='text-right'>Precio</th>
                         <th class='text-right'>Dto1 (%)</th>
                         <th class='text-right'>Dto2 (%)</th>
                         <th class='text-right'>Importe</th>
                     </tr>
                     {4}
                 </table>
             </div>
         </div>
     </div>
     ";
     string plantillaLinea = @"
     <tr>
         <td>{0}</td>
         <td>{1}</td>
         <td class='text-right'>{3:##0.00}</td>
         <td class='text-right'>{2:###,##0.00}</td>
         <td class='text-right'>{4:0.00}</td>
         <td class='text-right'>{5:0.00}</td>
         <td class='text-right'>{6:##,###,##0.00}</td>
     </tr>
     ";
     // Cargar las líneas
     string lineas = "";
     foreach (LinOferta lp in o.LineasOferta)
     {
         lineas += String.Format(plantillaLinea, lp.NumLinea, lp.NomArtic, lp.PrecioAr, lp.Cantidad, lp.DtoLine1, lp.DtoLine2, lp.Importel);
     }
     string clase = "panel-default";
     if (o.Aceptado)
         clase = "panel-success";
     html = String.Format(plantilla, o.NumOfert, o.FecOfert, o.FecEntre, o.TotalOfe, lineas, clase);
     return html;
 }
Пример #2
0
 public static Oferta GetOferta(MySqlDataReader rdr)
 {
     if (rdr.IsDBNull(rdr.GetOrdinal("NUMOFERT")))
         return null;
     Oferta o = new Oferta();
     o.NumOfert = rdr.GetInt32("NUMOFERT");
     o.FecOfert = rdr.GetDateTime("FECOFERT");
     o.FecEntre = rdr.GetDateTime("FECENTRE");
     o.TotalOfe = rdr.GetDecimal("TOTALOFE");
     o.Aceptado = rdr.GetBoolean("ACEPTADO");
     return o;
 }