Exemple #1
0
        private void SubmitProjectButton_Click(object sender, EventArgs e)
        {
            if (ProjectNameTextBox.Text == "")
            {
                EmptyProjectNameWarningLabel.Visible = true;
            }
            else
            {
                EmptyProjectNameWarningLabel.Visible = false;

                DateTime start = ProjDateStart.Value;
                DateTime end   = ProjectDateEnd.Value;
                if (start > end)
                {
                    MessageBox.Show("Please enter valid dates!");
                    return;
                }
                Project p = new Project(ProjectNameTextBox.Text, start, end, ColorBtn.BackColor, ProjectDescriptionTextBox.Text);
                SqlClass.AddProject(p);

                if (ProjectAdded != null)
                {
                    ProjectAdded(null);
                }
                this.Close();
            }
        }
Exemple #2
0
        //Remove event clicked from database and GUI
        private void delete_Click(object sender, System.EventArgs e, int eventNumber, DayFrame df, ListView listView)
        {
            SqlClass.DeleteAppointment(df.events[eventNumber]);    //delete from database
            listView.Items.RemoveAt(eventNumber);
            ListViewItem item = new ListViewItem("", 0);

            listView.Items.Insert(eventNumber, item);
            this.Controls.Add(listView);
        }
Exemple #3
0
        static void Main()
        {
            SqlClass.InitializeDB();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MonthlyView mv = new MonthlyView();

            Application.Run(mv);
        }
Exemple #4
0
        //Open add event form with current data filled in so user can edit event information
        //Deletes old event and adds new one through standard addEventForm Method
        private void newEdit_Click(object sender, System.EventArgs e, int eventNumber, DayFrame df, ListView listView)
        {
            var f = new AddEventForm();

            f.EventAdded += new Action <DateTime>(blankMethod);
            f.EventName   = df.events[eventNumber].Name;
            f.EventDesc   = df.events[eventNumber].Description;
            f.EventTime   = df.events[eventNumber].When;
            SqlClass.DeleteAppointment(df.events[eventNumber]);
            this.Close();
            f.ShowDialog();
        }
Exemple #5
0
        //public Event newEvent
        //{
        //    get { return newEvent; }
        //}

        private void SubmitEventButton_Click(object sender, EventArgs e)
        {
            if (EventNameTextBox.Text == "")
            {
                EmptyEventNameWarningLabel.Visible = true;
                return;
            }
            DateTime date     = EventDatePicker.Value;
            DateTime time     = EventTimePicker.Value;
            DateTime combined = new DateTime(date.Year, date.Month, date.Day, time.Hour, time.Minute, 0);
            Event    newEvent = new Event(EventNameTextBox.Text, combined, EventDescriptionTextBox.Text);

            SqlClass.AddEvent(newEvent);
            if (EventAdded != null)
            {
                EventAdded(combined);
            }

            //EventAdded?.Invoke(combined);
            Close();
        }