public void FillGrid() { grid.Rows.Clear(); int index = 1; for (int i = indications.Count - 1; i > 1; i--) { grid.Rows.Add(index, indications[i].Water_Bathroom.Cold.ToString(), indications[i].Water_Bathroom.Hot.ToString(), indications[i].Water_Kitchen.Cold.ToString(), indications[i].Water_Kitchen.Hot.ToString(), indications[i].Electricity.Day.ToString(), indications[i].Electricity.Night.ToString(), Indication.GetDifference(indications[i - 1], indications[i]), indications[i].Date.ToLongDateString() ); index++; } }
private void AddNewButton_Click(object sender, EventArgs e) { var indication = new Indication ( new Water(int.Parse(kitch_Cold_TB.Text), int.Parse(kitch_Hot_TB.Text)), new Water(int.Parse(bath_Cold_TB.Text), int.Parse(bath_Hot_TB.Text)), new Electricity(int.Parse(dayTB.Text), int.Parse(nightTB.Text)), DateTime.Now ); RecordAddedEventArgs eventArgs = new RecordAddedEventArgs() { Indication = indication }; RecordAdded(this, eventArgs); this.Close(); }
public static double GetDifference(Indication self, Indication record) { return(Math.Ceiling(record.GetSumm() - self.GetSumm())); }