예제 #1
0
        public static void SchedulesRemoveDataBase(string time, string nameWorkout)
        {
            var manhattanInfo = DataBaseLevel.GetManhattanInfo();

            //  Проверка. Содержит ли список запись с временем
            var isExist = IsSchedExists(time, nameWorkout, manhattanInfo);
            var schl    = new ScheduleNote(new MyTime(time), nameWorkout);

            if (isExist)
            {
                manhattanInfo.Schedule.RemoveAll(x => x.GetTimeAndNameStr().Equals(schl.GetTimeAndNameStr()));
            }
        }
예제 #2
0
        private void button_add_sched_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textBox_nameTren.Text))
            {
                MessageBox.Show(@"Введите Название!", @"Внимание", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var time      = new MyTime($"{comboBox_time_H.Text}:{comboBox_time_M.Text}");
            var sch       = new ScheduleNote(time, textBox_nameTren.Text);
            var isSuccess = Logic.SchedulesAdd2DataBase(time, sch);

            if (isSuccess)
            {
                MyListViewEx.AddScheduleNote(listView_schedule, sch);
            }
        }
예제 #3
0
        public static bool SchedulesAdd2DataBase(MyTime time, ScheduleNote sch)
        {
            var manhattanInfo = DataBaseLevel.GetManhattanInfo();

            //  Проверка. Содержит ли список запись с добавляемым временем
            var isExist = IsSchedExists(time.HourMinuteTime, sch.WorkoutsName, manhattanInfo);

            if (isExist)
            {
                MessageBox.Show(@"Такая тренировка уже существует. Измените время или название!", @"Внимание",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            manhattanInfo.Schedule.Add(sch);
            return(true);
        }
예제 #4
0
 // Врема начала и название тренировки
 public ScheduleNoteItem(ScheduleNote note)
 {
     Text = note.Time.HourMinuteTime;
     SubItems.Add(note.WorkoutsName);
 }
예제 #5
0
        // Пример
        //public static void ListView_Resize_Event1(object sender, EventArgs e)
        //{
        //    MaximizeLastColumn((ListView)sender);
        //}

        #endregion

        #region ///  BOSS Form ///

        public static void AddScheduleNote(ListView listViewIn, ScheduleNote scheduleNote)
        {
            listViewIn.Items.Add(new ScheduleNoteItem(scheduleNote));
            listViewIn.Update();
        }