Esempio n. 1
0
        public bool DeserializarXML()
        {
            Cajon <T> cajon = new Cajon <T>();

            try
            {
                XmlSerializer xm = new XmlSerializer(typeof(Cajon <T>));
                XmlTextReader w  = new XmlTextReader("E:\\ListaPersonaXML.xml");
                cajon = (Cajon <T>)xm.Deserialize(w);
                w.Close();

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
Esempio n. 2
0
        public static bool ImprimirTicket(this Cajon <Platano> c, string path)
        {
            DateTime local      = DateTime.Now;
            string   direccion1 = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            string   dato       = "Precio Total: " + c.PrecioTotal.ToString() + "Fecha: " + local.ToString();

            try
            {
                StreamWriter sw = new StreamWriter("E:\\CajonManzanas.txt");
                sw.WriteLine(dato);
                sw.Close();

                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }