コード例 #1
0
        public void serachByAvaliablity()
        {
            try
            {
                string             DoctorDetails  = File.ReadAllText(path);
                var                DoctorjsonData = JsonConvert.DeserializeObject <DoctoreList>(DoctorDetails);
                AddressBookUtility validations    = new AddressBookUtility();
                string             Avaliable      = validations.ValidationAvaliablity();

                for (int i = 0; i < DoctorjsonData.Doctors.Count; i++)
                {
                    if (DoctorjsonData.Doctors[i].Availability == Avaliable)
                    {
                        Console.WriteLine("Seq.\tId\t\tName\t\tSpecialization\t\tAvalialblity\tMobileNo\t\tAge");
                        Console.WriteLine(serail + "\t\t" + DoctorjsonData.Doctors[i].Id + "\t\t" + DoctorjsonData.Doctors[i].Name + "\t\t" + DoctorjsonData.Doctors[i].Specialization + "\t\t" + DoctorjsonData.Doctors[i].Availability + "\t\t" + DoctorjsonData.Doctors[i].MobileNo + "\t\t" + DoctorjsonData.Doctors[i].Age + "\t\t");
                        ImplemntaionofSearchByAvaliablity Appitment = new ImplemntaionofSearchByAvaliablity();
                        Console.WriteLine("Today Doctor  " + DoctorjsonData.Doctors[i].Name + " Can See Only the Patients .........");
                        Appitment.AppointmentwithDoctor();


                        flag = true;
                        serail++;
                    }
                }
                if (flag == false)
                {
                    Console.WriteLine("There is no any Doctor is this clinique of Avaliablity " + Avaliable);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
コード例 #2
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);
        }
コード例 #3
0
        static void Main(string[] args)
        {
            Person             person             = new Person();
            AddressBookUtility addressBookUtility = new AddressBookUtility();

            int flag = 0;

            do
            {
                Console.WriteLine("Enter your choice 1.ADD 2.Display 3.Edit 4.Delete 5.SortByName 6.SortByCity 7.SortByState 8.SortByZip 9.View person by city 10.View Person by State 11.Exit");
                int choice = Convert.ToInt32(Console.ReadLine());
                switch (choice)
                {
                case 1:
                    addressBookUtility.AddPerson();
                    break;

                case 2:
                    addressBookUtility.DisplayPerson();
                    break;

                case 3:
                    addressBookUtility.EditPerson();
                    break;

                case 4:
                    addressBookUtility.DeletePerson();
                    break;

                case 5:
                    addressBookUtility.SortByName();
                    break;

                case 6:
                    addressBookUtility.SortByCity();
                    break;

                case 7:
                    addressBookUtility.SortByState();
                    break;

                case 8:
                    addressBookUtility.SortByZip();
                    break;

                case 9:
                    addressBookUtility.ViewCity();
                    break;

                case 10:
                    addressBookUtility.ViewState();
                    break;

                case 11:
                    flag = 1;
                    break;
                }
            } while (flag == 0);
        }
コード例 #4
0
        /// <summary>
        /// Create A User Account
        /// </summary>
        public void CreateAccount()
        {
            try
            {
                bool flag = false;
                AddressBookUtility validation         = new AddressBookUtility();
                string             AccountHoldersPath = @"C:\Users\User\source\repos\ObjectOrientedProgramming\ObjectOrientedProgramming\StockMngt\JsonFiles\AccountHolders.json";
                string             AccountHolders     = File.ReadAllText(AccountHoldersPath);
                var jsonAccountHolder = JsonConvert.DeserializeObject <AccountHolderLists>(AccountHolders);



                List <CreateAccountUserInfo> Users;
                CreateAccountUserInfo        User;
                User = new CreateAccountUserInfo();
                Random _id = new Random();
                User.userID = _id.Next(0000000, 9999999);
                Console.WriteLine("Enter the User Name");
                string userName = validation.CustomName();
                User.userName = userName;
                foreach (var checkuser in jsonAccountHolder.TotalUsers)
                {
                    if (checkuser.userName.Contains(userName))
                    {
                        flag = true;
                    }
                }

                if (flag)
                {
                    Console.WriteLine("User Name already  Taken Please Try Other");
                }
                else
                {
                    if (AccountHolders == "")
                    {
                        Users = new List <CreateAccountUserInfo>();
                        Users.Add(User);
                    }
                    else
                    {
                        Users = jsonAccountHolder.TotalUsers;
                        Users.Add(User);
                    }

                    AccountHolderLists TotalUser = new AccountHolderLists()
                    {
                        TotalUsers = Users
                    };
                    string TotalUsers = JsonConvert.SerializeObject(TotalUser);
                    File.WriteAllText(AccountHoldersPath, TotalUsers);
                }
            }
            catch (Exception e)
            {
            }
        }
コード例 #5
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);
        }
コード例 #6
0
        public static getStockInfromation AddStocksInformation()
        {
            AddressBookUtility validation = new AddressBookUtility();
            bool flag;
            int  numberofShare, sharePrice;

            getStockInfromation Stocks = new getStockInfromation();

            Console.WriteLine("Enter the Stock Name");
            String StockName = validation.CustomName();

            Stocks.StockName = StockName;
            Console.WriteLine("Enter The Number of share");
            do
            {
                flag = int.TryParse(Console.ReadLine(), out numberofShare);
                if (flag)
                {
                    break;
                }
                Console.WriteLine("Enter the Number Of Share Properly");
            } while (!flag);
            Stocks.Numberofshare = numberofShare;
            Console.WriteLine("Enter The Share Price");
            do
            {
                flag = int.TryParse(Console.ReadLine(), out sharePrice);
                if (flag)
                {
                    break;
                }
                Console.WriteLine("Enter the Share Price Properly");
            } while (!flag);

            Stocks.shareprice = sharePrice;
            return(Stocks);
        }
コード例 #7
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);
     }
 }
コード例 #8
0
        /// <summary>
        /// Validation of Login User Method
        /// </summary>
        public void Login()
        {
            bool flag = false;
            int  choice;
            char input;

            AddressBookUtility validation         = new AddressBookUtility();
            string             AccountHoldersPath = @"C:\Users\User\source\repos\ObjectOrientedProgramming\ObjectOrientedProgramming\StockMngt\JsonFiles\AccountHolders.json";
            string             AccountHolders     = File.ReadAllText(AccountHoldersPath);
            var jsonAccountHolder = JsonConvert.DeserializeObject <AccountHolderLists>(AccountHolders);

            Console.WriteLine("Enter Your User Name");
            UserName = validation.CustomName();
            foreach (var checkUser in jsonAccountHolder.TotalUsers)
            {
                if (checkUser.userName.Contains(UserName))
                {
                    do
                    {
                        Console.WriteLine("_____________________________ Welcome To Commercial data processing ____________________________");
                        Console.WriteLine("1 Buy Share");
                        Console.WriteLine("2 Sell Share");
                        Console.WriteLine("3 Total value");
                        Console.WriteLine("4 Print Report");

                        Console.WriteLine("_____________________________ ************************************* ____________________________");

                        Console.WriteLine("Enter Your Choice");
                        choice = Utility.switchinputvalidation();
                        switch (choice)
                        {
                        case 1:
                            CommercialDataProcessingUtility Buy = new CommercialDataProcessingUtility();
                            Buy.BuyShare();
                            break;

                        case 2:
                            CommercialDataProcessingUtility Shell = new CommercialDataProcessingUtility();
                            Shell.shellShare();
                            break;

                        case 3:
                            CommercialDataProcessingUtility Totalvalue = new CommercialDataProcessingUtility();
                            Totalvalue.TotalAmount();

                            break;

                        case 4:
                            CommercialDataProcessingUtility PrintReport = new CommercialDataProcessingUtility();
                            PrintReport.PrintReport();
                            break;

                        default:
                            Console.WriteLine("You Enterd The Wrong Option");
                            break;
                        }
                        do
                        {
                            Console.WriteLine("Do You Want Continue Y/N ?");
                            flag = char.TryParse(Console.ReadLine(), out input);
                            if (flag)
                            {
                                break;
                            }
                            Console.WriteLine("Please Enter the proper Input");
                        } while (!flag);
                    } while (input.Equals('y') || input.Equals('Y'));


                    flag = true;
                }
            }
            if (flag == false)
            {
                Console.WriteLine("No User Name Found");
            }
        }