123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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;
- using BuzuevaDemo.Classes;
- namespace BuzuevaDemo.Pages
- {
- /// <summary>
- /// Логика взаимодействия для ChangeData.xaml
- /// </summary>
- public partial class ChangeData : Page
- {
- public int ind, id = 0;
- string newimg;
- ViewModel view = new ViewModel();
- public Agent agent;
- public string[] type = new string[6];
- public Agent buffer;
- public ChangeData(Agent idagent)
- {
- InitializeComponent();
- DataContext = idagent;
- agent = idagent;
- buffer = idagent;
- DataContext = buffer;
- typeag.ItemsSource = DataBase.BaseModel.AgentType.Where(x => x.ID > 0).ToList();
- typeag.SelectedValue = "ID";
- typeag.DisplayMemberPath = "Title";
- typeag.SelectedIndex = (int)buffer.AgentTypeID - 1;
- }
- private void Perezapis(object sender, RoutedEventArgs e)
- {
- try
- {
- agent.Title = Title.Text;
- agent.TitleType = typeag.Text;
- agent.Priority = Convert.ToInt32(Priority.Text);
- agent.Address = Address.Text;
- agent.INN = INN.Text;
- agent.KPP = KPP.Text;
- agent.Logo = newimg;
- agent.DirectorName = DirectorName.Text;
- agent.Phone = Phone.Text;
- agent.Email = Email.Text;
- DataBase.BaseModel.SaveChanges();
- view.agent = view.ListAgent();
- MessageBox.Show("Данные успешно обновлены");
- }
- catch
- {
- MessageBox.Show("Произошла ошибка слхранения", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
- }
- }
- private void NewImage(object sender, RoutedEventArgs e)
- {
- }
- }
- }
|