Фрагмент для ознакомления
Павлово.Все поставленные задачи были решены, тестирование показало корректность работы программного продукта.Список литературыMySQL 8.0 Documentation: 3.2.1 System Requirements. URL: https://dev.mysql.com/doc/mysql-monitor/8.0/en/system-prereqs-reference.htmlMySQL 8.0: Supported Platforms: MySQL Enterprise Monitor. URL: https://www.mysql.com/support/supportedplatforms/enterprise-monitor.htmlМедицинская информационная система. URL: https://pkzdrav.ru/products/meditsinskaya-informatsionnaya-sistema/1С:Медицина. Поликлиника. URL: https://solutions.1c.ru/catalog/clinicКлиника Онлайн - МИС для клиник и медицинских центров. URL: https://klinikon.ru/MySQL 8.0 Reference Manual. URL: https://dev.mysql.com/doc/refman/8.0/en/Чтотакое Visual Studio? URL: https://learn.microsoft.com/ru-ru/visualstudio/get-started/visual-studio-ide?view=vs-2022Документация по C#. URL: https://learn.microsoft.com/ru-ru/dotnet/csharpEntity Framework 6. URL: https://learn.microsoft.com/ru-ru/ef/ef6/Создание пользовательского интерфейса с помощью конструктора XAML. URL: https://learn.microsoft.com/ru-ru/visualstudio/xaml-tools/creating-a-ui-by-using-xaml-designer-in-visual-studio?view=vs-2022Стружкин, Н. П. Базы данных: проектирование : учебник для вузов / Н. П. Стружкин, В. В. Годин. — Москва : Издательство Юрайт, 2023. — 477 с. — (Высшее образование). — ISBN 978-5-534-00229-4. — Текст : электронный // Образовательная платформа Юрайт [сайт]. — URL: https://urait.ru/bcode/511019Руководство. Начало работы с EntityFramework 6. URL: https://learn.microsoft.com/ru-ru/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-applicationORM. Ключи и ссылки. https://neerc.ifmo.ru/wiki/index.php?title=ORM._%D0%9A%D0%BB%D1%8E%D1%87%D0%B8_%D0%B8_%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B8ORM. URL: https://simpleone.ru/glossary/orm/#Аннотации. URL: https://metanit.com/sharp/entityframework/6.3.phpСоздание запросов LINQ на языке C#. URL: https://learn.microsoft.com/ru-ru/dotnet/csharp/linq/write-linq-queriesЧто такое C#: плюсы и минусы язык. URL: https://gb.ru/blog/chto-takoe-c/Приложение 1Класссущностиdoctor.csnamespace Medent{ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations.Schema; [Table("doctor")] public class Doctor { public Doctor(){ this.sched = new ObservableCollection(); } public long id { get; set; } public string fullName{ get; set; } public string speciality{ get; set; } public ICollection sched{ get; set; } public override string ToString() => fullName + " (" + speciality + ")"; }}Класссущностиpatient.csnamespace Medent{ using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations.Schema; [Table("patient")] public class Patient { public Patient(){ this.visits = new ObservableCollection(); } public long id { get; set; } public string fullName{ get; set; } public string phone { get; set; } public string email { get; set; } public ICollection visits { get; set; } public override string ToString() => fullName + " (" + phone + ")"; }}Класссущностиsched.csnamespace Medent{ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations.Schema; [Table("Schedule")] public class Sched { public Sched(){ this.visits = new ObservableCollection(); } public long id { get; set; } public Nullable idDoc{ get; set; } public Nullable sDate{ get; set; } [ForeignKey("idDoc")] public Doctor doc { get; set; } public ICollection visits { get; set; } public override string ToString() => (sDate ?? DateTime.Now).ToString("dd MMMM yyyyHH:mm"); }}Класссущностиuser.csnamespace Medent{ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel.DataAnnotations.Schema; [Table("user")] public class User { public User(){ this.visits = new ObservableCollection(); } public long id { get; set; } public string login { get; set; } public string passwd{ get; set; } public string fullName{ get; set; } public Nullable role { get; set; } public ICollection visits { get; set; } public override string ToString() => fullName; }}Класссущностиvisit.csnamespace Medent{ using System; using System.ComponentModel.DataAnnotations.Schema; [Table("visit")] public class Visit { public Visit() { } public long id { get; set; } public Nullable idPatient{ get; set; } public Nullable idSched{ get; set; } public Nullable idUser{ get; set; } public string status { get; set; } [ForeignKey("idPatient")] public Patient patient{ get; set; } [ForeignKey("idSched")] public Schedsched{ get; set; } [ForeignKey("idUser")] public User user{ get; set; } }}Класс формы авторизации dlgLogin.csusing System;using System.Linq;using System.Windows;namespace Medent{ /// /// Interaction logic for dlgLogin.xaml /// public partial class dlgLogin : Window { public dlgLogin() {InitializeComponent();this.Owner = App.Current.MainWindow;edLogin.Text = "Admin"; // +D+edPass.Password = "123"; // +D+ } private void LoginLoad(object sender, RoutedEventArgs e) { try{ if (dbMed.DB.users.Count() > 0) return; } catch (Exception ex){ MessageBox.Show("Ошибкасоединения: " + ex.Message, "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); return; }if (MessageBox.Show("Нет пользователей системы. Добавить?", "Вход невозможен", MessageBoxButton.YesNo) == MessageBoxResult.No){ Close(); return; } User usr = new User();usr.login = "Admin";usr.passwd = "123";usr.role = 1;dbMed.DB.users.Add(usr);dbMed.DB.SaveChanges();MessageBox.Show("Создан Admin, пароль 123", "Добавлено", MessageBoxButton.OK);Close(); } private void LoginClick(object sender, RoutedEventArgs e) { try{ dbMed.loginUser = dbMed.DB.users.FirstOrDefault(p => p.login == edLogin.Text && p.passwd == edPass.Password); } catch (Exception ex){ MessageBox.Show("Ошибкасоединения: " + ex.Message, "Ошибка",MessageBoxButton.OK,MessageBoxImage.Error); return; } if (dbMed.loginUser == null) { MessageBox.Show("Имя пользователя или пароль не опознаны", "Отказ");return; } // MessageBox.Show("Вы вошли как "+ dbMed.loginUser, "Доступ разрешен"); //+D+DialogResult = true; if (dbMed.loginUser.role.Equals(1)) // AdminApp.MainFrame.Navigate(new pgUser()); elseApp.MainFrame.Navigate(new pgPatient()); Close(); } private void ExitClick(object sender, RoutedEventArgs e) {DialogResult = false;Close(); // IsCancel = true } }}Главная формаusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;namespace Medent{ /// /// Interaction logic for MainWindow.xaml /// public partial class MainWindow : Window { public MainWindow() {InitializeComponent();App.MainFrame = MainFrame; } private void Window_Loaded(object sender, RoutedEventArgs e) { if (!(new dlgLogin()).ShowDialog().Equals(true)) // Попыткавхода в системуApplication.Current.Shutdown(); } private void MainFrame_ContentRendered(object sender, EventArgs e) { if (MainFrame.CanGoBack) // Кнопка НАЗАДbtnBack.Visibility = Visibility.Visible; elsebtnBack.Visibility = Visibility.Hidden; } private void btnExit_Click(object sender, RoutedEventArgs e) {App.Current.Shutdown(); // Adios, amigas } private void btnBack_Click(object sender, RoutedEventArgs e) { if (MainFrame.CanGoBack) MainFrame.GoBack(); } }}Приложение 2Скрипт dbadmin.sqldrop schema if exists MedentDB;create schema MedentDB;create user if not exists medentusr identified by 'medentusr';/* admin */revoke all privileges on *.* from 'medentusr'@'%';grant all on medentDB.* to 'medentusr'@'%' WITH GRANT OPTION;Скрипт dbcreate.sql-- MySQL Workbench Forward EngineeringSET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0;SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0;SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION';-- ------------------------------------------------------- Schema MedentDB-- ------------------------------------------------------- ------------------------------------------------------- Schema MedentDB-- -----------------------------------------------------CREATE SCHEMA IF NOT EXISTS `MedentDB` DEFAULT CHARACTER SET utf8 ;USE `MedentDB` ;-- ------------------------------------------------------- Table `MedentDB`.`user`-- -----------------------------------------------------CREATE TABLE IF NOT EXISTS `MedentDB`.`user` ( `id` INT NOT NULL AUTO_INCREMENT, `login` VARCHAR(45) NULL, `passwd` VARCHAR(45) NULL, `fullName` VARCHAR(140) NULL, `role` TINYINT(1) NULL, PRIMARY KEY (`id`))ENGINE = InnoDB;-- ------------------------------------------------------- Table `MedentDB`.`doctor`-- -----------------------------------------------------CREATE TABLE IF NOT EXISTS `MedentDB`.`doctor` ( `id` INT NOT NULL AUTO_INCREMENT, `fullName` VARCHAR(140) NULL, `speciality` VARCHAR(45) NULL, PRIMARY KEY (`id`))ENGINE = InnoDB;-- ------------------------------------------------------- Table `MedentDB`.`schedule`-- -----------------------------------------------------CREATE TABLE IF NOT EXISTS `MedentDB`.`schedule` ( `id` INT NOT NULL AUTO_INCREMENT, `idDoc` INT NULL, `sDate` DATETIME NULL, PRIMARY KEY (`id`), INDEX `docFK_idx` (`idDoc` ASC) VISIBLE, CONSTRAINT `docFK` FOREIGN KEY (`idDoc`) REFERENCES `MedentDB`.`doctor` (`id`) ON DELETE SET NULL ON UPDATE CASCADE)ENGINE = InnoDB;-- ------------------------------------------------------- Table `MedentDB`.`patient`-- -----------------------------------------------------CREATE TABLE IF NOT EXISTS `MedentDB`.`patient` ( `id` INT NOT NULL AUTO_INCREMENT, `fullName` VARCHAR(140) NULL, `phone` VARCHAR(16) NULL, `email` VARCHAR(70) NULL, PRIMARY KEY (`id`))ENGINE = InnoDB;-- ------------------------------------------------------- Table `MedentDB`.`Visit`-- -----------------------------------------------------CREATE TABLE IF NOT EXISTS `MedentDB`.`Visit` ( `id` INT NOT NULL AUTO_INCREMENT, `idPatient` INT NULL, `idSched` INT NULL, `idUser` INT NULL, `status` VARCHAR(45) NULL, PRIMARY KEY (`id`), INDEX `userFK_idx` (`idUser` ASC) VISIBLE, INDEX `shedFK_idx` (`idSched` ASC) VISIBLE, INDEX `patientFK_idx` (`idPatient` ASC) VISIBLE, CONSTRAINT `userFK` FOREIGN KEY (`idUser`) REFERENCES `MedentDB`.`user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `schedFK` FOREIGN KEY (`idSched`) REFERENCES `MedentDB`.`schedule` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, CONSTRAINT `patientFK` FOREIGN KEY (`idPatient`) REFERENCES `MedentDB`.`patient` (`id`) ON DELETE SET NULL ON UPDATE CASCADE)ENGINE = InnoDB;SET SQL_MODE=@OLD_SQL_MODE;SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS;SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;
1. MySQL 8.0 Documentation: 3.2.1 System Requirements. URL: https://dev.mysql.com/doc/mysql-monitor/8.0/en/system-prereqs-reference.html
2. MySQL 8.0: Supported Platforms: MySQL Enterprise Monitor. URL: https://www.mysql.com/support/supportedplatforms/enterprise-monitor.html
3. Медицинская информационная система. URL: https://pkzdrav.ru/products/meditsinskaya-informatsionnaya-sistema/
4. 1С:Медицина. Поликлиника. URL: https://solutions.1c.ru/catalog/clinic
5. Клиника Онлайн - МИС для клиник и медицинских центров. URL: https://klinikon.ru/
6. MySQL 8.0 Reference Manual. URL: https://dev.mysql.com/doc/refman/8.0/en/
7. Что такое Visual Studio? URL: https://learn.microsoft.com/ru-ru/visualstudio/get-started/visual-studio-ide?view=vs-2022
8. Документация по C#. URL: https://learn.microsoft.com/ru-ru/dotnet/csharp
9. Entity Framework 6. URL: https://learn.microsoft.com/ru-ru/ef/ef6/
10. Создание пользовательского интерфейса с помощью конструктора XAML. URL: https://learn.microsoft.com/ru-ru/visualstudio/xaml-tools/creating-a-ui-by-using-xaml-designer-in-visual-studio?view=vs-2022
11. Стружкин, Н. П. Базы данных: проектирование : учебник для вузов / Н. П. Стружкин, В. В. Годин. — Москва : Издательство Юрайт, 2023. — 477 с. — (Высшее образование). — ISBN 978-5-534-00229-4. — Текст : электронный // Образовательная платформа Юрайт [сайт]. — URL: https://urait.ru/bcode/511019
12. Руководство. Начало работы с Entity Framework 6. URL: https://learn.microsoft.com/ru-ru/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application
13. ORM. Ключи и ссылки. https://neerc.ifmo.ru/wiki/index.php?title=ORM._%D0%9A%D0%BB%D1%8E%D1%87%D0%B8_%D0%B8_%D1%81%D1%81%D1%8B%D0%BB%D0%BA%D0%B8
14. ORM. URL: https://simpleone.ru/glossary/orm/#
15. Аннотации. URL: https://metanit.com/sharp/entityframework/6.3.php
16. Создание запросов LINQ на языке C#. URL: https://learn.microsoft.com/ru-ru/dotnet/csharp/linq/write-linq-queries
17. Что такое C#: плюсы и минусы язык. URL: https://gb.ru/blog/chto-takoe-c/