private void AddNewProgram_Click(object sender, EventArgs e)
        {
            AddNewProgramForm form = new AddNewProgramForm();

            form.ShowDialog();
            models = WorkWithText.GetAllTeleprograms();
            MainGrid.DataSource = models;
        }
Beispiel #2
0
        private void AddNewProgram_Click(object sender, EventArgs e)
        {
            var models = WorkWithText.GetAllTeleprograms();

            models.Add(ReadFromForm());
            WorkWithText.SaveProgram(models);
            this.Close();
        }
Beispiel #3
0
        public void DeleteProgram(ICollection <TeleprogramModel> models)
        {
            var nonExpiredPrograms = new List <TeleprogramModel>();

            foreach (var teleprogramModel in models)
            {
                if (WorkWithText.GetDateFromString(teleprogramModel.Date) >= DateTime.Today)
                {
                    nonExpiredPrograms.Add(teleprogramModel);
                }
            }
            WorkWithText.SaveProgram(nonExpiredPrograms);
        }
        public MainForm()
        {
            InitializeComponent();
            FileManager manager = new FileManager(DbLocation);

            manager.CreateDirectory();
            manager.CreateFile();
            if (WorkWithText.GetAllTeleprograms().Count == 0)
            {
                WorkWithText.AddFakeDb();
            }
            models = WorkWithText.GetAllTeleprograms();
            MainGrid.DataSource = models;
            helper = new DatabaseHelper();
        }
 private void DeletePrograms_Click(object sender, EventArgs e)
 {
     helper.DeleteProgram(models);
     models = WorkWithText.GetAllTeleprograms();
     MainGrid.DataSource = models;
 }
 private void SaveFavourites_Click(object sender, EventArgs e)
 {
     WorkWithText.SaveProgram(models.Where(x => x.isSaved == true).ToList(), SavedProgramsLocation);
 }
 private void Month_Click(object sender, EventArgs e)
 {
     MainGrid.DataSource = helper.GetProgramsForMonth(models);
     WorkWithText.SaveProgram(models);
 }
 private void ViewAll_Click(object sender, EventArgs e)
 {
     MainGrid.DataSource = models;
     WorkWithText.SaveProgram(models);
 }
 private void PinButton_Click(object sender, EventArgs e)
 {
     MainGrid.DataSource = models.Where(x => x.isSaved == true).ToList();
     WorkWithText.SaveProgram(models);
 }