示例#1
0
 //Conditions for edit a child,if the condition is not met,
 //an alert message will be
 private void btEdit_Click(object sender, EventArgs e)
 {
     try
     {
         if (clbChildren.CheckedIndices.Count == 1)
         {
             FormEdit fEdit = new FormEdit(clbChildren.SelectedIndex,
                                           listChildren, language);
             fEdit.Show();
         }
         else if (clbChildren.CheckedIndices.Count == 0)
         {
             WarningNotSelct warningNot = new WarningNotSelct(language["NotSelec"]);
             warningNot.Show();
         }
         else
         {
             WarningSelectOnlyOne warningOnyl = new WarningSelectOnlyOne(language["Only1Ch"]);
             warningOnyl.Show();
         }
     }
     catch (Exception)
     {
         Warning warning = new Warning(language["WFail"]);
         warning.Show();
     }
 }
示例#2
0
 //Conditions for remove a child,if the condition is not met,
 //an alert message will be
 private void btDelete_Click(object sender, EventArgs e)
 {
     try
     {
         if (clbChildren.CheckedItems.Count > 0)
         {
             ErasureConfirmation er = new ErasureConfirmation(language);
             if (er.ShowDialog() == DialogResult.OK)
             {
                 RemoveChild rChild = new RemoveChild(
                     clbChildren.SelectedIndex, listChildren);
                 clbChildren.Items.RemoveAt(clbChildren.SelectedIndex);
             }
         }
         else
         {
             WarningNotSelct warningNot = new WarningNotSelct(language["NotSelc"]);
             warningNot.Show();
         }
     }
     catch (Exception)
     {
         Warning warning = new Warning(language["WFail"]);
         warning.Show();
     }
 }
示例#3
0
 //See all the information of a selected child about what
 //he has done throughout the day since he is at school
 private void btShow_Click(object sender, EventArgs e)
 {
     try
     {
         if (clbChildren.CheckedItems.Count == 1)
         {
             ShowChild sForm = new ShowChild(clbChildren.SelectedIndex,
                                             listChildren, listMeals, language);
             sForm.Show();
         }
         else if (clbChildren.CheckedItems.Count == 0)
         {
             WarningNotSelct warningNot = new WarningNotSelct(language["NotSelc"]);
             warningNot.Show();
         }
         else
         {
             WarningSelectOnlyOne warningOnyl = new WarningSelectOnlyOne(language["Only1Ch"]);
             warningOnyl.Show();
         }
     }
     catch (Exception)
     {
         Warning warning = new Warning(language["WFail"]);
         warning.Show();
     }
 }
示例#4
0
        public void CreateAndSavePDFDay()
        {
            try
            {
                Document doc = new Document();
                string[] m   = new string[3];
                string   write;
                PdfWriter.GetInstance(doc, new FileStream(child.GetSurname() + "_" +
                                                          child.GetName() + ".pdf", FileMode.Create));

                //Abrimos el documento
                doc.Open();

                doc.Add(new Paragraph(child.GetName() + child.GetSurname()));

                foreach (InformationOfDay inf in list)
                {
                    doc.Add(new Paragraph(inf.GetDayForShow()));

                    m = inf.GetMeal().Split('?');

                    doc.Add(new Paragraph(language["Bre"] + " : " + m[0]));
                    if (inf.GetEatAmoutB() == 1)
                    {
                        write = language["All"];
                    }
                    else if (inf.GetEatAmoutB() == 2)
                    {
                        write = language["Half"];
                    }
                    else if (inf.GetEatAmoutB() == 3)
                    {
                        write = language["Little"];
                    }
                    else
                    {
                        write = language["None"];
                    }
                    doc.Add(new Paragraph(language["IEBr"] + write));

                    doc.Add(new Paragraph(language["Lunch"] + " : " + m[1]));
                    if (inf.GetEatAmoutL() == 1)
                    {
                        write = language["All"];
                    }
                    else if (inf.GetEatAmoutL() == 2)
                    {
                        write = language["Half"];
                    }
                    else if (inf.GetEatAmoutL() == 3)
                    {
                        write = language["Little"];
                    }
                    else
                    {
                        write = language["None"];
                    }
                    doc.Add(new Paragraph(language["IELu"] + write));

                    doc.Add(new Paragraph(language["Snack"] + " : " + m[2]));
                    if (inf.GetEatAmoutS() == 1)
                    {
                        write = language["All"];
                    }
                    else if (inf.GetEatAmoutS() == 2)
                    {
                        write = language["Half"];
                    }
                    else if (inf.GetEatAmoutS() == 3)
                    {
                        write = language["Little"];
                    }
                    else
                    {
                        write = language["None"];
                    }
                    doc.Add(new Paragraph(language["IESn"] + write));

                    doc.Add(new Paragraph(language["Depo"]));
                    switch (inf.GetDepositionsMor())
                    {
                    case 1:
                        write = language["Y"];
                        break;

                    case 2:
                        write = "No";
                        break;

                    default:
                        write = language["None"];
                        break;
                    }
                    doc.Add(new Paragraph(language["Morn"] + ": " + write));

                    switch (inf.GetDepositionsAft())
                    {
                    case 1:
                        write = language["Y"];
                        break;

                    case 2:
                        write = "No";
                        break;

                    default:
                        write = language["None"];
                        break;
                    }
                    doc.Add(new Paragraph(language["Aft"] + ": " + write));

                    doc.Add(new Paragraph(language["Sleep"]));
                    switch (inf.GetSleepMor())
                    {
                    case 1:
                        write = language["Y"];
                        break;

                    case 2:
                        write = "No";
                        break;

                    default:
                        write = language["None"];
                        break;
                    }
                    doc.Add(new Paragraph(language["Morn"] + ": " + write));

                    switch (inf.GetSleepAft())
                    {
                    case 1:
                        write = language["Y"];
                        break;

                    case 2:
                        write = "No";
                        break;

                    default:
                        write = language["None"];
                        break;
                    }
                    doc.Add(new Paragraph(language["Aft"] + ": " + write));

                    if (inf.GetMessageForHome().Length > 0)
                    {
                        doc.Add(new Paragraph(language["MesH"]));
                        doc.Add(new Paragraph(inf.GetMessageForHome()));
                    }


                    if (inf.GetMessageForSchool().Length > 0)
                    {
                        doc.Add(new Paragraph(language["MesS"]));
                        doc.Add(new Paragraph(inf.GetMessageForSchool()));
                    }
                }

                doc.Close();

                AlreadyOk alr = new AlreadyOk(language["Suc"]);
                alr.Show();
            }catch (Exception IO)
            {
                Warning w = new Warning(language["W"]);
                w.Show();
            }
        }