Example #1
0
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            List <Account> userlogs        = Form1.ReadXML();
            Account        accountToDelete = null;

            foreach (Account acc in userlogs)
            {
                if (acc.Mail.Equals(theAccount.Mail))
                {
                    accountToDelete = acc;
                }
            }
            userlogs.Remove(accountToDelete);
            this.Hide();

            theAccount.TheCalendar.TheRendezvous.Remove(leRendezvous);
            mainWindow.clearCalendar();
            mainWindow.createCalendar(theMonth, theYear, 101, 74);


            userlogs.Add(theAccount);
            Inscription.WriteXML(userlogs);
        }
Example #2
0
        // Registration
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            Inscription isc = new Inscription();

            isc.Show();
        }
Example #3
0
        private void buttonSubmit_Click(object sender, EventArgs e)
        {
            List <Account> userlogs        = Form1.ReadXML();
            Account        accountToDelete = null;

            foreach (Account acc in userlogs)
            {
                if (acc.Mail.Equals(theAccount.Mail))
                {
                    accountToDelete = acc;
                }
            }
            userlogs.Remove(accountToDelete);

            bool isPossible = true;

            TimeSpan        diff          = this.endDateTimePicker.Value - this.startDateTimePicker.Value;
            int             diffDays      = (int)diff.TotalDays;
            List <DateTime> listDaysTaken = theAccount.TheCalendar.getListTakenDays();

            if (editMode)
            {
                foreach (DateTime dt in leRendezvous.getListDays())
                {
                    listDaysTaken.Remove(dt);
                }
            }


            for (int i = 0; i < diffDays; i++)
            {
                if (listDaysTaken.Contains(this.startDateTimePicker.Value.AddDays(i)))
                {
                    isPossible = false;
                }
            }


            if (this.textBoxTitle.Text.Equals(""))
            {
                MessageBox.Show("Veuillez mettre un intitulé.");
            }
            else if (!isPossible)
            {
                MessageBox.Show("Modification impossible, un autre rendez-vous est en conflit!");
            }
            else
            {
                if (editMode)
                {
                    leRendezvous.Title      = this.textBoxTitle.Text;
                    leRendezvous.StartDate  = this.startDateTimePicker.Value;
                    leRendezvous.EndDate    = this.endDateTimePicker.Value;
                    leRendezvous.Comment    = this.textBoxComment.Text;
                    leRendezvous.IsVacation = this.vacationCheckBox.Checked;
                }
                else
                {
                    theAccount.TheCalendar.createRendezvous(this.textBoxTitle.Text, this.startDateTimePicker.Value, this.endDateTimePicker.Value, this.textBoxComment.Text, this.vacationCheckBox.Checked);
                }
                mainWindow.clearCalendar();
                mainWindow.createCalendar(theMonth, theYear, 101, 74);
                this.Hide();
            }
            userlogs.Add(theAccount);
            Inscription.WriteXML(userlogs);
        }