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) { string images = "http://myclinic.ddns.net:8080/" + "files/" + fileName + ".jpg"; string Answer = new WebClient().DownloadString(url + "add_userregistration.php?mail=" + Tb_Mail.Text + "&password="******"&surname=" + Tb_Surname.Text + "&name=" + Tb_Name.Text + "&patronymic=" + Tb_Patronymic.Text + "&age=" + Tb_Age.Text + "&adress=" + Tb_Adress.Text + "&phone=" + Tb_Number.Text + "&passport=" + Tb_Passport.Text + "&images=" + images); RegistryWindows r = this.Owner as RegistryWindows; r.update_datagrid(); this.Close(); } } catch (Exception ex) { MessageBox.Show("Ошибка: " + ex.Message + " Возможно некоторые поля не заполнены.", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } }
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); } }