Esempio n. 1
0
 public static void PrintEvent(Event eventToPrint)
 {
     if (eventToPrint != null)
     {
         output.Append(eventToPrint + "\n");
     }
 }
Esempio n. 2
0
 public void AddEvent(DateTime date, string title, string location)
 {
     Event newEvent = new Event(date, title, location);
     this.comparebyTitle.Add(title.ToLower(), newEvent);
     this.comparebyDate.Add(newEvent);
     Messages.EventAdded();
 }
Esempio n. 3
0
        private void show_edit_event_Load(object sender, EventArgs e)
        {
            delete_btn.Visible = false;
            Event.Event n = new Event.Event();
            n = n.getEvent(event_id, weekly);

            title_txt.Text   = n.getTitle();
            place_txt.Text   = n.getPlace();
            details_txt.Text = n.getDetails();
            kind             = n.getKind();
            if (n.getKind().ToLower() == "regular")
            {
                editalbe = true;
            }
            else if (n.getKind().ToLower() == "hw" && log_in_page.permission.ToLower() == "student")
            {
                editalbe = true;
            }
            else if (n.getKind().ToLower() == "muliplayer" && log_in_page.permission.ToLower() != "student")
            {
                editalbe = true;
            }
            else if (n.getKind().ToLower() == "system-public" && log_in_page.permission.ToLower() == "manager")
            {
                editalbe = true;
            }
            else
            {
                editalbe = false;
            }
            if (editalbe)
            {
                delete_btn.Visible = true;
            }
            if (!weekly)
            {
                date.Value          = n.getTheDate();
                day_in_week.Visible = false;
            }
            if (weekly)
            {
                date.Visible     = false;
                day_in_week.Text = "Every " + n.getDayInWeek();
            }

            hours_start.Value   = Int32.Parse(n.getHours_start());
            hours_end.Value     = Int32.Parse(n.getHours_end());
            minutes_start.Value = Int32.Parse(n.getMinutes_start());
            minutes_end.Value   = Int32.Parse(n.getMinutes_end());
            if (n.IsPrivate())
            {
                private_B.Checked = true;
                public_B.Checked  = false;
            }
            else
            {
                private_B.Checked = false;
                public_B.Checked  = true;
            }
        }
Esempio n. 4
0
 private void delete_btn_Click(object sender, EventArgs e)
 {
     Event.Event n = new Event.Event();
     n.deleteEvent(weekly, event_id);
     MessageBox.Show("Your event is deleted.");
     button2.PerformClick();
 }
Esempio n. 5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (title_txt.Text == "")
            {
                MessageBox.Show("please fill the title.");
            }
            else if (place_txt.Text == "" && kind != "HW")
            {
                MessageBox.Show("please fill the place.");
            }

            else if (hours_start.Value > hours_end.Value)
            {
                MessageBox.Show("your end time is before your start time.");
            }
            else if (hours_end.Value == hours_start.Value && minutes_end.Value <= minutes_start.Value)
            {
                MessageBox.Show("your end time is before your start time.");
            }
            else
            {
                string      privacy = "";
                Event.Event n       = new Event.Event();
                if (private_B.Checked == true)
                {
                    privacy = "private";
                }
                else if (public_B.Checked == true)
                {
                    privacy = "public";
                }
                bool updated = n.updateEvent(weekly, event_id, title_txt.Text, place_txt.Text, day_in_week_cb.Text, date.Value, hours_start.Value.ToString(), hours_end.Value.ToString(), minutes_start.Value.ToString(), minutes_end.Value.ToString(), details_txt.Text, privacy);
                if (updated)
                {
                    MessageBox.Show("updated");
                    button2.PerformClick();
                }
                else
                {
                    MessageBox.Show("not updated");
                }
            }
        }
Esempio n. 6
0
 public static int CompareEventsByTime(Event ev1, Event ev2)
 {
     if (ev1.Time > ev2.Time) return 1;
     if (ev1.Time < ev2.Time) return -1;
     return 0;
 }