public int InputHandler() { string FullPath = DataBaseFile; if (File.Exists(FullPath)) { InputStream = new StreamReader(FullPath); if(new FileInfo(FullPath).Length > 0) { databaseSize = int.Parse(InputStream.ReadLine()); for (int DataIndex = 0; DataIndex < databaseSize; ++DataIndex) { Form1.DataCapsule data = new Form1.DataCapsule(); data.id = DataIndex + 1; data.name = InputStream.ReadLine(); data.date = InputStream.ReadLine(); data.schoolid = InputStream.ReadLine(); data.curp = InputStream.ReadLine(); DataList.Add(data); } } InputStream.Close(); return 1; } return 0; }
public void EditData(Form1.DataCapsule edit) { tName.Text = edit.name; dDate.Value = new DateTime( int.Parse(edit.date.Substring(0, 4)), int.Parse(edit.date.Substring(5, 2)), int.Parse(edit.date.Substring(8, 2))); tId.Text = edit.schoolid; tCurp.Text = edit.curp; this.Text = "Editar entrada"; }
public Form2(Form1.DataCapsule edit) { InitializeComponent(); InitializeDataEntry(); EditData(edit); }