private void radButton1_Click(object sender, EventArgs e) { double x; if (Double.TryParse(ratingAddTextBox.Text, out x)) { if (!RadForm1.locList.Contains(locAddTextBox.Text)) { RadForm1.locList.Add(locAddTextBox.Text); } RadForm1.recordList.Add(new Restaurant(nameAddTextBox.Text, locAddTextBox.Text, priceAddList.Text, x)); this.Close(); } else { RadForm3.ShowDialog(); } }
private void radButton1_Click_1(object sender, EventArgs e) { double x; if (Double.TryParse(ratingEditTextBox.Text, out x)) { if (!RadForm1.locList.Contains(locEditTextBox.Text)) { RadForm1.locList.Add(locEditTextBox.Text); } RadForm1.recordList.RemoveAt(Radform1Ref.restList.SelectedIndex); RadForm1.recordList.Insert(Radform1Ref.restList.SelectedIndex, new Restaurant(nameEditTextBox.Text, locEditTextBox.Text, priceEditList.Text, x)); this.Close(); } else { RadForm3.ShowDialog(); } }
private void genButton_Click(object sender, EventArgs e) { double b; if (greaterTextBox.Text.Equals("") && priceDropList.CheckedItems.Count != 0 && locationBox.CheckedItems.Count != 0) { List <Restaurant> list = new List <Restaurant>(); foreach (Restaurant x in recordList) { foreach (var loc in locationBox.CheckedItems) { foreach (var price in priceDropList.CheckedItems) { if (x.location.Equals(loc.ToString()) && x.price.Equals(price.ToString())) { list.Add(x); } } } } if (list.Count != 0) { Random rnd = new Random(); this.RadForm5 = new RadForm5(this, rnd.Next(0, list.Count)); RadForm5.ShowDialog(); } else { RadForm6.ShowDialog(); } } else if (locationBox.CheckedItems.Count == 0 && priceDropList.CheckedItems.Count == 0 && greaterTextBox.Text.Equals("")) { if (recordList.Count != 0) { Random rnd = new Random(); this.RadForm5 = new RadForm5(this, rnd.Next(0, recordList.Count)); RadForm5.ShowDialog(); } } else if (Double.TryParse(greaterTextBox.Text, out b)) { List <Restaurant> list = new List <Restaurant>(); foreach (Restaurant x in recordList) { foreach (var loc in locationBox.CheckedItems) { foreach (var pr in priceDropList.CheckedItems) { if (x.location.Equals(loc.ToString()) && x.price.Equals(pr.ToString()) && x.rating > b) { list.Add(x); } } } } if (list.Count != 0) { Random rnd = new Random(); this.RadForm5 = new RadForm5(this, rnd.Next(0, list.Count)); RadForm5.ShowDialog(); } else { RadForm6.ShowDialog(); } } else { RadForm3.ShowDialog(); } }