private void btnClearAll_Click(object sender, EventArgs e) { if (parentForm.House.Complaints.Count > 0) { rtbComplaint.Clear(); parentForm.House.Complaints.Clear(); parentForm.UpdateComplaints(); } else { MessageBox.Show("List is already empty"); } complaintsIndex = 0; }
private void btnFileComplaint_Click(object sender, EventArgs e) { string selectedDate = mcComplaint.SelectionRange.Start.ToShortDateString(); if (String.Compare(rtbDescription.Text, string.Empty) == 0 || String.Compare(rtbDescription.Text, "Description") == 0) { MessageBox.Show("Write a meaningful description!"); } else if (String.Compare(selectedDate, string.Empty) == 0) { MessageBox.Show("Select a correct date!"); } else { Complaint complaint = new Complaint(selectedDate, rtbDescription.Text); parentForm.House.Complaints.Add(complaint); rtbComplaints.Text = complaint.GetInfo(); parentForm.UpdateComplaints(); } }