public static Db CRUD_Write(Db db)
 {
     try
     {
         PatientEntity e  = new PatientEntity();
         PersonEntity  pe = new PersonEntity();
         Console.WriteLine(ConsoleConstants.patientid);
         e.pId = Convert.ToInt32(Console.ReadLine());
         if (db.patient.Count > 0)
         {
             //Validation- Check where any record with this id is already present or not. If present, ask different id
             e.pId = HelperModule.validateId(e.pId, db.patient);
         }
         Console.WriteLine(ConsoleConstants.patientname);
         pe.name = Console.ReadLine();
         Console.WriteLine(ConsoleConstants.gender);
         pe.gender = Console.ReadLine();
         Console.WriteLine(ConsoleConstants.address);
         pe.address = Console.ReadLine();
         Console.WriteLine(ConsoleConstants.email);
         pe.email = Console.ReadLine();
         Console.WriteLine(ConsoleConstants.doctorid);
         e.doctorId     = Convert.ToInt32(Console.ReadLine());
         e.personEntity = pe;
         db.patient     = DAL.insertData(db.patient, e);
         return(db);
     }
     catch
     {
         throw;
     }
 }
Ejemplo n.º 2
0
 public static Db CRUD_Write(Db db)
 {
     try
     {
         DoctorTypeEntity e = new DoctorTypeEntity();
         Console.WriteLine(ConsoleConstants.doctortype);
         e.doctorType = Console.ReadLine();
         if (db.doctortype.Count > 0)
         {
             //Validation - Check whether the id is already present or not. If present ask for a different id
             e.doctorType = HelperModule.validateId(e.doctorType, db.doctortype);
         }
         Console.WriteLine(ConsoleConstants.doctortypedescription);
         e.description = Console.ReadLine();
         db.doctortype = DAL.insertData(db.doctortype, e);
         return(db);
     }
     catch
     {
         throw;
     }
 }