public Animal_Window() { InitializeComponent(); db = new ZooContex(); db.Animals.Load(); AnimalList.ItemsSource = db.Animals.Local.ToBindingList(); }
public MainWindow() { InitializeComponent(); ZooContex db = new ZooContex(); db.Employess.Load(); this.Closing += MainWindow_Closing; }
public Employees(MainWindow main) { InitializeComponent(); main1 = main; db = new ZooContex(); db.Employess.Load(); EmployeesGrid.ItemsSource = db.Employess.Local.ToBindingList(); this.Closing += Employees_Closing; }
public Animal_Window() { DataContext = this; InitializeComponent(); db = new ZooContex(); db.Animals.Load(); db.Employess.Load(); AnimalList.ItemsSource = db.Animals.Local.ToBindingList(); KeeperText.ItemsSource = db.Employess.Local.Where(n => n.Position.Contains("Кипер")).Select(n => n.IDOfCertification).ToList(); }
public ProvidersWindow() { InitializeComponent(); db = new ZooContex(); db.Providers.Load(); db.Supplies.Load(); ProvidersGrid.ItemsSource = db.Providers.Local.ToBindingList(); SupplyGrid.ItemsSource = db.Supplies.Local.ToBindingList(); DataContext = this; namebox.ItemsSource = db.Providers.Local.Select(n => n.СompanyName).ToList(); }
private void Notification() { ZooContex db = new ZooContex(); db.Supplies.Load(); DateTime s = DateTime.Now; foreach (var elem in db.Supplies) { if (elem.SupDate.Day == s.Day && elem.SupDate.Month == s.Month) { MessageBox.Show("Напоминание, у вас сегодня поставка!"); } } }
public Output() { InitializeComponent(); ZooContex db = new ZooContex(); db.Animals.Load(); db.Employess.Load(); var select = from s in db.Employess join sl in db.Animals on s.IDOfCertification equals sl.KeeperID select new { EmpName = s.Name, KindOfAnimal = sl.KindOfAnimal }; foreach (var a in select) { NameInfo.Content += "\n" + a.EmpName; KindInfo.Content += "\n" + a.KindOfAnimal; } }
public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo) { BindingGroup group = (BindingGroup)value; ZooContex db = new ZooContex(); db.Employess.Load(); foreach (Models.Employees item in group.Items) { IEnumerable <Models.Employees> res = db.Employess.Local.Where(n => n.IDOfCertification == item.IDOfCertification); IEnumerable <Models.Employees> res1 = db.Employess.Local.Where(n => n.Name == item.Name); if (item.IDOfCertification == 0 || res.Count() != 0) { return(new ValidationResult(false, " Поле ID совпадает с другим ID либо равно нулю")); } if (item.Name == null || res1.Count() != 0 || !Regex.IsMatch(item.Name, _regex1)) { return(new ValidationResult(false, " Поле ФИО нулевое либо совпадает с другим ФИО")); } if (item.Position == null || !Regex.IsMatch(item.Position, _regex1)) { return(new ValidationResult(false, "Поле Должность нулевое или содержит цифры")); } if (item.Experience < 0) { return(new ValidationResult(false, "Стаж не может быть меньше нуля")); } if (item.BDAY > DateTime.Now.AddYears(-16)) { return(new ValidationResult(false, "Работник не может быть младше 16 лет")); } if (item.PhoneNumber == null || !Regex.IsMatch(item.PhoneNumber, _regex)) { return(new ValidationResult(false, "Шаблоны телефона +375ххххххххх или 80ххххххххх")); } } return(ValidationResult.ValidResult); }