コード例 #1
0
 public void Tra_Docs(Trained_Doctor New_doc)
 {
     Tra_list.Add(New_doc);
 }
コード例 #2
0
        public void FileToList(string file_path)
        {
            StreamReader sr  = new StreamReader(file_path);
            string       str = sr.ReadLine();

            if (file_path == "Doctor.txt" || file_path == "Ret_Doc.txt")
            {
                while (str != null)
                {
                    string[] arr = str.Split(',');
                    Doctors  d   = new Doctors();
                    d.doctor_Id       = int.Parse(arr[0]);
                    d.doctor_name     = arr[1];
                    d.doctor_birth    = DateTime.Parse(arr[2]);
                    d.doctor_location = arr[3];
                    d.doctor_sal      = double.Parse(arr[4]);

                    Add_Docs(d);

                    str = sr.ReadLine();
                }
                sr.Close();
            }

            if (file_path == "Tra_Doc.txt")
            {
                while (str != null)
                {
                    string[]       arr = str.Split(',');
                    Trained_Doctor d   = new Trained_Doctor();
                    d.doctor_Id       = int.Parse(arr[0]);
                    d.doctor_name     = arr[1];
                    d.doctor_birth    = DateTime.Parse(arr[2]);
                    d.doctor_location = arr[3];
                    d.doctor_sal      = double.Parse(arr[4]);
                    d.start           = DateTime.Parse(arr[5]);
                    d.end             = DateTime.Parse(arr[6]);

                    Tra_Docs(d);

                    str = sr.ReadLine();
                }
                sr.Close();
            }
            if (file_path == "Patient.txt")
            {
                while (str != null)
                {
                    string[] arr = str.Split(',');
                    Patients d   = new Patients();
                    d.patient_id        = int.Parse(arr[0]);
                    d.patient_name      = arr[1];
                    d.patient_location  = arr[2];
                    d.patient_birth     = DateTime.Parse(arr[3]);
                    d.patient_stauts    = arr[4];
                    d.patient_treatment = arr[5];

                    Add_Pat(d);

                    str = sr.ReadLine();
                }
                sr.Close();
            }
            sr.Close();
        }