Exemple #1
0
        /// <summary>
        /// Primer Parcial: Agregar el elemento a la mueblería.
        /// Segundo Parcial y Final: Al presionar el botón agregar se deberá guardar la información a un archivo, anexando el nuevo Asiento al final. Agregar el elemento a la lista.
        /// Luego, leer el archivo y mostrarlo en el RichTextBox.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            short     alto        = short.Parse(this.nudAlto.Value.ToString());
            short     ancho       = short.Parse(this.nudAncho.Value.ToString());
            short     profundidad = short.Parse(this.nudProfundidad.Value.ToString());
            Random    random      = new Random();
            int       numero      = random.Next(0, 4);
            ColorSofa enumerado   = (ColorSofa)numero;

            //if (this.asiento is Sofa)
            //{
            this.asiento = new Sofa(alto, ancho, profundidad, enumerado);

            //archivoXML.Guardar("Sofa.txt", asiento);
            try
            {
                archivoTXT.Guardar("Sofa.txt", asiento.ToString());
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }



            //}
            this.lista.Add(asiento);
            //archivoXML.Leer("Sofa.txt)";
            string lectura = archivoTXT.Leer("Sofa.txt");

            this.rtbMensaje.Text = lectura;
        }
Exemple #2
0
        public void Test_SeeToStringResult()
        {
            var asiento = new Asiento();

            asiento.AddPartidaDebit(GetClientesAccount(), 3630);
            asiento.AddPartidaCredit(GetVentasAccount(), 3000);
            Assert.IsFalse(asiento.Balances());
            asiento.AddPartidaCredit(GetHaciendaPublicaIVARepercutidoAccount(), 630);
            Assert.IsTrue(asiento.Balances());
            Console.WriteLine(asiento.ToString());
        }