Esempio n. 1
0
        private void accept_Click(object sender, EventArgs e)
        {
            if (Preu == int.MinValue || ActivitySelected == int.MinValue)
            {
                MessageBox.Show("Has de seleccionar una activitat i un usuari", "Error al processar l'inscripció!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                try
                {
                    string msg = ("¿Segur que vols inscriure l'usuari amb DNI " + DNIres.Text +
                                  " a l'activitat de ID " + ActivitySelected);
                    int res = (int)MessageBox.Show(msg, "Confirmació Inscripció", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                    if (res == 6)
                    {
                        service.EnrollUserInActivity(ActivitySelected, DNIres.Text);

                        this.Hide();
                        GestDepApp menu = new GestDepApp(service);
                        menu.Show();
                    }
                } catch (ServiceException ex)
                {
                    MessageBox.Show(ex.Message, "Error al processar l'inscripció!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Esempio n. 2
0
        private void atras_Click(object sender, EventArgs e)
        {
            this.Hide();
            GestDepApp menu = new GestDepApp(service);

            menu.Show();
        }
Esempio n. 3
0
        private void cancelarActivitat(object sender, EventArgs e)
        {
            this.Hide();
            GestDepApp menu = new GestDepApp(service);

            menu.Show();
        }
Esempio n. 4
0
        private void clickCancel(object sender, EventArgs e)
        {
            this.Hide();
            GestDepApp menu = new GestDepApp(service);

            menu.Show();
        }
Esempio n. 5
0
        private void clickAdd(object sender, EventArgs e)
        {
            try
            {
                string   nombre     = name_text.Text;
                string   adress     = adresa_text.Text;
                string   IBAN       = iban_text.Text;
                int      ZipCode    = Int32.Parse(zipCode_text.Text);
                string   DNI        = DNI_text.Text;
                bool     Jubilado   = retired_check.Checked;
                DateTime nacimiento = birthDate.Value;

                service.AddNewUser(adress, IBAN, DNI, nombre, ZipCode, nacimiento, Jubilado);
            }
            catch (ServiceException sE) {
                var result = MessageBox.Show(sE.Message, "Error al afegir usuari", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (System.FormatException Fe)
            {
                var result = MessageBox.Show(Fe.Message, "Error de format", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Hide();
            GestDepApp menu = new GestDepApp(service);

            menu.Show();
        }
Esempio n. 6
0
        private void afegirActivitat(object sender, EventArgs e)
        {
            try
            {
                ICollection <int> roomsId = new List <int>();
                foreach (object item in checkRooms.CheckedItems)
                {
                    roomsId.Add(Int32.Parse(item.ToString()));
                }

                ICollection <int> dias = new List <int>();
                foreach (int indice in checkDays.CheckedIndices)
                {
                    dias.Add(indice + 1);
                }

                Days activityDays = 0;

                foreach (int dia in dias)
                {
                    activityDays = activityDays | service.returnDays(dia);
                }

                //  Days activityDays = dia_activitat.Text;
                string   description = descripcio.Text;
                TimeSpan duration    = TimeSpan.Parse(duracio.Text);
                DateTime firstDate   = datainici.Value;
                DateTime endDate     = datafi.Value;
                DateTime startHour   = DateTime.Parse(horainici.Text);

                int maxiumEnrollments = Int32.Parse(aforomaxim.Text);
                int miniumEnrollments = Int32.Parse(minimaforo.Text);
                int price             = Int32.Parse(preu.Text);

                service.AddNewActivity(activityDays, description, duration, endDate, maxiumEnrollments, miniumEnrollments, price, firstDate, startHour, roomsId);



                this.Hide();
                GestDepApp menu = new GestDepApp(service);
                menu.Show();
            } catch (ServiceException ex) {
                MessageBox.Show(ex.Message, "Error al crear l'Activitat",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message, "Error al crear l'Activitat",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 7
0
        private void listActs_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                int id = Int32.Parse((string)listActs.Items[listActs.SelectedIndex]);
                service.GetActivityDataFromId(id, out Days activityDays, out String description, out TimeSpan duration,
                                              out DateTime finishDate, out int maximumEnrollments, out int minimumEnrollments, out double price,
                                              out DateTime startDate, out DateTime startHour, out ICollection <int> enrollmentIds,
                                              out String instructorId, out ICollection <int> roomIds);
                monitorAfegit.Text = "";

                DateTime datafi       = finishDate;
                string   txtdatafi    = datafi.ToShortDateString();
                DateTime inicidata    = startDate;
                string   txtinicidata = inicidata.ToShortDateString();
                DateTime horainici    = startHour;
                string   txthorainici = horainici.ToShortTimeString();

                infoAct.Text = ("Dias de la actividad: " + activityDays + "\n"
                                + "Descripción: " + description + "\n"
                                + "Duracion: " + duration + "\n"
                                + "Fecha de inicio: " + txtinicidata + "\n"
                                + "Hora de inicio: " + txthorainici + "\n"
                                + "Fecha de finalización" + txtdatafi + "\n"
                                + "Monitor:" + instructorId + "\n"
                                + "Precio: " + price + "\n");
                //posar try catch
                ICollection <string> monitors = service.GetAvailableInstructorsIds(activityDays, duration, finishDate, startDate, startHour);
                listMonitor.Items.Clear();
                foreach (string ids in monitors)
                {
                    listMonitor.Items.Add(ids);
                }
            }
            catch (ServiceException ser) { MessageBox.Show(ser.Message, "Error al afegir monitor", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                           this.Hide();
                                           GestDepApp menu = new GestDepApp(service);
                                           menu.Show(); }
        }