Пример #1
0
        public NewDoctorWindow(bool editOrAdd)
        {
            NewDoctorWindow.newWindowOpened += handleNewWindow;
            MainWindow.mainClosed           += handleMainClose;
            NewDoctorWindow.newWindowOpened(this, null);

            InitializeComponent();
            this.workingDays  = "";
            docNameBlock.Text = "";
            startTBlock1.Text = "";
            startTBlock2.Text = "";
            endTBlock1.Text   = "";
            endTBlock2.Text   = "";
            this.isEdit       = editOrAdd;
        }
Пример #2
0
        public NewDoctorWindow(string name, string days, string hours, bool editOrAdd)
        {
            NewDoctorWindow.newWindowOpened += handleNewWindow;
            MainWindow.mainClosed           += handleMainClose;
            NewDoctorWindow.newWindowOpened(this, null);

            InitializeComponent();
            docNameBlock.Text = name;
            this.workingDays  = days;
            this.isEdit       = editOrAdd;
            string[] amPmSplitter = new string[] { "AM", "PM" };

            if (hours.Length != 0)
            {
                startTBlock1.Text = hours.Split('-')[0].Split(':')[0];
                startTBlock2.Text = hours.Split('-')[0].Split(':')[1].Split(amPmSplitter, StringSplitOptions.RemoveEmptyEntries)[0];
                if (hours.Split('-')[0].Contains("AM"))
                {
                    this.amPmComboBox1.SelectedIndex = 0;
                }
                else
                {
                    this.amPmComboBox1.SelectedIndex = 1;
                }

                endTBlock1.Text = hours.Split('-')[1].Split(':')[0];
                endTBlock2.Text = hours.Split('-')[1].Split(':')[1].Split(amPmSplitter, StringSplitOptions.RemoveEmptyEntries)[0];
                if (hours.Split('-')[1].Contains("AM"))
                {
                    this.amPmComboBox2.SelectedIndex = 0;
                }
                else
                {
                    this.amPmComboBox2.SelectedIndex = 1;
                }
            }


            if (mondayBox.IsChecked == false & workingDays.Contains("M"))
            {
                mondayBox.IsChecked = true;
            }

            if (tuesdayBox.IsChecked == false & workingDays.Contains("T"))
            {
                tuesdayBox.IsChecked = true;
            }

            if (wednesdayBox.IsChecked == false & workingDays.Contains("W"))
            {
                wednesdayBox.IsChecked = true;
            }

            if (thursdayBox.IsChecked == false & workingDays.Contains("R"))
            {
                thursdayBox.IsChecked = true;
            }

            if (fridayBox.IsChecked == false & workingDays.Contains("F"))
            {
                fridayBox.IsChecked = true;
            }
        }