Exemplo n.º 1
0
        /// <summary>
        /// Allows to register a new cash Register
        /// </summary>
        /// <param name="d">Object type CierreCaja</param>
        public void registrarCierreCaja(CierreCaja d)
        {
            string path = Path.GetFullPath("CierresCaja.txt");//para agregar carpetas afuera agrego ..\\

            if (!File.Exists(path))
            {
                // Create a file to write to.
                using (StreamWriter sw = File.CreateText(path))
                {
                    sw.WriteLine(d.ToString());
                    sw.Close();
                }
            }
            else
            {
                using (StreamWriter file = new StreamWriter(path, true))
                {
                    file.WriteLine(d.ToString()); //se agrega información al documento

                    file.Close();
                }
            }
        }