コード例 #1
0
        public ActivityControl(SportActivity s)
        {
            this.s = s;
            r      = Repository.Instance;

            InitializeComponent();
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 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);
         }
     }
 }
コード例 #4
0
 public void AddSportActivity(SportActivity s)
 {
     sportActivities.Add(s);
 }