コード例 #1
0
        public static DoctorInfo AddDoctors()
        {
            DoctorInfo DoctorsInformation = new DoctorInfo();
            Random     _ID = new Random();

            DoctorsInformation.Id = _ID.Next(000000, 999999);
            AddressBookUtility validation = new AddressBookUtility();

            string Name = validation.FullName();

            DoctorsInformation.Name = Name;
            string specialization = validation.Specialization();

            DoctorsInformation.Specialization = specialization;
            string phoneNo = validation.phoneNumber();

            DoctorsInformation.MobileNo = phoneNo;
            string Age = validation.Agevalidation();

            DoctorsInformation.Age = Age;
            string Avaliable = validation.ValidationAvaliablity();

            DoctorsInformation.Availability = Avaliable;
            return(DoctorsInformation);
        }
コード例 #2
0
        /// <summary>
        /// Method To Create the List of Patient
        /// </summary>
        /// <returns></returns>
        public static Patientinfo AddPatient()
        {
            AddressBookUtility validations = new AddressBookUtility();
            Patientinfo        patientdata = new Patientinfo();
            Random             _Id         = new Random();

            patientdata.Id = _Id.Next(000000, 999999);
            string Name = validations.FullName();

            patientdata.Name = Name;
            string MobileNo = validations.phoneNumber();

            patientdata.MobileNo = MobileNo;
            string age = validations.Agevalidation();

            patientdata.Age = age;
            return(patientdata);
        }
コード例 #3
0
 /// <summary>
 ///     Add The patient Details in the List
 /// </summary>
 /// <returns></returns>
 public static void AddPatientAppointment()
 {
     try
     {
         string FullPath           = @"C:\Users\User\source\repos\ObjectOrientedProgramming\ObjectOrientedProgramming\Clinique_Management\JsonFileofDoctors\NewAppoitmentWithDoctors.json";
         string patientAppointment = File.ReadAllText(FullPath);
         var    appointmnetList    = JsonConvert.DeserializeObject <PatientAppointmentList>(patientAppointment);
         List <PatientAppointment> patientAppointments;
         bool flag    = false;
         int  counter = 1;
         PatientAppointment Appointment   = new PatientAppointment();
         AddressBookUtility validatations = new AddressBookUtility();
         Console.WriteLine("Enter the Doctor Name");
         string DoctorName = validatations.CustomName();
         Appointment.Avaliablity    = validatations.ValidationAvaliablity();
         Appointment.specialization = validatations.Specialization();
         Appointment.DoctorName     = DoctorName;
         Random _Id = new Random();
         Appointment.patientId = _Id.Next(0000000, 9999999);
         Console.WriteLine("Enter the Patient Name");
         string PatientName = validatations.CustomName();
         Appointment.PatientName = PatientName;
         string Age = validatations.Agevalidation();
         Appointment.patientAge = Age;
         string MobileNumber = validatations.phoneNumber();
         Appointment.PatientMobileNumber = MobileNumber;
         DateTime today = DateTime.Today;
         Appointment.Date = today.ToString("dd/MM/yyyy");
         foreach (var checkdaoctorAvaliablity in appointmnetList.Appointment)
         {
             if (checkdaoctorAvaliablity.DoctorName.Contains(DoctorName) && checkdaoctorAvaliablity.Date.Contains(today.ToString("dd/MM/yyyy")))
             {
                 if (counter == 5)
                 {
                     break;
                 }
                 counter++;
                 flag = true;
             }
         }
         if (flag)
         {
             Console.WriteLine("Doctor " + DoctorName + " is Not Fee Today Please Try Other Doctor");
         }
         else
         {
             if (patientAppointment == "")
             {
                 patientAppointments = new List <PatientAppointment>();
                 patientAppointments.Add(Appointment);
             }
             else
             {
                 patientAppointments = appointmnetList.Appointment;
                 patientAppointments.Add(Appointment);
             }
             PatientAppointmentList AppointmentwithDocotrs = new PatientAppointmentList()
             {
                 Appointment = patientAppointments
             };
             string AppointMentdata = JsonConvert.SerializeObject(AppointmentwithDocotrs);
             File.WriteAllText(FullPath, AppointMentdata);
         }
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
     }
 }