public WindowOrders(Cluent s) { InitializeComponent(); this.cluent = s; Fiotex.Text = s.FullName; TelTex.Text = s.Telephone; AresTex.Text = s.Address; NameTex.Text = s.Orders.NameTechnic; OpisTex.Text = s.Orders.Malfunctions; DataTex.Text = s.Orders.DateOrders; }
private void OfOrders_Click(object sender, RoutedEventArgs e) { if (NAzvTech.Text == "" || Opis.Text == "" || DataRegis.Text == "" || FIO.Text == "" || Teleh.Text == "" || Adres.Text == "") { MessageBox.Show("Все поля должны быть заполнены", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Information); } else { Orders orders = new Orders() { NameTechnic = NAzvTech.Text, Malfunctions = Opis.Text, DateOrders = DataRegis.Text }; Cluent cluent = new Cluent() { FullName = FIO.Text, Telephone = Teleh.Text, Address = Adres.Text, idOrders = orders.id }; ODBconext.DB.Orders.Add(orders); ODBconext.DB.Cluent.Add(cluent); ODBconext.DB.SaveChanges(); MessageBox.Show("Заказ создан", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Information); NAzvTech.Text = ""; Opis.Text = ""; DataRegis.Text = ""; FIO.Text = ""; Teleh.Text = ""; Adres.Text = ""; } }