示例#1
0
        public static bool ImprimirTicket(Cartuchera <T> c1)
        {
            string ruta = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\tickets.log";
            bool   rta  = true;

            try
            {
                if (File.Exists(ruta))
                {
                    using (StreamWriter sw = new StreamWriter(ruta, true))
                    {
                        sw.WriteLine("Fecha : {0}", DateTime.Now);
                        sw.WriteLine("Total Cartuchera: {0}", c1.PrecioTotal);
                    }
                }
                else
                {
                    using (StreamWriter sw = new StreamWriter(ruta, false))
                    {
                        sw.WriteLine("Fecha : {0}", DateTime.Now);
                        sw.WriteLine("Total Cartuchera: {0}", c1.PrecioTotal);
                    }
                }
            }
            catch (Exception e)
            {
                return(false);
            }

            return(rta);
        }
        public static bool ImprimirTiket(Cartuchera <T> c)
        {
            string path = Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + @"\tikets.log";
            bool   ret  = false;

            StringBuilder sb = new StringBuilder();

            sb.AppendLine(DateTime.Now.ToString());
            sb.AppendLine(c.PrecioTotal.ToString());


            try
            {
                using (StreamWriter sw = new StreamWriter(path, true))
                {
                    sw.WriteLine(sb.ToString());
                }
                ret = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(ret);
        }
示例#3
0
        public static bool ImprimirTicket(Cartuchera <Goma> c)
        {
            bool aux = false;

            try
            {
                using (StreamWriter writer = new StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\" + "tickets.log", true))
                {
                    writer.WriteLine(DateTime.Now);
                    writer.WriteLine(c.PrecioTotal);
                    aux = true;
                }
            }
            catch (Exception)
            {
            }
            return(aux);
        }