コード例 #1
0
        public void Guardar(Entity.Credito credito)
        {
            FileStream   fileStream = new FileStream(ruta, FileMode.Append);
            StreamWriter writer     = new StreamWriter(fileStream);

            writer.WriteLine(credito.ToString());
            writer.Close();
            fileStream.Close();
        }
コード例 #2
0
        public List <Entity.Credito> Consultar()
        {
            creditos.Clear();
            FileStream   fileStream = new FileStream(ruta, FileMode.OpenOrCreate);
            StreamReader reader     = new StreamReader(fileStream);
            string       line       = string.Empty;

            while ((line = reader.ReadLine()) != null)
            {
                Entity.Credito credito = Map(line);
                creditos.Add(credito);
            }
            fileStream.Close();
            reader.Close();
            return(creditos);
        }
コード例 #3
0
        public void Modificar(Entity.Credito credito)
        {
            creditos.Clear();
            creditos = Consultar();
            FileStream fileStream = new FileStream(ruta, FileMode.Create);

            fileStream.Close();
            foreach (var item in creditos)
            {
                if (item.Identificacion != credito.Identificacion)
                {
                    Guardar(item);
                }
                else
                {
                    Guardar(credito);
                }
            }
        }
コード例 #4
0
 public void AgregarCredito(Credito credito)
 {
     Credito = credito;
 }