コード例 #1
0
 private void Seleziona()
 {
     bambino              = (Bambino)bsBambini[bsBambini.Position];
     NomeBambini.Text     = bambino.Nome;
     CognomeBambini.Text  = bambino.Cognome;
     ClasseBambini.Text   = bambino.Classe;
     nascitaBambini.Value = bambino.DataNascita;
     if (bambino.Path != "")
     {
         try
         {
             ofdFoto.FileName          = bambino.Path;
             Bambini_pic.ImageLocation = ofdFoto.FileName;
         }
         catch
         {
             Bambini_pic.Image = Maestre.Properties.Resources.No_image;
             ofdFoto.FileName  = bambino.Path;
         }
     }
     else
     {
         Bambini_pic.Image = Maestre.Properties.Resources.No_image;
         ofdFoto.FileName  = bambino.Path;
     }
 }
コード例 #2
0
        public void GetMoreDetailsFromBaby()
        {
            var bambino = new Bambino {
                Address = "HereOrThere"
            };

            Console.WriteLine("Baby has now moved {0}", bambino.Address);
        }
コード例 #3
0
        public void GetDetailsFromBaby()
        {
            var bambino = new Bambino {
                Address = "A New Place"
            };

            bambino.DisplayBabyName();
            Console.WriteLine("The baby now lives at: " + bambino.Address);
        }
コード例 #4
0
 private void TabellaBambini_SelectionChanged(object sender, EventArgs e)
 {
     try
     {
         Bambino bambino = new Bambino();
         bambino = (Bambino)bsBambini[bsBambini.Position];
         Bambini_pic.ImageLocation = bambino.Path;
     }
     catch
     {
         Bambini_pic.Image = Maestre.Properties.Resources.No_image;
     }
 }
コード例 #5
0
        private void Avanti_button_Click(object sender, EventArgs e)
        {
            int anni = -1;

            if (radioButton1.Checked)
            {
                anni = 3;
            }
            else if (radioButton2.Checked)
            {
                anni = 4;
            }
            else if (radioButton3.Checked)
            {
                anni = 5;
            }
            else
            {
                MessageBox.Show("inserisci la tua etá!");
                return;
            }

            if (nome_textbox.Text == "" || nome_textbox.Text == "")
            {
                MessageBox.Show("Inserire prima il nome");
                return;
            }

            if (cognome_textbox.Text == "" || cognome_textbox.Text == "")
            {
                MessageBox.Show("Inserire prima il cognome");
                return;
            }

            Bambino daPassare = Queries.getBambino(new Bambino(nome_textbox.Text, cognome_textbox.Text, DateTime.Now, classiCB.Text, null), anni);

            if (daPassare == null)
            {
                MessageBox.Show("Bambino non trovato");
                return;
            }

            Hide();
            seitu seitu = new seitu(daPassare);

            seitu.ShowDialog();
            Show();
        }
コード例 #6
0
        private void ConfermaEliminaBambini_Click(object sender, EventArgs e)
        {
            Bambino bambino = new Bambino();

            bambino   = (Bambino)bsBambini[bsBambini.Position];
            updateGUI = Queries.delBambino(bambino.ID);
            if (updateGUI)
            {
                try
                {
                    Bambini_pic.ImageLocation = "";
                    Bambini_pic.Refresh();
                    File.Delete(bambino.Path);
                }
                catch (Exception ex)
                { }
                MessageBox.Show("Bambino eliminato");
            }
        }
コード例 #7
0
        static void Main(string[] args)
        {
            Umano io = new Umano(true, "Martino");

            Bambino figlio1 = new Bambino();


            //io.Mangia("colazione", 3);
            if (!io.HoDigerito)
            {
                if (io.Indigestione(true))
                {
                    io.FaiCacca();
                }
            }

            io.Mangia();

            Stack <Umano> pilaUmani  = new Stack <Umano>();
            List <Umano>  listaUmani = new List <Umano>();

            listaUmani.RemoveAll(x => x.Nome == "Martino");
        }
コード例 #8
0
        private int verificaComune(Bambino newBambino, int p)
        {
            int ris = 0;

            string sql = "SELECT idCitta FROM Turni INNER JOIN Centri ON idCentro = Centri.id WHERE Turni.id = " + newBambino.turni[p, 0];
            adoNet ado = new adoNet();
            string txt = ado.eseguiScalar(sql, CommandType.Text);

            if (newBambino.citta == Convert.ToInt32(txt))
            {
                ris = 1;
            }
            else
            {
                sql = "SELECT COUNT(*) FROM FuoriComune INNER JOIN  Centri ON idCentro =Centri.id INNER JOIN Turni ON Turni.idCentro = Centri.id WHERE Turni.id = " + newBambino.turni[p, 0] + "" +
                      " AND idCitta = " + newBambino.citta;
                string countCitta = ado.eseguiScalar(sql, CommandType.Text);
                if (Convert.ToInt32(countCitta) > 1)
                {
                    sql = "SELECT COUNT(*) FROM FuoriComune INNER JOIN  Centri ON idCentro =Centri.id INNER JOIN Turni ON Turni.idCentro = Centri.id WHERE Turni.id = " + newBambino.turni[p, 0] + "" +
                          " AND idCitta = " + newBambino.citta + "" +
                          " AND indirizzo = '" + newBambino.indirizzo + "'";
                    string countIndirizzo = ado.eseguiScalar(sql, CommandType.Text);
                    if (Convert.ToInt32(countIndirizzo) == 1)
                    {
                        ris = 1;
                    }
                }
                else if (Convert.ToInt32(countCitta) == 1)
                {
                    ris = 1;
                }
            }

            return(ris);
        }
コード例 #9
0
ファイル: seitu.cs プロジェクト: Dade00/BibliotecaAsilo1.0
 public seitu(Bambino da)
 {
     bambinoDaConfermare = da;
     InitializeComponent();
 }
コード例 #10
0
 public PrendiGeneree(Bambino da)
 {
     bambinoLoggato = da;
     InitializeComponent();
 }
コード例 #11
0
 public PrendiRestituisci(Bambino da)
 {
     bambinoLoggato = da;
     InitializeComponent();
 }
コード例 #12
0
        protected void salvaBambino_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                datiBambino.Visible       = false;
                termineIscrizione.Visible = true;
                Bambino newBambino = new Bambino();
                newBambino.nome         = nomeBambino.Text;
                newBambino.cognome      = cognomeBambino.Text;
                newBambino.sesso        = Convert.ToChar(sessoBambino.SelectedValue);
                newBambino.nazionalita  = Convert.ToInt32(nazionalitaBambino.SelectedValue);
                newBambino.dataNascita  = Convert.ToDateTime(dataNascitaBambino.Text);
                newBambino.cittaNascita = Convert.ToInt32(cittaNascitaBambino.SelectedValue);
                newBambino.CF           = codiceFiscaleBambino.Text;
                newBambino.indirizzo    = indirizzoBambino.Text;
                newBambino.numeroCivico = numeroCivicoBambino.Text;
                newBambino.provincia    = provinciaBambino.SelectedValue;
                newBambino.citta        = Convert.ToInt32(cittaBambino.SelectedValue);
                newBambino.classe       = Convert.ToInt32(classeBambino.SelectedValue);
                newBambino.scuola       = scuolaBambino.Text;


                newBambino.turni = new object[idTurni.Length, 17];
                int i = 0;
                foreach (int turno in idTurni)
                {
                    if (((CheckBox)tableTurni.FindControl(turno.ToString())).Checked)
                    {
                        newBambino.turni[i, 0] = turno;
                        try
                        {
                            newBambino.turni[i, 1] = ((RadioButtonList)tableTurni.FindControl("mensa" + turno.ToString())).SelectedValue == "No" ? 0 : 1;
                        }
                        catch (Exception ex)
                        {
                            newBambino.turni[i, 1] = 0;
                        }
                        for (int y = 0; y < ((CheckBoxList)tableTurni.FindControl("settimane" + turno.ToString())).Items.Count; y++)
                        {
                            newBambino.turni[i, y + 2] = Convert.ToInt32(((CheckBoxList)tableTurni.FindControl("settimane" + turno.ToString())).Items[y].Selected);
                        }
                        i++;
                    }
                }
                int n = 0;
                for (int k = 0; k <= Request.Cookies.Count; k++)
                {
                    try
                    {
                        if (Request.Cookies["bambino" + k].Value != null)
                        {
                            n++;
                        }
                    }
                    catch { }
                }
                Response.Cookies["bambino" + (n + 1)].Value  += newBambino.writeCookie();
                Response.Cookies["bambino" + (n + 1)].Expires = DateTime.Now.AddMinutes(30);
                //bambini.Add(newBambino);
                TableRow  tr = new TableRow();
                TableCell tc = new TableCell();
                tc.Text = newBambino.nome;
                tr.Cells.Add(tc);
                tc      = new TableCell();
                tc.Text = newBambino.cognome;
                tr.Cells.Add(tc);
                tc      = new TableCell();
                tc.Text = newBambino.dataNascita.ToShortDateString();
                tr.Cells.Add(tc);
                tc = new TableCell();
                for (int p = 0; p < newBambino.turni.GetLength(0); p++)
                {
                    if (Convert.ToInt32(newBambino.turni[p, 0]) != 0)
                    {
                        string    sql            = @"select * 
                        from Turni WHERE id = " + newBambino.turni[p, 0];
                        adoNet    adoWeb         = new adoNet();
                        DataTable dettaglioTurno = adoWeb.eseguiQuery(sql, CommandType.Text);
                        tc.Text += " ♦ Turno " + dettaglioTurno.Rows[0].Field <int>("numero").ToString() + ": " + dettaglioTurno.Rows[0].Field <DateTime>("dataInizio").ToShortDateString() + " - " + dettaglioTurno.Rows[0].Field <DateTime>("dataFine").ToShortDateString() + " ";
                        if (Convert.ToBoolean(dettaglioTurno.Rows[0].Field <bool>("servizioMensa")))
                        {
                            tc.Text += "- Mensa: " + (Convert.ToInt32(newBambino.turni[p, 1]) == 1 ? "Sì" : "No");
                        }
                        tc.Text += "<br/>";
                    }
                }
                tr.Cells.Add(tc);
                tableDettagli.Rows.Add(tr);
            }
        }
コード例 #13
0
        private void ConfermaModificaBambini_Click(object sender, EventArgs e)
        {
            Bambino bambino = new Bambino();

            try
            {
                if (NomeAddBambini.Text == "" || NomeAddBambini.Text == null)
                {
                    MessageBox.Show("Inserire prima il nome del bambino");
                    return;
                }

                if (CognomeAddBambini.Text == "" || CognomeAddBambini.Text == null)
                {
                    MessageBox.Show("Inserire prima il cognome del bambino");
                    return;
                }

                if (ClasseAddBambini.Text == "" || ClasseAddBambini.Text == null)
                {
                    MessageBox.Show("Inserire prima la classe del bambino");
                    return;
                }

                if (DateTime.Now.Subtract(nascitaAddBambini.Value) < new TimeSpan(365, 0, 0, 0, 0))
                {
                    MessageBox.Show("Inserire prima la data di nascita del bambino");
                    return;
                }

                if (Bambini_pic.ImageLocation == "")
                {
                    MessageBox.Show("Selezionare prima la foto");
                    return;
                }

                bambino.Nome        = NomeAddBambini.Text;
                bambino.Cognome     = CognomeAddBambini.Text;
                bambino.DataNascita = nascitaAddBambini.Value;
                bambino.Classe      = ClasseAddBambini.Text.ToUpper();
                bambino.Path        = "path";
                //Controllo se esiste il bambino
                if (!Queries.bambinoExist(bambino))
                {
                    Queries.addBambino(bambino);

                    bambino.ID   = Queries.getMaxIDfromBambini();
                    bambino.Path = @"C:\BibliotecaAsilo\IMMAGINI_BAMBINI\" + bambino.Nome + bambino.Cognome + bambino.ID + ".jpg";
                    Queries.editBambino(bambino);

                    //Refresh della pahina
                    NomeAddBambini.Text     = "";
                    CognomeAddBambini.Text  = "";
                    nascitaAddBambini.Value = DateTime.Now;
                    ClasseAddBambini.Text   = "";

                    MessageBox.Show("Bambino aggiunto!");
                    //Bambini_pic.Image = Properties.Resources.No_image;
                }
                else
                {
                    MessageBox.Show("Bambino già presente!");
                }
            }
            catch (Exception ex)
            {
                throw;
            }

            GUIUpdate = true;

            if (GUIUpdate)
            {
                GUIUpdate = false;
                try
                {
                    Queries.getBambini(ref listaBambini);
                    refresh();
                }
                catch (Exception ex)
                {
                    throw;
                }
            }
            try
            {
                Bambini_pic.Image.Save(bambino.Path, System.Drawing.Imaging.ImageFormat.Jpeg);
            }
            catch
            {
                Bambini_pic.Image = Maestre.Properties.Resources.No_image;
                Bambini_pic.Image.Save(bambino.Path, System.Drawing.Imaging.ImageFormat.Jpeg);
            }
        }
コード例 #14
0
        protected void termineIscrizione_Click(object sender, EventArgs e)
        {
            string     sql;
            SqlCommand command;
            adoNet     adoNet = new adoNet();

            string[] idGenitori = new string[2];

            Genitore genitore1 = new Genitore(Request.Cookies["genitore1"].Value);

            idGenitori[0] = addGenitore(genitore1);
            Request.Cookies.Remove("genitore1");

            Genitore genitore2;

            try
            {
                if (Request.Cookies["genitore2"].Value != null)
                {
                    genitore2     = new Genitore(Request.Cookies["genitore2"].Value);
                    idGenitori[1] = addGenitore(genitore2);
                    Request.Cookies.Remove("genitore2");
                }
            }
            catch (Exception ex) { }
            string idBambini = "";

            for (int k = 0; k <= Request.Cookies.Count; k++)
            {
                try
                {
                    if (Request.Cookies["bambino" + k].Value != null)
                    {
                        Bambino newBambino = new Bambino();
                        newBambino.readCookie(Request.Cookies["bambino" + k].Value);
                        sql = "INSERT INTO Bambini(nome, cognome, sesso, dataNascita, natoA, CF, nazionalita, indirizzo, numeroCivico, idCitta) " +
                              "OUTPUT Inserted.id " +
                              "VALUES (@nome, @cognome, @sesso, @dataNascita, @natoA, @CF, @nazionalita, @indirizzo, @numeroCivico, @idCitta);";
                        command             = new SqlCommand();
                        command.CommandText = sql;
                        command.CommandType = CommandType.Text;
                        command.Parameters.AddWithValue("@nome", newBambino.nome);
                        command.Parameters.AddWithValue("@cognome", newBambino.cognome);
                        command.Parameters.AddWithValue("@sesso", newBambino.sesso);
                        command.Parameters.AddWithValue("@dataNascita", newBambino.dataNascita);
                        command.Parameters.AddWithValue("@natoA", newBambino.cittaNascita);
                        command.Parameters.AddWithValue("@CF", newBambino.CF);
                        command.Parameters.AddWithValue("@nazionalita", newBambino.nazionalita);
                        command.Parameters.AddWithValue("@indirizzo", newBambino.indirizzo);
                        command.Parameters.AddWithValue("@numeroCivico", newBambino.numeroCivico);
                        command.Parameters.AddWithValue("@idCitta", newBambino.citta);
                        adoNet = new adoNet();
                        string idBambino = adoNet.eseguiScalar(command);

                        for (int j = 0; j < newBambino.turni.GetLength(0); j++)
                        {
                            if (Convert.ToInt32(newBambino.turni[j, 0]) != 0)
                            {
                                sql = "INSERT INTO FreqBambini(idTurno, idBambino, settimane, dataIscrizione, servizioMensa, scuola, idClasse, pagato) " +
                                      "OUTPUT Inserted.id" +
                                      "VALUES(@idTurno, @idBambino, @settimane, @dataIscrizione, @servizioMensa, @scuola, @idClasse, 0);";
                                command             = new SqlCommand();
                                command.CommandText = sql;
                                command.CommandType = CommandType.Text;
                                command.Parameters.AddWithValue("@idTurno", newBambino.turni[j, 0]);
                                command.Parameters.AddWithValue("@idBambino", idBambino);
                                command.Parameters.AddWithValue("@settimane", getStringTurno(newBambino.turni, j));
                                command.Parameters.AddWithValue("@dataIscrizione", DateTime.Now);
                                command.Parameters.AddWithValue("@servizioMensa", newBambino.turni[j, 1]);
                                command.Parameters.AddWithValue("@scuola", newBambino.scuola);
                                command.Parameters.AddWithValue("@idClasse", newBambino.classe);
                                string idIscrizione = adoNet.eseguiScalar(command);
                                idBambini += idIscrizione + ",";
                            }
                        }
                        addParentela(idBambino, idGenitori[0]);
                        if (idGenitori[1] != null)
                        {
                            addParentela(idBambino, idGenitori[1]);
                        }

                        Request.Cookies.Remove("bambino" + k);
                    }
                }
                catch (Exception ex) { }
            }

            sql = "INSERT INTO pagamentiQuote(totale, pagato, metodo, idIscrizioni) " +
                  "VALUES(@totale, @pagato, @metodo, @idIscrizioni);";
            command = new SqlCommand();
            command.Parameters.AddWithValue("@totale", ((TableCell)tablePagamento.FindControl("totDaPagare")).Text.Split(' ')[0]);
            command.Parameters.AddWithValue("@pagato", false);
            command.Parameters.AddWithValue("@metodo", (tipoPagamento.SelectedValue == "cassa") ? "C" : "S");
            command.Parameters.AddWithValue("@idIscrizioni", idBambini);
            adoNet.eseguiNonQuery(command);
        }
コード例 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["id"] == null)
            {
                Response.Redirect("../../Login.aspx");
            }
            else
            {
                adoNet adoWeb = new adoNet();
                try
                {
                    if (Request.Cookies["genitore1"].Value == null)
                    {
                        Response.Redirect("./DatiGenitori.aspx");
                    }
                    else
                    if (!IsPostBack)
                    {
                        adoNet.impostaConnessione();

                        TableRow  tr = new TableRow();
                        TableCell tc = new TableCell();

                        // 0 - idTurno; 1 - nBambini; 2 - settimane; 3 - fuoriComune
                        int[,] v = new int[20, 3];

                        for (int k = 0; k <= Request.Cookies.Count; k++)
                        {
                            try
                            {
                                if (Request.Cookies["bambino" + k].Value != null)
                                {
                                    Bambino newBambino = new Bambino();
                                    newBambino.readCookie(Request.Cookies["bambino" + k].Value);
                                    tr      = new TableRow();
                                    tc      = new TableCell();
                                    tc.Text = newBambino.nome;
                                    tr.Cells.Add(tc);
                                    tc      = new TableCell();
                                    tc.Text = newBambino.cognome;
                                    tr.Cells.Add(tc);
                                    tc      = new TableCell();
                                    tc.Text = newBambino.dataNascita.ToShortDateString();
                                    tr.Cells.Add(tc);
                                    tc = new TableCell();
                                    for (int p = 0; p < newBambino.turni.GetLength(0); p++)
                                    {
                                        if (Convert.ToInt32(newBambino.turni[p, 0]) != 0)
                                        {
                                            string    sql            = @"select * 
                                                            from Turni WHERE id = " + newBambino.turni[p, 0];
                                            DataTable dettaglioTurno = adoWeb.eseguiQuery(sql, CommandType.Text);
                                            tc.Text += " ♦ Turno " + dettaglioTurno.Rows[0].Field <int>("numero").ToString() + ": " + dettaglioTurno.Rows[0].Field <DateTime>("dataInizio").ToShortDateString() + " - " + dettaglioTurno.Rows[0].Field <DateTime>("dataFine").ToShortDateString() + " ";
                                            if (Convert.ToBoolean(dettaglioTurno.Rows[0].Field <bool>("servizioMensa")))
                                            {
                                                tc.Text += "- Mensa: " + (Convert.ToInt32(newBambino.turni[p, 1]) == 1 ? "Sì" : "No");
                                            }
                                            tc.Text += "<br/>";
                                        }
                                    }
                                    tr.Cells.Add(tc);
                                    tableDettagli.Rows.Add(tr);

                                    for (int p = 0; p < newBambino.turni.GetLength(0); p++)
                                    {
                                        if (Convert.ToInt32(newBambino.turni[p, 0]) != 0)
                                        {
                                            for (int o = 0; o < v.GetLength(0); o++)
                                            {
                                                if (v[o, 0] == Convert.ToInt32(newBambino.turni[p, 0]) &&
                                                    v[o, 2] == calcoloSettimane(newBambino.turni, p) &&
                                                    v[o, 3] == verificaComune(newBambino, p))
                                                {
                                                    v[o, 1]++;
                                                    break;
                                                }
                                                else
                                                {
                                                    for (int t = 0; t < v.GetLength(0); t++)
                                                    {
                                                        if (v[t, 0] == 0)
                                                        {
                                                            v[t, 0] = Convert.ToInt32(newBambino.turni[p, 0]);
                                                            v[t, 1] = 1;
                                                            v[t, 2] = calcoloSettimane(newBambino.turni, p);
                                                            v[t, 3] = verificaComune(newBambino, p);
                                                            break;
                                                        }
                                                    }
                                                    break;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                            catch (Exception ex) { }
                        }


                        decimal totale = 0;

                        for (int o = 0; o < v.GetLength(0); o++)
                        {
                            if (v[o, 0] != 0)
                            {
                                tr = new TableRow();
                                tc = new TableCell();
                                string    sql            = @"select * 
                        from Turni WHERE id = " + v[o, 0];
                                DataTable dettaglioTurno = adoWeb.eseguiQuery(sql, CommandType.Text);
                                tc.Text += dettaglioTurno.Rows[0].Field <int>("numero").ToString() + "° Turno: " + dettaglioTurno.Rows[0].Field <DateTime>("dataInizio").ToShortDateString() + " - " + dettaglioTurno.Rows[0].Field <DateTime>("dataFine").ToShortDateString() + " ";
                                tr.Cells.Add(tc);
                                tc      = new TableCell();
                                tc.Text = v[o, 1].ToString();
                                tr.Cells.Add(tc);
                                tc      = new TableCell();
                                tc.Text = v[o, 2].ToString();
                                tr.Cells.Add(tc);
                                tc = new TableCell();
                                if (v[o, 2] <= dettaglioTurno.Rows[0].Field <int>("p1"))
                                {
                                    if (v[o, 1] < 3)
                                    {
                                        tc.Text = dettaglioTurno.Rows[0].Field <decimal>("p1quotaBamb" + v[o, 1]).ToString("F") + " €";
                                        totale += dettaglioTurno.Rows[0].Field <decimal>("p1quotaBamb" + v[o, 1]);
                                    }
                                    else
                                    {
                                        decimal calc = dettaglioTurno.Rows[0].Field <decimal>("p1quotaBamb3");
                                        for (int y = 3; y <= v[o, 1]; y++)
                                        {
                                            calc += dettaglioTurno.Rows[0].Field <decimal>("p1quotaBamb1");
                                        }
                                        tc.Text = calc.ToString("F") + " €";
                                        totale += calc;
                                    }
                                }
                                else
                                {
                                    if (v[o, 1] < 3)
                                    {
                                        tc.Text = dettaglioTurno.Rows[0].Field <decimal>("p2quotaBamb" + v[o, 1]).ToString("F") + " €";
                                        totale += dettaglioTurno.Rows[0].Field <decimal>("p2quotaBamb" + v[o, 1]);
                                    }
                                    else
                                    {
                                        decimal calc = dettaglioTurno.Rows[0].Field <decimal>("p2quotaBamb3");
                                        for (int y = 3; y <= v[o, 1]; y++)
                                        {
                                            calc += dettaglioTurno.Rows[0].Field <decimal>("p2quotaBamb1");
                                        }
                                        tc.Text = calc.ToString("F") + " €";
                                        totale += calc;
                                    }
                                }
                                if (v[o, 3] == 1)
                                {
                                    tc.Text += "<br/>   + " + (dettaglioTurno.Rows[0].Field <decimal>("quotaFuoriComune") * v[o, 1]).ToString("F") + " €";
                                    totale  += dettaglioTurno.Rows[0].Field <decimal>("quotaFuoriComune") * v[o, 1];
                                }
                                tr.Cells.Add(tc);
                                tablePagamento.Rows.Add(tr);
                            }
                        }
                        tr                 = new TableRow();
                        tc                 = new TableCell();
                        tc.ColumnSpan      = 3;
                        tc.Text            = "TOTALE:";
                        tc.Font.Bold       = true;
                        tc.HorizontalAlign = HorizontalAlign.Right;
                        tr.Cells.Add(tc);
                        tc           = new TableCell();
                        tc.Font.Bold = true;
                        tc.ID        = "totDaPagare";
                        tc.Text      = totale.ToString("F") + " €";
                        tr.Cells.Add(tc);
                        Response.Cookies["totDaPagare"].Value   = totale.ToString("F");
                        Response.Cookies["totDaPagare"].Expires = DateTime.Now.AddMinutes(30);
                        tablePagamento.Rows.Add(tr);
                    }
                    else
                    {
                    }
                }
                catch (Exception ex)
                {
                    Response.Redirect("./DatiGenitori.aspx");
                }
            }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["id"] == null)
            {
                Response.Redirect("../../Login.aspx");
            }
            else
            {
                adoNet adoWeb = new adoNet();

                try
                {
                    if (Request.Cookies["genitore1"].Value == null)
                    {
                        Response.Redirect("./DatiGenitori.aspx");
                    }
                    else if (!IsPostBack)
                    {
                        adoNet.impostaConnessione();

                        bambini = new List <Bambino>();
                        Genitore genitore1 = new Genitore(Request.Cookies["genitore1"].Value);
                        Genitore genitore2;
                        try
                        {
                            if (Request.Cookies["genitore2"].Value != null)
                            {
                                genitore2 = new Genitore(Request.Cookies["genitore2"].Value);
                                if (genitore1.indirizzo == genitore2.indirizzo &&
                                    genitore1.numeroCivico == genitore2.numeroCivico &&
                                    genitore1.citta == genitore2.citta &&
                                    genitore1.provincia == genitore2.provincia)
                                {
                                    indirizzoUguale.Visible = true;
                                }
                                else
                                {
                                    indirizzoUguale.Visible = false;
                                }
                            }
                            else
                            {
                                indirizzoUguale.Visible = false;
                            }
                        }
                        catch (Exception ex)
                        {
                            indirizzoUguale.Visible = false;
                        }
                        string    sql    = @"select * 
                        from Nazioni ORDER BY DescNazione";
                        DataTable codice = adoWeb.eseguiQuery(sql, CommandType.Text);
                        nazionalitaBambino.DataSource     = codice;
                        nazionalitaBambino.DataTextField  = "DescNazione";
                        nazionalitaBambino.DataValueField = "IdNazione";
                        nazionalitaBambino.DataBind();

                        sql    = @"select * 
                        from Province ORDER BY DescProvincia";
                        codice = adoWeb.eseguiQuery(sql, CommandType.Text);
                        provinciaBambino.DataSource     = codice;
                        provinciaBambino.DataTextField  = "DescProvincia";
                        provinciaBambino.DataValueField = "CodProvincia";
                        provinciaBambino.DataBind();
                        provinciaBambino.SelectedIndex = -1;

                        sql    = @"select *, descri + ' (' + prov + ')' AS text
                        from Citta ORDER BY descri";
                        codice = adoWeb.eseguiQuery(sql, CommandType.Text);
                        cittaNascitaBambino.DataSource     = codice;
                        cittaNascitaBambino.DataTextField  = "text";
                        cittaNascitaBambino.DataValueField = "IdCitta";
                        cittaNascitaBambino.DataBind();

                        sql = @"select * 
                        from Classi";
                        DataTable classi = adoWeb.eseguiQuery(sql, CommandType.Text);
                        foreach (DataRow dr in classi.Rows)
                        {
                            ListItem ls = new ListItem(dr.Field <int>("anno").ToString() + "° " + ((dr.Field <string>("ME") == "M") ? "Media" : "Elementare"), dr.Field <int>("id").ToString());
                            classeBambino.Items.Add(ls);
                        }
                    }
                    else
                    {
                        string    sql   = @"select * 
                        from Turni WHERE idCentro = " + Session["idCentro"];
                        DataTable turni = adoWeb.eseguiQuery(sql, CommandType.Text);
                        int       y     = 0;
                        idTurni = new int[turni.Rows.Count];
                        foreach (DataRow turno in turni.Rows)
                        {
                            TableRow  tr       = new TableRow();
                            TableCell tc       = new TableCell();
                            CheckBox  checkBox = new CheckBox();
                            checkBox.ID = turno["id"].ToString();
                            idTurni[y]  = (int)(turno["id"]);
                            y++;
                            checkBox.CheckedChanged += turnoEvent;
                            checkBox.AutoPostBack    = true;
                            tc.Controls.Add(checkBox);
                            tr.Cells.Add(tc);
                            tc      = new TableCell();
                            tc.Text = (Convert.ToDateTime(turno["dataInizio"].ToString())).ToShortDateString();
                            tr.Cells.Add(tc);
                            tc      = new TableCell();
                            tc.Text = (Convert.ToDateTime(turno["dataFine"].ToString())).ToShortDateString();
                            tr.Cells.Add(tc);
                            int colSpan = 2;
                            if (Convert.ToBoolean(turno["servizioMensa"].ToString()))
                            {
                                tc = new TableCell();
                                //tr.Cells.Add(tc);
                                //tc = new TableCell();
                                //tc.ColumnSpan = 2;
                                RadioButtonList radio = new RadioButtonList();
                                radio.ID       = "mensa" + turno["id"].ToString();
                                radio.Enabled  = false;
                                radio.CssClass = "table-borderless";
                                radio.Items.Add("Sì");
                                radio.Items.Add("No");
                                tc.Controls.Add(radio);
                                tr.Cells.Add(tc);
                                colSpan += 3;
                            }
                            tableTurni.Rows.Add(tr);
                            tr = new TableRow();
                            tr.Cells.Add(new TableCell());
                            tc            = new TableCell();
                            tc.ColumnSpan = colSpan;
                            CheckBoxList checkBoxList = new CheckBoxList();
                            checkBoxList.ID      = "settimane" + turno["id"].ToString();
                            checkBoxList.Enabled = false;
                            checkBoxList.Visible = false;

                            DateTime data = new DateTime();
                            data = Convert.ToDateTime(turno["dataInizio"]);
                            checkBoxList.CssClass = "table-borderless";

                            for (int i = 0; i < Convert.ToInt32(turno["numeroSettimane"].ToString()); i++)
                            {
                                checkBoxList.Items.Add("Settimana " + (i + 1) + ": " + data.ToShortDateString() + " - " + data.AddDays(7).ToShortDateString());
                                data = data.AddDays(7);
                            }
                            tc.Controls.Add(checkBoxList);
                            tr.Cells.Add(tc);
                            tableTurni.Rows.Add(tr);
                        }
                    }
                }
                catch (Exception ex)
                {
                    Response.Redirect("./DatiGenitori.aspx");
                }
                termineIscrizione.Enabled = false;

                for (int k = 0; k <= Request.Cookies.Count; k++)
                {
                    try
                    {
                        if (Request.Cookies["bambino" + k].Value != null)
                        {
                            Bambino newBambino = new Bambino();
                            newBambino.readCookie(Request.Cookies["bambino" + (k)].Value);
                            TableRow  tr = new TableRow();
                            TableCell tc = new TableCell();
                            tc.Text = newBambino.nome;
                            tr.Cells.Add(tc);
                            tc      = new TableCell();
                            tc.Text = newBambino.cognome;
                            tr.Cells.Add(tc);
                            tc      = new TableCell();
                            tc.Text = newBambino.dataNascita.ToShortDateString();
                            tr.Cells.Add(tc);
                            tc = new TableCell();
                            for (int p = 0; p < newBambino.turni.GetLength(0); p++)
                            {
                                if (Convert.ToInt32(newBambino.turni[p, 0]) != 0)
                                {
                                    string    sql            = @"select * 
                        from Turni WHERE id = " + newBambino.turni[p, 0];
                                    DataTable dettaglioTurno = adoWeb.eseguiQuery(sql, CommandType.Text);
                                    tc.Text += " ♦ Turno " + dettaglioTurno.Rows[0].Field <int>("numero").ToString() + ": " + dettaglioTurno.Rows[0].Field <DateTime>("dataInizio").ToShortDateString() + " - " + dettaglioTurno.Rows[0].Field <DateTime>("dataFine").ToShortDateString() + " ";
                                    if (Convert.ToBoolean(dettaglioTurno.Rows[0].Field <bool>("servizioMensa")))
                                    {
                                        tc.Text += "- Mensa: " + (Convert.ToInt32(newBambino.turni[p, 1]) == 1 ? "Sì" : "No");
                                    }
                                    tc.Text += "<br/>";
                                }
                            }
                            tr.Cells.Add(tc);
                            tc = new TableCell();
                            Button btn = new Button();
                            btn.CssClass = "btn btn-circle btn-danger";
                            Label lbl = new Label();
                            lbl.CssClass = "fas fa-trash";
                            btn.Controls.Add(lbl);
                            btn.Click += EliminaBambino_click;
                            btn.ID     = "bambino" + k;
                            tc.Controls.Add(btn);
                            tr.Cells.Add(tc);
                            tableDettagli.Rows.Add(tr);
                            termineIscrizione.Enabled = true;
                        }
                    }
                    catch (Exception ex) { }
                }
            }
        }
コード例 #17
0
 public ConfermaPresa(Libro libro, Bambino bambino)
 {
     bambinoLoggato    = bambino;
     LibroDaConfermare = libro;
     InitializeComponent();
 }
コード例 #18
0
 public LibriLetti(Bambino bambino)
 {
     Bambino = bambino;
     InitializeComponent();
 }
コード例 #19
0
 public Librochoose(Bambino bambinologgato)
 {
     bambinoresituente = bambinologgato;
     InitializeComponent();
 }