public static string GetTabProveedoresHtml(Proveedor p) { string html = ""; string tabs = ""; tabs = @" <ul class='nav nav-tabs'> <li id='DescuentosRapeles'> <a href='ProveedoresDescuentosRapeles.aspx?CodClien={0}'><h4>Descuentos / Rappels</h4></a> </li> </ul> "; html = String.Format(tabs, p.CodProve); return html; }
public static IList<Proveedor> GetProveedores(string parNom) { IList<Proveedor> lp = new List<Proveedor>(); using (MySqlConnection conn = GetConnection()) { conn.Open(); MySqlCommand cmd = conn.CreateCommand(); string sql = @"SELECT p.codprove AS CODPROVE, p.nomprove AS NOMPROVE, COALESCE(p.nomcomer,'') AS NOMCOMER, COALESCE(p.domprove,'') AS DOMPROVE, COALESCE(p.codpobla,'')AS CODPOBLA, COALESCE(p.pobprove,'') AS POBPROVE, COALESCE(p.proprove,'') AS PROPROVE, COALESCE(p.nifPROVE,'') AS NIFPROVE, COALESCE(p.perprov1,'') AS PERPROV1, COALESCE(p.telprov1,'') AS TELPROV1, COALESCE(p.faxprov1,'') AS FAXPROV1, COALESCE(p.perprov2,'') AS PERPROV2, COALESCE(p.telprov2,'') AS TELPROV2, COALESCE(p.faxprov2,'') AS FAXPROV2, COALESCE(p.maiprov1,'') AS MAIPROV1, COALESCE(p.maiprov2,'') AS MAIPROV2 FROM sprove AS p WHERE nomprove LIKE '%{0}%' ORDER BY nomprove"; sql = String.Format(sql, parNom); cmd.CommandText = sql; MySqlDataReader rdr = cmd.ExecuteReader(); if (rdr.HasRows) { while (rdr.Read()) { Proveedor p = new Proveedor(); p = GetProveedor(rdr); if (p != null) lp.Add(p); } } conn.Close(); } return lp; }
public static string GetProveedorHtml(Proveedor p) { string html = ""; if (p == null) return html; string plantilla = @" <div class='container'> <div class='row'> <div class='col-sm-12'> <blockquote> <strong>{2} {3}</strong><br /> {4}<br /> {5} {6} {7} </blockquote> </div> </div> <div class='row'> <div class='col-sm-6'> <blockquote> <strong>Administración</strong><br/> <em>{8}</em><br /> Teléfono: <a href='tel:{9}'>{9}</a><br /> Email: <a href='mailto:{10}'>{10}</a> </blockquote> </div> <div class='col-sm-6'> <blockquote> <strong>Comercial</strong><br/> <em>{11}</em><br /> Teléfono: <a href='tel:{12}'>{12}</a><br /> EMail: <a href='mailto:{13}'>{13}</a> </blockquote> </div> </div> </div> "; html = String.Format(plantilla, p.CodProve, p.NomProve, p.Nifprove, p.Nomcomer, p.Domprove, p.Codpobla, p.Pobprove, p.Proprove, p.Perprov1, p.Telprov1, p.Maiprov1, p.Perprov2, p.Telprov2, p.Maiprov2); return html; }
public static Proveedor GetProveedor(MySqlDataReader rdr) { if (rdr.IsDBNull(rdr.GetOrdinal("CODPROVE"))) return null; Proveedor p = new Proveedor(); p.CodProve = rdr.GetInt32("CODPROVE"); if (!rdr.IsDBNull(rdr.GetOrdinal("NOMPROVE"))) p.NomProve = rdr.GetString("NOMPROVE"); p.Nomcomer = rdr.GetString("NOMCOMER"); p.Domprove = rdr.GetString("DOMPROVE"); p.Codpobla = rdr.GetString("CODPOBLA"); p.Pobprove = rdr.GetString("POBPROVE"); p.Proprove = rdr.GetString("PROPROVE"); p.Perprov1 = rdr.GetString("PERPROV1"); p.Perprov2 = rdr.GetString("PERPROV2"); p.Telprov1 = rdr.GetString("TELPROV1"); p.Telprov2 = rdr.GetString("TELPROV2"); p.Maiprov1 = rdr.GetString("MAIPROV1"); p.Maiprov2 = rdr.GetString("MAIPROV2"); return p; }