|
@@ -1,5 +1,7 @@
|
|
|
-using System;
|
|
|
+using Microsoft.Win32;
|
|
|
+using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.IO;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
@@ -49,12 +51,41 @@ namespace Session1
|
|
|
|
|
|
private void save_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+ Agent updatedAgent = new Agent();
|
|
|
+ selectedAgent.Logo = imgPath.Text = selectedAgent.Logo;
|
|
|
+ selectedAgent.Title = agentName.Text;
|
|
|
+ selectedAgent.AgentTypeID = ((AgentType)agentType.SelectedItem).ID;
|
|
|
+ selectedAgent.Priority = Convert.ToInt32(agentPriority.Text);
|
|
|
+ selectedAgent.Address = agentAddress.Text;
|
|
|
+ selectedAgent.INN = agentINN.Text;
|
|
|
+ selectedAgent.KPP = agentKPP.Text;
|
|
|
+ selectedAgent.Phone = agentPhone.Text;
|
|
|
+ selectedAgent.DirectorName = agentDirector.Text;
|
|
|
+ selectedAgent.Email = agentEmail.Text;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ BaseConnect.baseModel.SaveChanges();
|
|
|
+ MessageBox.Show("Данные успешно изменены.");
|
|
|
+ Close();
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+ MessageBox.Show("Не удалось изменить данные.");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void cancel_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
Close();
|
|
|
}
|
|
|
+
|
|
|
+ private void addImage_Click(object sender, RoutedEventArgs e)
|
|
|
+ {
|
|
|
+ OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
|
+ openFileDialog.Filter = "*.jpg | *.png";
|
|
|
+ openFileDialog.ShowDialog();
|
|
|
+ string filePath = openFileDialog.FileName;
|
|
|
+ imgPath.Text = filePath;
|
|
|
+ }
|
|
|
}
|
|
|
}
|