public void Read(string file_input) { if (File.Exists(file_input)) { XmlDocument doc = new XmlDocument(); doc.Load(file_input); XmlNodeList list_type = doc.GetElementsByTagName("type"); XmlNodeList list_month = doc.GetElementsByTagName("month"); XmlNodeList list_year = doc.GetElementsByTagName("year"); XmlNodeList list_time = doc.GetElementsByTagName("time"); XmlNodeList list_money = doc.GetElementsByTagName("money"); XmlNodeList list_unit = doc.GetElementsByTagName("unit"); XmlNodeList list_describe = doc.GetElementsByTagName("describe"); for (int i = 0; i < list_type.Count; i++) { DataType tmp = new DataType(); tmp.type = list_type[i].InnerText; tmp.date.month = list_month[i].InnerText; tmp.date.year = list_year[i].InnerText; tmp.time = list_time[i].InnerText; tmp.money = list_money[i].InnerText; tmp.unit = list_unit[i].InnerText; tmp.describe = list_describe[i].InnerText; data.Add(tmp); } } }
public Change(string time) { InitializeComponent(); this.ControlBox = false; InitCombobox(); tmp = Menux.MW.InitTextbox_ChangeForm(time); cbb_unit.Text = tmp.unit; tb_money.Text = tmp.money; tb_describe.Text = tmp.describe; }
private DataType GetDataFromTextbox() { DataType tmp = new DataType(); tmp.money = tb_money.Text; tmp.describe = tb_describe.Text; tmp.unit = cbb_unit.Text; tmp.type = "revenue"; tmp.time = System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); tmp.date.month = Menux.MW.date.month; tmp.date.year = Menux.MW.date.year; return tmp; }
public void Add(DataType tmp) { data.Add(tmp); }
public void UpdateData(DataType tmp) { for (int i = 0; i < data.Count; i++) { if (data[i].time == tmp.time) { data[i].describe = tmp.describe; data[i].unit = tmp.unit; data[i].money = tmp.money; return; } } }