Esempio n. 1
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            ReminderFilePath = @"data/" + MainWindow.username + "Reminder.csv";
            string type;

            if (rdobtnMeeting.Checked)
            {
                type = rdobtnMeeting.Text;
            }
            else
            {
                type = rdobtnTask.Text;
            }
            MeetingTaskReminder reminder = new MeetingTaskReminder(txtboxDate.Text, mtxtboxTime.Text, txtSummary.Text,
                                                                   txtDescription.Text, type, MainWindow.username);

            LoginForm.UserList[MainWindow.index].Reminders.Add(reminder);
            Util.SaveCsv(reminder, ReminderFilePath);
            MessageBox.Show("Reminder registered", "Save", MessageBoxButtons.OK);
            txtboxDate.Text     = "";
            txtDescription.Text = "";
            txtSummary.Text     = "";
            mtxtboxTime.Text    = "";
            if (rdobtnMeeting.Checked)
            {
                rdobtnMeeting.Checked = false;
            }
            else
            {
                rdobtnTask.Checked = false;
            }
        }
Esempio n. 2
0
        private void btnUptade_Click(object sender, EventArgs e)
        {
            ReminderFilePath = @"data/" + MainWindow.username + "Reminder.csv";
            string type;

            if (rdobtnMeeting.Checked)
            {
                type = rdobtnMeeting.Text;
            }
            else
            {
                type = rdobtnTask.Text;
            }
            try
            {
                MeetingTaskReminder reminder = new MeetingTaskReminder(txtboxDate.Text, mtxtboxTime.Text, txtSummary.Text,
                                                                       txtDescription.Text, type, MainWindow.username);
                var file = new List <string>(System.IO.File.ReadAllLines(ReminderFilePath));
                file.Insert(lstReminder.FocusedItem.Index, reminder.ReminderToCsv());
                file.RemoveAt(lstReminder.FocusedItem.Index + 1);
                System.IO.File.WriteAllLines(ReminderFilePath, file.ToArray());
                btnList_Click(sender, e);
            }
            catch (Exception)
            {
                MessageBox.Show("Select a reminder for updating.");
            }
        }
Esempio n. 3
0
 public static void SaveCsv(MeetingTaskReminder reminder, string csvPath)
 {
     try
     {
         using (StreamWriter writer = File.AppendText(csvPath))
         {
             writer.WriteLine(reminder.ReminderToCsv());
         }
     }
     catch (Exception)
     {
         Console.WriteLine("The file could not be write:");
     }
 }