Ejemplo n.º 1
0
 public static Prescription getPrescription(int prescriptionId)
 {
     Prescription pres = null;
     using (SQLiteConnection conn = getConnection())
     {
         conn.Open();
         using (SQLiteCommand command = conn.CreateCommand())
         {
             command.CommandText = "select id,cdate,page,diagnosis,uid from Prescription where id = @prescriptionId";
             command.Parameters.Add(new SQLiteParameter("@prescriptionId", prescriptionId));
             using (SQLiteDataReader reader = command.ExecuteReader())
             {
                 while (reader.Read())
                 {
                     pres = new Prescription(
                             (string)reader["diagnosis"],
                             (Int64)reader["id"],
                             (DateTime)reader["cdate"],
                             (Int64)reader["page"]
                         );
                     pres.updatePatientId((int)(Int64)reader["uid"]);
                 }
             }
         }
     }
     return pres;
 }
Ejemplo n.º 2
0
        public Patient(string pName, int dbId, int age)
        {
            this.id = dbId;
            this.currentAge = age;
            this.name = pName;

            currentPrescription = new Prescription(-1,this.id, this.currentAge);
        }