public static List<Cliente> GetListaClientes() { CargarXml(); List<Cliente> ListaClientes = new List<Cliente>(); XmlNodeList elementos = XmlClientes.GetElementsByTagName("cliente"); foreach (XmlElement nodoCliente in elementos) { string v = nodoCliente.GetAttribute("producto"); Producto p; if (v.Equals("Premium")) { p = new Premium(); } else { p = new Demo(); } string campaña = nodoCliente.GetAttribute("campaña"); Campaña campDeCliente = null; List<Campaña> getLista = Campaña.GetListaCampaña(); foreach (Campaña c in getLista) { if (c.Nombre == campaña) { campDeCliente = c; break; } } Cliente cliente = new Cliente( nodoCliente.GetAttribute("nombre"), nodoCliente.GetAttribute("email"), nodoCliente.GetAttribute("telefono"), int.Parse(nodoCliente.GetAttribute("edad")), nodoCliente.GetAttribute("pais"), nodoCliente.GetAttribute("estado"), p, campDeCliente ); ListaClientes.Add(cliente); } return ListaClientes; }
public static bool Agregar(string clnNombre, string clnEmail, string clnTelefono, int clnEdad, string clnPais, string clnEstado, Producto clnProducto, Campaña clnCampaña) { Cliente nuevoCliente = new Cliente(clnNombre, clnEmail, clnTelefono, clnEdad, clnPais, clnEstado, clnProducto, clnCampaña); return nuevoCliente.Guardar(); }