コード例 #1
0
ファイル: WindowOrders.xaml.cs プロジェクト: MagaProg/ServisC
 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;
 }
コード例 #2
0
        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     = "";
            }
        }