Exemple #1
0
        public void Add(Athlete athete)
        {
            var data =
            new IT.Phrase(athete.Id.ToString() ,
                          IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.NORMAL));

              var cell = new IT.pdf.PdfPCell(data);
              cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
              cell.PaddingBottom = PAD_BOTTOM;
              table.AddCell(cell);

             data = new IT.Phrase(athete.Surname + " "  + athete.Name,
                              IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.NORMAL));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             data = new IT.Phrase(" ",
                              IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_TITLE, IT.Font.NORMAL));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);
        }
Exemple #2
0
 public void Save(Athlete athlete)
 {
     // if (IsNew(athlete)) {
      //    Insert(athlete);
      // } else {
      //    Update(athlete);
      // }
 }
Exemple #3
0
        public void Insert(Athlete athlete)
        {
            command.CommandText = string.Format("INSERT INTO at VALUES({0},\"{1}\",\"{2}\",{3},'{4}', '{5}');",
                                               athlete.Id,
                                               athlete.Name,
                                               athlete.Surname,
                                               athlete.Year,
                                               athlete.Gender.ToString(),
                                               athlete.Time

                                             );
               command.ExecuteNonQuery();
        }
Exemple #4
0
 public void Update(Athlete athlete)
 {
     string sql = "UPDATE at SET ";
      sql += string.Format ("name = '{0}', SET surname = '{1}', set year = {2}, set gender = '{3}', set time = '{4}' ",
                        athlete.Name,
                        athlete.Surname,
                        athlete.Year,
                        athlete.Gender,
                        athlete.Time
                        );
      sql += string.Format("WHERE id={0}", athlete.Id);
      command.CommandText = sql;
      command.ExecuteNonQuery();
 }
Exemple #5
0
        public void Add(Athlete athete)
        {
            // posizione
              var ps =
            new IT.Phrase((++pos).ToString(),
                          IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.BOLD)
                          );
              var cell = new IT.pdf.PdfPCell(ps);
              cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
              // evidenzia i primi 3
              if (pos < 4) {
             cell.GrayFill = 0.90F;
              }

              cell.PaddingBottom = PAD_BOTTOM;
              table.AddCell(cell);

              var data =
            new IT.Phrase(athete.Id.ToString() ,
                          IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.NORMAL));

              cell = new IT.pdf.PdfPCell(data);
              cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
              cell.PaddingBottom = PAD_BOTTOM;
              table.AddCell(cell);

             data = new IT.Phrase(athete.Surname + " "  + athete.Name,
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.NORMAL));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             data = new IT.Phrase(athete.Year.ToString(),
                         IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.NORMAL));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_LEFT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);

             string t = athete.Time == "99:99" ? "rit." : athete.Time;
             data = new IT.Phrase(t,
                IT.FontFactory.GetFont(IT.FontFactory.HELVETICA, SIZE_ROW, IT.Font.NORMAL));
             cell = new IT.pdf.PdfPCell(data);
             cell.HorizontalAlignment = IT.Element.ALIGN_RIGHT;
             cell.PaddingBottom = PAD_BOTTOM;
             table.AddCell(cell);
        }
Exemple #6
0
        public SCG.IEnumerable<Athlete> Query(string sql)
        {
            command.CommandText = sql;
             var list = new SCG.List<Athlete>();
             using (var reader = command.ExecuteReader()) {
            while (reader.Read()) {
               var at = new Athlete();

               at.Id = reader.GetInt32(0);
               at.Name = reader.GetString(1);
               at.Surname = reader.GetString(2);
               at.Year = reader.GetInt32(3);
               at.Gender  = reader.GetString(4);
               at.Time  = reader.GetString(5);
               list.Add(at);
            }
             }
             return list;
        }
Exemple #7
0
 public bool IsNew(Athlete athlete)
 {
     command.CommandText = "SELECT id FROM at";
      return command.ExecuteScalar() != null;
 }