Beispiel #1
0
        /// <summary>
        /// Es el metodo que llama a la clase XML para serializar esta misma clase y hacer el archivo xml
        /// </summary>
        /// <param name="fabrica"></param>
        /// <returns>retorna true si se pudo hacer, false caso contrario</returns>
        public static bool Guardar(Fabrica fabrica)
        {
            string        path       = String.Concat(AppDomain.CurrentDomain.BaseDirectory, "Fabrica.xml");
            Xml <Fabrica> fabricaAux = new Xml <Fabrica>();

            return(fabricaAux.Guardar(path, fabrica));
        }
        /// <summary>
        /// Guarda el listado de ventas en archivo XML
        /// </summary>
        /// <param name="inv"></param>
        /// <returns>true si lo guardo, false caso contrario</returns>
        public static bool GuardarVentasXml(List <Cliente> ventas)
        {
            string path = AppDomain.CurrentDomain.BaseDirectory + "Ventas.xml";
            Xml <List <Cliente> > auxXML = new Xml <List <Cliente> >();

            return(auxXML.Guardar(path, ventas));
        }
        /// <summary>
        /// Metodo utlizado para generar el xml de Ordenes de compra que permite simular la carga de ordenes externas. Puede usarse si se prefiere generar el archivo en lugar de copiar el que se adjunta al proyecto en la ruta definida
        /// </summary>
        /// <param name="auxOrdenesDeCompra">Lista de ordenes de compra</param>
        /// <returns>Devuelve un booleano para control de ejecucion</returns>
        public static bool Guardar(List <OrdenDeCompra> auxOrdenesDeCompra)
        {
            string path = String.Format("{0}\\OrdenesDeCompraExternas.xml", Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
            Xml <List <OrdenDeCompra> > auxOrden = new Xml <List <OrdenDeCompra> >();

            return(auxOrden.Guardar(path, auxOrdenesDeCompra));
        }
Beispiel #4
0
        public static void GuardarListaComidas()
        {
            string rutaArchivo = String.Concat(AppDomain.CurrentDomain.BaseDirectory, "Comidas.xml");
            Xml <List <Comida> > archivoXml = new Xml <List <Comida> >();

            archivoXml.Guardar(rutaArchivo, listaComidas);
        }
Beispiel #5
0
        /// <summary>
        /// Método que habilita los datos para ser guardados en un archivo con formato XML
        /// </summary>
        /// <param name="ListaActualDePedidos">Lista de pedidos a guardar en el archivo</param>
        /// <returns>Devuelve un booleano para control de ejecucion</returns>
        public static bool Guardar(List <Pedido> ListaActualDePedidos)
        {
            string path = String.Format("{0}\\listaDePedidos.xml", Environment.GetFolderPath(Environment.SpecialFolder.Desktop));
            Xml <List <Pedido> > auxPedido = new Xml <List <Pedido> >();

            return(auxPedido.Guardar(path, ListaActualDePedidos));
        }
Beispiel #6
0
        /// <summary>
        /// Guarda la lista de ventas en un archivo en formato XML
        /// </summary>
        /// <param name="ventas"></param>
        /// <returns>Retorna booleano (true) si se guardo o (false) si no.</returns>
        public static bool Guardar(List <Venta> ventas)
        {
            string archivo           = String.Concat(AppDomain.CurrentDomain.BaseDirectory, "inventario.xml");
            Xml <List <Venta> > save = new Xml <List <Venta> >();

            return(save.Guardar(archivo, ventas));
        }
Beispiel #7
0
        /// <summary>
        /// Método estático Guardar, que guarda en un archivo de texto la venta realizada
        /// </summary>
        /// <param name="p"><T> </param>
        /// <returns> true si pudo, caso contrario false y arroja excepcion</returns>
        public void Guardar(Pedido p)
        {
            Txt          txt = new Txt();
            Xml <Pedido> xml = new Xml <Pedido>();

            xml.Guardar("BackupPedido.xml", p);
            txt.Guardar("Pedido.txt", p.ToString());
        }
Beispiel #8
0
        public static void GuardarColaPedidosPendientes()
        {
            List <PedidoConfirmado> auxlist = colaPedidos.ToList();
            string rutaArchivo = String.Concat(AppDomain.CurrentDomain.BaseDirectory, "Pedidos.xml");
            Xml <List <PedidoConfirmado> > archivoXml = new Xml <List <PedidoConfirmado> >();

            archivoXml.Guardar(rutaArchivo, auxlist);
        }
Beispiel #9
0
        /// <summary>
        /// Guarda universidad en formato xml
        /// </summary>
        /// <param name="uni"></param>
        /// <returns></returns>
        public static bool Guardar(Universidad uni)
        {
            string            path = Directory.GetCurrentDirectory() + @"\universidad.xml";
            Xml <Universidad> xmlu = new Xml <Universidad>();

            xmlu.Guardar(path, uni);
            return(true);
        }
Beispiel #10
0
        /// <summary>
        /// Método estático guardar, que guarda un archivo XML con los datos de Stock
        /// </summary>
        /// <param name="storage"> de tipo Stock </param>
        /// <returns> un booleano </returns>
        public static bool GuardarXml(Stock storage, string nombre)
        {
            bool        rta     = false;
            Xml <Stock> archive = new Xml <Stock>();

            rta = archive.Guardar(nombre, storage);

            return(rta);
        }
Beispiel #11
0
        /// <summary>
        ///             EVENTOS Y DELEGADOS
        /// </summary>
        public void Serializar()
        {
            Xml <Server> xml = new Xml <Server>();

            if (this.GenerarArchivo != null)
            {
                this.GenerarArchivo.Invoke(xml.Guardar(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\" + "infoServer.xml", this));
            }
        }
Beispiel #12
0
        /// <summary>
        /// Guarda la empresa en xml en el escritrio mediante un nombre en especifico
        /// </summary>
        /// <param name="empresa"></param>
        /// <param name="nombreArchivo"></param>
        /// <returns></returns>
        public static bool GuardarXml(Empresa empresa, string nombreArchivo)
        {
            bool          auxSeGuardo = false;
            Xml <Empresa> xml         = new Xml <Empresa>();

            auxSeGuardo = xml.Guardar(nombreArchivo, empresa);

            return(auxSeGuardo);
        }
Beispiel #13
0
        /// <summary>
        /// Guardar en formato xml botines
        /// </summary>
        /// <param name="botin"></param>
        /// <param name="nombreArchivo"></param>
        /// <returns></returns>
        public static bool GuardarXml(Botin botin, string nombreArchivo)
        {
            bool        auxSeGuardo = false;
            Xml <Botin> xml         = new Xml <Botin>();

            auxSeGuardo = xml.Guardar(nombreArchivo, botin);

            return(auxSeGuardo);
        }
Beispiel #14
0
        public static bool Guardar(List <Persona> persona)
        {
            bool retorno = false;
            Xml <List <Persona> > guardarPersona = new Xml <List <Persona> >();

            retorno = guardarPersona.Guardar(AppDomain.CurrentDomain.BaseDirectory + "\\Personas.xml", persona);

            return(retorno);
        }
Beispiel #15
0
        /// <summary>
        /// Guarda en un archivo el comercio
        /// </summary>
        /// <param name="co">Comercio</param>
        /// <param name="path">string</param>
        /// <returns> Devuelve true si pudo guardar y false si no</returns>
        public static bool Guardar(string path, Comercio co)
        {
            bool           ret = false;
            Xml <Comercio> xml = new Xml <Comercio>();

            ret = xml.Guardar(path, co);

            return(ret);
        }
Beispiel #16
0
        /// <summary>
        /// Guarda en formato xml una zapatilla.
        /// </summary>
        /// <param name="zapatilla"></param>
        /// <param name="nombreArchivo"></param>
        /// <returns></returns>
        public static bool GuardarXml(Zapatilla zapatilla, string nombreArchivo)
        {
            bool            auxSeGuardo = false;
            Xml <Zapatilla> xml         = new Xml <Zapatilla>();

            auxSeGuardo = xml.Guardar(nombreArchivo, zapatilla);

            return(auxSeGuardo);
        }
Beispiel #17
0
        /// <summary>
        /// Guarda los datos de la Universidad en un archivo XML
        /// </summary>
        /// <param name="uni"></param>
        /// <returns></returns>
        public static bool Guardar(Universidad uni)
        {
            Xml <Universidad> xmlUniversidad = new Xml <Universidad>();

            if (xmlUniversidad.Guardar(string.Format(AppDomain.CurrentDomain.BaseDirectory + "Universidad.xml"), uni))
            {
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// Método para guardar en forma XML el objeto universidad.
        /// </summary>
        /// <param name="uni">Universidad a serializar.</param>
        /// <returns>Booleano que indica si pudo guardar o no.</returns>
        public static bool Guardar(Universidad uni)
        {
            bool pudoGuardar = false;
            Xml <Universidad> archivoASerializar = new Xml <Universidad>();

            if (archivoASerializar.Guardar("universidad.xml", uni))
            {
                pudoGuardar = true;
            }
            return(pudoGuardar);
        }
Beispiel #19
0
        /// <summary>
        /// serializará los datos del Universidad en un XML,
        /// incluyendo todos los datos de sus Profesores, Alumnos y Jornadas
        /// </summary>
        /// <param name="uni"></param>
        /// <returns></returns>
        public static bool Guardar(Universidad uni)
        {
            bool retorno = false;

            if (!(uni is null))
            {
                Xml <Universidad> xml = new Xml <Universidad>();
                retorno = xml.Guardar(AppDomain.CurrentDomain.BaseDirectory + "Universidad.xml", uni);
            }
            return(retorno);
        }
Beispiel #20
0
        /// <summary>
        /// Guardará en el directorio donde se encuentra el ejecutable los datos de la universidad en un archivo de extencion .xml
        /// </summary>
        /// <param name="uni">Universidad</param>
        /// <returns>True si puedo guardar los datos, false si no lo consigue.</returns>
        public static bool Guardar(Universidad uni)
        {
            Xml <Universidad> xml    = new Xml <Universidad>();
            string            nombre = "universidad";

            if (xml.Guardar(nombre, uni))
            {
                return(true);
            }
            return(false);
        }
Beispiel #21
0
        public void GenerarArchivosVenta()
        {
            string      pathArchivo  = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "venta.xml");
            Xml <Venta> serializador = new Xml <Venta>();

            serializador.Guardar(pathArchivo, this);

            pathArchivo = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "facturaVenta.txt");
            Texto <Venta> generadorFactura = new Texto <Venta>();

            generadorFactura.Guardar(pathArchivo, this);
        }
Beispiel #22
0
 /// <summary>
 /// Método estático Guardar
 /// Guarda una universidad en el archivo XML datosUniversidad.xml
 /// </summary>
 /// <param name="jornada"></param>
 /// <returns>Retorna true si se pudo guardar</returns>
 public static bool Guardar(Universidad uni)
 {
     try
     {
         Xml <Universidad> datosUniversidad = new Xml <Universidad>();
         datosUniversidad.Guardar("datosUniversidad.xml", uni);
         return(true);
     }
     catch (Exception e)
     {
         throw new ArchivosException(e);
     }
 }
        /// <summary>
        ///
        /// </summary>
        /// <param name="uni"></param>
        /// <returns></returns>
        public static bool Guardar(Universidad uni)
        {
            bool guardar              = false;
            Xml <Universidad> xml     = new Xml <Universidad>();
            string            archivo = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) +
                                        ".\\Universidad.xml";

            if (xml.Guardar(archivo, uni))
            {
                guardar = true;
            }
            return(guardar);
        }
Beispiel #24
0
        /// <summary>
        /// Serializa una lista de pedidos
        /// </summary>
        /// <returns>true si se guardo, false caso contrario</returns>
        public static bool Guardar()
        {
            string path = String.Concat(AppDomain.CurrentDomain.BaseDirectory, "MacDonald.xml");
            Xml <List <Turno> > auxPedidos = new Xml <List <Turno> >();

            List <Turno> pedidos = new List <Turno>();

            foreach (Turno item in EnPreparacion)
            {
                pedidos.Add(item);
            }

            return(auxPedidos.Guardar(path, pedidos));
        }
Beispiel #25
0
 /// <summary>
 /// Guarda la informacion del negocio en un archivo xml.
 /// </summary>
 /// <param name="artistica"></param>
 /// <returns></returns>
 public static bool Guardar(Artistica artistica)
 {
     try
     {
         string path = System.IO.Directory.GetCurrentDirectory()
                       + @"\ArchivosGuardados";
         System.IO.Directory.CreateDirectory(path);
         Xml <Artistica> archivo = new Xml <Artistica>();
         return(archivo.Guardar((path + @"\Artistica.xml"), artistica));
     }
     catch (Exception e)
     {
         throw new ArchivosException(e);
     }
 }
Beispiel #26
0
        /// <summary>
        /// Serializa la venta en un archivo .xml poniendo en su
        /// titulo la fecha y la hora en la que fue realizada la venta, esto utilizando el metodo Extension de AgregarFecha alojado en Entidades.ExtensionesDeVenta.
        /// </summary>
        /// <param name="listaDeProductos">Lista de productos a manejar</param>
        public static void GuardarVentasEnXml(List <Producto> listaDeProductos)
        {
            String nombreArchivoXml = "ArticulosVendidos.xml";

            nombreArchivoXml = nombreArchivoXml.AgregarFecha();

            foreach (Producto productoAux in listaDeProductos)
            {
                productoAux.Cantidad = 1;
            }


            Xml <List <Producto> > ArchivoVenta = new Xml <List <Producto> >();

            ArchivoVenta.Guardar(nombreArchivoXml, listaDeProductos);
        }
Beispiel #27
0
        /// <summary>
        /// metodo que serializa un objeto casino xml
        /// </summary>
        /// <param name="jugadores"></param>
        /// <returns></returns>
        public static bool Guardar(Casino jugadores)
        {
            bool rtn = false;

            Xml <Casino> aux = new Xml <Casino>();

            try
            {
                aux.Guardar("Casino.xml", jugadores);
                rtn = true;
            }
            catch (Excepciones.ArchivosException e)
            {
                throw new Excepciones.ArchivosException(e);
            }

            return(rtn);
        }
Beispiel #28
0
        /// <summary>
        /// Serializo 10 pedidos y los guardo
        /// </summary>
        /// <param name="pedidos"></param>
        /// <returns></returns>
        public static bool GuardarPedidosXml(List <PedidosVan> pedidos)
        {
            string path = String.Concat(AppDomain.CurrentDomain.BaseDirectory, "Pedidos.xml");
            Xml <List <PedidosVan> > auxPedidos = new Xml <List <PedidosVan> >();

            pedidos.Add(new PedidosVan(PedidosVan.EProductos.Alfajor, "1", PedidosVan.EDomicilios.Brazil34, "11111111", "Preparando", PedidosVan.eDelivery.No));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.Arroz, "2", PedidosVan.EDomicilios.DelValle2472, "22222222", "Preparando", PedidosVan.eDelivery.No));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.BebidaAlcoholica, "3", PedidosVan.EDomicilios.Florida1334, "33333333", "Preparando", PedidosVan.eDelivery.No));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.Cigarrillos, "4", PedidosVan.EDomicilios.Jamaica2500, "44444444", "Preparando", PedidosVan.eDelivery.No));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.Fideos, "5", PedidosVan.EDomicilios.Pavon3000, "55555555", "Preparando", PedidosVan.eDelivery.No));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.Gaseosa, "6", PedidosVan.EDomicilios.Brazil34, "66666666", "Preparando", PedidosVan.eDelivery.Si));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.JugoEnPolvo, "7", PedidosVan.EDomicilios.DelValle2472, "7777777", "Preparando", PedidosVan.eDelivery.Si));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.Manteca, "8", PedidosVan.EDomicilios.Florida1334, "88888888", "Preparando", PedidosVan.eDelivery.Si));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.Mermelada, "9", PedidosVan.EDomicilios.Jamaica2500, "999999999", "Preparando", PedidosVan.eDelivery.Si));
            pedidos.Add(new PedidosVan(PedidosVan.EProductos.Tostadas, "10", PedidosVan.EDomicilios.Pavon3000, "987654321", "Preparando", PedidosVan.eDelivery.Si));

            return(auxPedidos.Guardar(path, pedidos));
        }
Beispiel #29
0
        /// <summary>
        /// Guardar de clase serializará los datos del Universidad en un XML, incluyendo todos los datos de sus Profesores, Alumnos y Jornadas.
        /// </summary>
        /// <param name="uni">universidad a ser guardada</param>
        /// <returns>true si funciono</returns>
        public static bool Guardar(Universidad uni)
        {
            Xml <Universidad> xml = new Xml <Universidad>();
            bool retorno          = false;

            try
            {
                string[] aux = Regex.Split(Directory.GetCurrentDirectory(), @"\\Palmieri.Matias_Ezequiel.2C.TP3");
                aux[0] += "\\Universidad.xml";
                //string fileName = AppDomain.CurrentDomain.BaseDirectory + "PruebaDeGuardarUniversidad.xml";

                retorno = xml.Guardar(aux[0], uni);
            }
            catch (Exception e)
            {
                throw new Exception("Ocurrio un problema posiblemente en texto.guardar fijate la inner", e);
            }
            return(true);
        }
Beispiel #30
0
        /// <summary>
        /// Serializa la venta en un archivo .xml poniendo en su
        /// titulo la fecha y la hora en la que fue realizada la venta, esto utilizando el metodo Extension de AgregarFecha alojado en Entidades.ExtensionesDeVenta.
        /// </summary>
        /// <param name="listaDeProductos">Lista de productos a manejar</param>
        public static void GuardarVentasEnXml(List <Producto> listaDeProductos)
        {
            try
            {
                String nombreArchivoXml = "ArticulosVendidos.xml";
                nombreArchivoXml = nombreArchivoXml.AgregarFecha();

                foreach (Producto productoAux in listaDeProductos)
                {
                    productoAux.Cantidad = 1;
                }


                Xml <List <Producto> > ArchivoVenta = new Xml <List <Producto> >();
                ArchivoVenta.Guardar(nombreArchivoXml, listaDeProductos);
            }
            catch (ArchivoXmlException e)
            {
                Console.WriteLine(e.Message);
            }
        }