123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- using System;
- using System.Collections.Generic;
- using System.Data.Entity;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Media;
- namespace Prakticheskaya5_Venediktov
- {
- public partial class Users
- {
- public string gender;
- public string Genders
- {
- get { return gender; }
- set { gender = value; }
- }
- public string role;
- public string Roles
- {
- get { return role; }
- set { role = value; }
- }
- }
- public class User
- {
- public List<Users> usr;
- public User()
- {
- usr = newuser();
- }
- public List<Users> newuser()
- {
- List<Users> users = new List<Users>();
- Users buff;
- List<Users> bdusers = Base.database.Users.ToList();
- foreach (Users user in bdusers)
- {
- buff = new Users();
- buff.ID_User = user.ID_User;
- buff.Name = user.Name;
- buff.Surname = user.Surname;
- buff.Login = user.Login;
- buff.Password = user.Password;
- buff.ID_Gender = user.ID_Gender;
- buff.Birthday = user.Birthday;
- buff.ID_Role = user.ID_Role;
- buff.ID_Gender = user.ID_Gender;
- Pol gender = Base.database.Pol.FirstOrDefault(x => x.ID_Gender == buff.ID_Gender);
- buff.gender = gender.Gender;
- Role role = Base.database.Role.FirstOrDefault(x => x.ID_Role == buff.ID_Role);
- buff.role = role.Role1;
- users.Add(buff);
- }
- return users;
- }
- }
- public partial class Medicine
- {
-
- public string usedmedicined;
- public string Usedmedicined
- {
- get { return usedmedicined; }
- set { usedmedicined = value; }
- }
- public bool Color { get => Vid == "Сироп"; }
- public SolidColorBrush BGColor
- {
- get
- {
- if (Color)
- {
- return Brushes.Azure;
- }
- else
- {
- return Brushes.White;
- }
- }
- }
- public class Preparats
- {
- public List<Medicine> medicine;
- public Preparats()
- {
- medicine = newmedicine();
- }
- public List<Medicine> newmedicine()
- {
- List<Medicine> medicines = new List<Medicine>();
- Medicine buff;
- List<Medicine> bdmedicine = Base.database.Medicine.ToList();
- List<Used_medicined> bdusedmedicine = Base.database.Used_medicined.ToList();
- List<Users> bdusers = Base.database.Users.ToList();
- foreach (Medicine medicine in bdmedicine)
- {
- buff = new Medicine();
- buff.ID_Medicine = medicine.ID_Medicine;
- buff.Name_Medicine = medicine.Name_Medicine;
- buff.Vid = medicine.Vid;
- buff.Price = medicine.Price;
- string allmedicaments = "";
- foreach (Used_medicined used_Medicined in bdusedmedicine)
- {
- if (medicine.ID_Medicine == used_Medicined.ID_Medicine)
- {
- foreach (Users users in bdusers)
- {
- if (users.ID_User == used_Medicined.ID_User)
- {
- allmedicaments += used_Medicined.Users + ", ";
- medicine.usedmedicined = allmedicaments;
- break;
- }
- }
- }
- }
- buff.usedmedicined = medicine.usedmedicined;
- medicines.Add(buff);
- }
- return medicines;
- }
- }
- }
- }
|