示例#1
0
        private void GuardarArchivo(Cajon <T> elemento, EventArgs e)
        {
            StreamWriter writer = new StreamWriter(elemento.RutaArchivo + @"\Archivo.txt");

            if (writer != null)
            {
                writer.WriteLine("Precio TOTAL: $" + elemento.PrecioTotal.ToString());
                writer.WriteLine(DateTime.Now.ToString());
            }
            writer.Close();
        }
示例#2
0
        public static Cajon <T> operator +(Cajon <T> c, T f)
        {
            Cajon <T> retorno = c;

            if ((f is Fruta) && (retorno._frutas.Count < retorno._capacidad))
            {
                retorno._frutas.Add(f);
            }
            else if (retorno._frutas.Count >= retorno._capacidad)
            {
                throw new CajonLlenoException("El cajon esta lleno");
            }
            return(retorno);
        }
示例#3
0
        public bool DeserializarXML()
        {
            bool          retorno    = false;
            XmlTextReader reader     = new XmlTextReader(this.RutaArchivo);
            XmlSerializer serializer = new XmlSerializer(typeof(Cajon <T>));

            try
            {
                Cajon <T> cajon = new Cajon <T>();

                cajon = (Cajon <T>)serializer.Deserialize(reader);
                reader.Close();
                retorno = true;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(retorno);
        }