private void LoadForm()
        {
            ParserJSON           pj  = new ParserJSON();
            HeadPhysicianWindows hpw = new HeadPhysicianWindows();

            hpw.DoctorsGrid.ItemsSource = null;
            string     result = pj.GetDoctors();
            RootObject ro     = JsonConvert.DeserializeObject <RootObject>(result);

            hpw.DoctorsGrid.ItemsSource = ro.doctors;
        }
Esempio n. 2
0
        private void Btn_Alter_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string Answer = new WebClient().DownloadString(DataValue.Url + "Code/alter_doctors.php?Email=" +
                                                               Tb_Email.Text + "&Id=" + DoctorsData.Id + "&Surname=" + Tb_Surname.Text + "&Name=" + Tb_Name.Text
                                                               + "&Patronymic=" + Tb_Patronymic.Text + "&Phone=" + Tb_Phone.Text + "&Passport=" +
                                                               Tb_Passport.Text + "&Parlor=" + Tb_Parlor.Text + "&Description=" + Tb_Description.Text);

                HeadPhysicianWindows h = this.Owner as HeadPhysicianWindows;
                h.update_datagrid();

                this.Close();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }
        }
Esempio n. 3
0
        private void Btn_Del_Click(object sender, RoutedEventArgs e)
        {
            try{
                string passport = Tb_PassportNumber.Text;
                string Answer   = new WebClient().DownloadString(DataValue.Url + "Code/del_doctors.php?" + "passportNumber=" + passport);

                HeadPhysicianWindows h = this.Owner as HeadPhysicianWindows;
                h.update_datagrid();

                this.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Input_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var mailValidate = new System.Net.Mail.MailAddress(Tb_Mail.Text);
                if (Tb_Mail.Text == mailValidate.Address)
                {
                    //ComboBoxItem ComboItem = (ComboBoxItem)Cb_Position.SelectedItem;
                    string position = Cb_Position.Text;
                    string images   = "http://myclinic.ddns.net:8080/" + "files/" + fileName + ext;
                    string fromDate = From_DpWork.Text.Replace(".", "-");
                    string fromTime = FromTime.Text + ":00";
                    string toDate   = To_DpWork.Text.Replace(".", "-");
                    string toTime   = ToTime.Text + ":00";

                    //Показывает дату в нужном формате
                    fromDate = string.Join("-", fromDate.Split(new char[] { '-' }).Reverse());
                    toDate   = string.Join("-", toDate.Split(new char[] { '-' }).Reverse());

                    //Дата и время в формате гггг-мм-дд 00:00:00
                    string FromDataTime = fromDate + " " + fromTime;
                    string ToDataTime   = toDate + " " + toTime;

                    //Запрос к php скрипту на сервере через WebClient
                    string Answer = new WebClient().DownloadString(url + "add_doctors.php?mail=" + Tb_Mail.Text + "&surname=" + Tb_Surname.Text + "&name=" +
                                                                   Tb_Name.Text + "&patronymic=" + Tb_Patronymic.Text + "&phone=" + Tb_Number.Text + "&passport=" + Tb_Passport.Text + "&position=" + position +
                                                                   "&images=" + images + "&parlor=" + Tb_Parlor.Text + "&description=" + Tb_Description.Text + "&FromDataTime=" + FromDataTime + "&ToDataTime=" + ToDataTime);

                    //Указываем родителя
                    HeadPhysicianWindows h = this.Owner as HeadPhysicianWindows;
                    h.update_datagrid();

                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ошибка: " + ex.Message + " Возможно некоторые поля не заполнены.", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 5
0
        private void Btn_Enter_Click(object sender, RoutedEventArgs e)
        {
            try {
                DataValue.Url = "http://myclinic.ddns.net:8080/Code/";
                Encoding source  = Encoding.Unicode;
                Encoding win1251 = Encoding.GetEncoding(1251);

                RegistryWindows      rw = new RegistryWindows();
                HeadPhysicianWindows hp = new HeadPhysicianWindows();
                DoctorWindows        dw = new DoctorWindows();
                AdminWindows         aw = new AdminWindows();
                string Answer           = new WebClient().DownloadString(DataValue.Url + "login.php?login="******"&password="******"*****@*****.**" && password == "admin")
                {
                    aw.Show();
                    this.Close();
                }
                else if (login == "*****@*****.**" && password == "registry")
                {
                    rw.Show();
                    this.Close();
                }
                else
                {
                    switch (str.ToLower())
                    {
                    case "главврач":
                    {
                        hp.Show();
                        this.Close();
                        break;
                    }

                    case "хирург":
                    {
                        dw.Show();
                        this.Close();
                        break;
                    }

                    case "окулист":
                    {
                        dw.Show();
                        this.Close();
                        break;
                    }

                    case "login empty":
                    {
                        Tb_Mail.BorderBrush     = System.Windows.Media.Brushes.Red;
                        Tb_Password.BorderBrush = System.Windows.Media.Brushes.Gray;
                        MessageBox.Show("Не введен логин");
                        break;
                    }

                    case "password empty":
                    {
                        Tb_Mail.BorderBrush     = System.Windows.Media.Brushes.Gray;
                        Tb_Password.BorderBrush = System.Windows.Media.Brushes.Red;
                        MessageBox.Show("Не введен пароль");
                        break;
                    }

                    case "empty":
                    {
                        Tb_Mail.BorderBrush     = System.Windows.Media.Brushes.Red;
                        Tb_Password.BorderBrush = System.Windows.Media.Brushes.Red;
                        MessageBox.Show("Поля пустые");
                        break;
                    }

                    case "":
                    {
                        Tb_Mail.BorderBrush     = System.Windows.Media.Brushes.Red;
                        Tb_Password.BorderBrush = System.Windows.Media.Brushes.Red;
                        MessageBox.Show("Введен неверный логин или пароль");
                        break;
                    }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }