Example #1
0
        public static GestorDeClientes CargarXML(string f)
        {
            var toret = new GestorDeClientes();

            try
            {
                var doc = XDocument.Load(f);
                if (doc.Root != null &&
                    doc.Root.Name == EtqClientes)
                {
                    var clientes = doc.Root.Elements(EtqCliente);

                    foreach (var clienteXml in clientes)
                    {
                        toret.Clientes.Add(new Cliente((string)clienteXml.Element(EtqNIF),
                                                       (string)clienteXml.Element(EtqNombre),
                                                       (string)clienteXml.Element(EtqTelefono),
                                                       (string)clienteXml.Element(EtqEmail),
                                                       (string)clienteXml.Element(EtqDireccionPostal)));
                    }
                }
            }
            catch (XmlException)
            {
                toret.Clear();
            }
            catch (IOException)
            {
                toret.Clear();
            }

            return(toret);
        }
Example #2
0
        //-------------------------------------------CARGAR Y GUARDAR------------------------------------------------------

        /// <summary>
        ///     Carga el XML en las listas
        /// </summary>
        public void CargarXML()
        {
            ColeccionClientes    = GestorDeClientes.CargarXML();
            ColeccionVehiculos   = ColeccionVehiculos.CargarXml();
            ColeccionTransportes = ColeccionTransportes.CargarXML(ColeccionClientes, ColeccionVehiculos);
        }
Example #3
0
        //-------------------------------------------CONSTRUCTORES------------------------------------------------------

        /// <summary>
        ///     El constructor de garaje vacio
        ///     Inicializa todas las listas vacias
        /// </summary>
        public Empresa()
        {
            ColeccionClientes    = new GestorDeClientes();
            ColeccionVehiculos   = new ColeccionVehiculos();
            ColeccionTransportes = new ColeccionTransportes();
        }