АРМ — основная тема материала.
lity = Visibility.Hidden;
DobServ.Visibility = Visibility.Hidden;
DobSkid.Visibility = Visibility.Hidden;
DobStages.Visibility = Visibility.Hidden;
DobStatusHistory.Visibility = Visibility.Hidden;
DobEmployee.Visibility = Visibility.Hidden;
stacButAdmin.Visibility = Visibility.Hidden;
exitt.Visibility = Visibility.Visible;
}
}
private void exitt_Click(object sender, RoutedEventArgs e)
{
var servissAddSer = DiplomchikEntities.GetContext().Employee.FirstOrDefault(x => x.ID_employee == AccountHelpClass.Id);
if (servissAddSer.Id_post == 1)
{
AppFrame.framelMain.Navigate(new MenuAdmin());
}
else
{
AppFrame.framelMain.Navigate(new Menu());
}
}
private void dob_Click(object sender, RoutedEventArgs e)
{
try
{
var openDialog = new OpenFileDialog();
openDialog.Filter = «Image files (*.BMP, *.JPG, *.GIP, *.TIP, *.PNG, *.ICO, *.EMF, *.WMF) | *.bmp; *.jpg, *.gif; *.tip; *.png; *.ico; *.emf; *.wwp»;
openDialog.ShowDialog();
if (openDialog.CheckFileExists && openDialog.FileName.Length > 0)
{
var bitmap = new BitmapImage();
bitmap.BeginInit();
bitmap.UriSource = new Uri(openDialog.FileName);
bitmap.DecodePixelWidth = 250;
bitmap.EndInit();
ImgDoc.Source = bitmap;
product89.Photo34 = File.ReadAllBytes(openDialog.FileName);
IdPic = 1;
borderIm.Background = Brushes.Transparent;
borderIm.BorderBrush = Brushes.Transparent;
dob.Visibility = Visibility.Hidden;
Продолжение листинга В.9.
}
}
catch
{
System.Windows.MessageBox.Show(«Ошибка загрузки изображения», «Ошибка»);
}
}
//ДОБАВЛЕНИЕ КЛИЕНТА
private void Button_Click(object sender, RoutedEventArgs e)
{
try
{
if (_client.ID_client == 0)
DiplomchikEntities.GetContext().Client.Add(_client);
DiplomchikEntities.GetContext().SaveChanges();
Hiistoryy historyObj1 = new Hiistoryy()
{
Id_Employee = AccountHelpClass.Id,
IdStatus = 3,
DateEvent = DateTime.Now
};
DiplomchikEntities.GetContext().Hiistoryy.Add(historyObj1);
System.Windows.MessageBox.Show(«Данные успешно добавлены!», «Уведомление», MessageBoxButton.OK, MessageBoxImage.Information);
AppFrame.framelMain.GoBack();
}
catch (Exception ex)
{
System.Windows.MessageBox.Show(ex.Message.ToString());
}
}
//Добавиление услуги
private void Button_Click_1(object sender, RoutedEventArgs e)
{
try
{
if (_servicHotel.ID_service == 0)
DiplomchikEntities.GetContext().Service.Add(_servicHotel);
System.Windows.MessageBox.Show(«Данные успешно добавлены!», «Уведомление», MessageBoxButton.OK, MessageBoxImage.Information);
Hiistoryy historyObj = new Hiistoryy()
{
Id_Employee = AccountHelpClass.Id,
IdStatus = 10,
DateEvent = DateTime.Now
};
DiplomchikEntities.GetContext().Hiistoryy.Add(historyObj);
DiplomchikEntities.GetContext().SaveChanges();
AppFrame.framelMain.GoBack();
}
catch (Exception Ex)
{
podpos1456.Visibility = Visibility.Visible;
nameService.BorderBrush = Brushes.Red;
podpos9092.Visibility = Visibility.Visible;
costSer.BorderBrush = Brushes.Red;
podposDis839.Visibility = Visibility.Visible;
System.Windows.MessageBox.Show(«Ошибка » + Ex.Message.ToString() + «Критическая работа приложения!», «Уведомление», MessageBoxButton.OK, MessageBoxImage.Warning);
}
}
//заказ
private void Button_Click_2(object sender, RoutedEventArgs e)
{
try
{
Order orderObj = new Order()
{
Date = Convert.ToDateTime(dateOrder.Text),
Srok = Convert.ToDateTime(srokOrder.Text),
Client = klientFIO.SelectedItem as Client,
Service = uskega.SelectedItem as Service,
PaymentStatus = statusOpl.SelectedItem as PaymentStatus,
Employee = manager.SelectedItem as Employee,
Id_orderStatus = 1
};
DiplomchikEntities.GetContext().Order.Add(orderObj);
Hiistoryy historyObj = new Hiistoryy()
{
Id_Employee = AccountHelpClass.Id,
IdStatus = 2,
DateEvent = DateTime.Now
Продолжение листинга В.9.
};
DiplomchikEntities.GetContext().Hiistoryy.Add(historyObj);
DiplomchikEntities.GetContext().SaveChanges();
System.Windows.MessageBox.Show(«Данные успешно добавлены!», «Уведомление», MessageBoxButton.OK, MessageBoxImage.Information);
AppFrame.framelMain.GoBack();
}
catch (Exception ex)
{
System.Windows.MessageBox.Show(ex.Message.ToString());
}
}
private void uskega_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int Usl = Convert.ToInt32(uskega.SelectedValue);
skiddka.ItemsSource = DiplomchikEntities.GetContext().DISCOUN.Where(x => x.ID_DISCOUNTT == Usl).ToList();
}
private void skiddka_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
int sk = Convert.ToInt32(skiddka.SelectedValue);
int st = Convert.ToInt32(uskega.SelectedValue);
var tdt = DiplomchikEntities.GetContext().Service.FirstOrDefault(x => x.Id_discount == sk);
var fdl = DiplomchikEntities.GetContext().Service.FirstOrDefault(x => x.ID_service == st);
if (tdt != null)
{
stoimosto.Text = tdt.Stom.ToString();
}
else
{
skiddka.IsEnabled = false;
stoimosto.Text = fdl.Stom.ToString();
Листинг В.10 – PageEmployeen.xaml.cs «Список сотрудников»
using InchikDiplomchik.ApplicatModel;
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 InchikDiplomchik.pages
{
/// <summary>
/// Логика взаимодействия для PageEmployeen.xaml
/// </summary>
public partial class PageEmployeen : Page
{
public PageEmployeen()
{
InitializeComponent();
listview.ItemsSource = DiplomchikEntities.GetContext().Employee.ToList();
tt1.Text = listview.Items.Count.ToString();
postEmp.SelectedValuePath = «ID_Post»;
postEmp.DisplayMemberPath = «NamePost»;
postEmp.ItemsSource = DiplomchikEntities.GetContext().Post.ToList();
var dpsh = DiplomchikEntities.GetContext().Employee.FirstOrDefault(x => x.DateOfBirth == DateTime.Today);
var dpsh1 = DiplomchikEntities.GetContext().Employee.Where(x => x.DateOfBirth == DateTime.Today).Count();
if (dpsh1 > 0)
{
borDatBth.Visibility = Visibility.Visible;
TxhappyEmp.Text = «Сегодня день рождения у » + dpsh.Post.NamePost + » » + dpsh.FIO;
}
}
private void filtr_Click(object sender, RoutedEventArgs e)
{
AppFrame.framelMain.Navigate(new PageEmployeen());
}
private void edit_Click(object sender, RoutedEventArgs e)
{
listview.ItemsSource = DiplomchikEntities.GetContext().Employee.ToList();
tt1.Text = listview.Items.Count.ToString();
}
private void addd_Click(object sender, RoutedEventArgs e)
Продолжение листинга В.10.
{
ClassAddEdit.Id = 1;
AppFrame.framelMain.Navigate(new AddEmployee(null));
}
private void othet1_Click(object sender, RoutedEventArgs e)
{
PrintDialog printObj = new PrintDialog();
if (printObj.ShowDialog() == true)
{
printObj.PrintVisual(listview, «»);
}
else
{
MessageBox.Show(«Пользователь прервал печать! «);
}
}
private void myCabinet_Click(object sender, RoutedEventArgs e)
{
AppFrame.framelMain.Navigate(new PersonalAccount(null));
}
private void zakaz_Click(object sender, RoutedEventArgs e)
{
AppFrame.framelMain.Navigate(new Zakaz(null));
}
