public ActivityControl(SportActivity s) { this.s = s; r = Repository.Instance; InitializeComponent(); }
private SportActivity Add() { SportActivity sport = null; if (string.IsNullOrEmpty(textbox_name.Text) || string.IsNullOrEmpty(combobox_sportclub.Text) || string.IsNullOrEmpty(textbox_price.Text)) { throw new ArgumentException("Пожалуйста, заполните все поля (описание по желанию)"); } else { if (double.Parse(textbox_price.Text) < 0) { throw new ArgumentException("Цена отрицательная"); } SportActivity s = new SportActivity(textbox_name.Text, r.SportClubs.First(e1 => e1.ClubName.Equals(combobox_sportclub.Text)), textbox_desc.Text, week_time, double.Parse(textbox_price.Text), CurrentActivity.Activity); sport = s; } return(sport); }
public PageAddSection(SportActivity _s) { InitializeComponent(); r = Repository.Instance; week_time = new Dictionary <string, string>(); s = _s; if (s != null) { buttonAddEdit.Content = "Редактировать"; textbox_name.Text = s.Title; textbox_desc.Text = s.Description; textbox_price.Text = s.Price.ToString(); combobox_sportclub.Text = s.Club.ClubName; week_time = s.WeekDayTime; foreach (var item in s.WeekDayTime) { list_week_time.Items.Add(item.Key + " " + item.Value); } } }
public void AddSportActivity(SportActivity s) { sportActivities.Add(s); }