private void Button_Click(object sender, RoutedEventArgs e)
        {
            orderFromSupplierDetailTable selectedOrder = (orderFromSupplierDetailTable)IdNumberComboBox.SelectedItem;
            supplierTable selectedItem = (supplierTable)supplierChangingComboBox.SelectedItem;

            OrderFromSupplierBL.UpdateBL(materialName.Text, materialType.Text, Convert.ToInt32(amount.Text), Convert.ToInt32(price.Text), selectedItem, selectedOrder, Convert.ToInt32(activity.Text), notes.Text)
            ;
            this.Close();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            supplierTable selectedSupplier  = (supplierTable)supplierSelectionComboBox.SelectedItem;
            orderFromSupplierDetailTable id = OrderFromSupplierBL.AddOrderFromSupllier(name_txb.Text, type_txb.Text, Convert.ToInt32(amount_txb.Text), Convert.ToInt32(price_txb.Text),
                                                                                       selectedSupplier, notes_txb.Text);

            name_txb.Text   = "";
            type_txb.Text   = "";
            price_txb.Text  = "";
            notes_txb.Text  = "";
            amount_txb.Text = "";
            IdList.Add(id);
            ContinueOrderingMessage com = new ContinueOrderingMessage(this, this.IdList);

            this.Hide();
            com.ShowDialog();
        }
        public static orderFromSupplierDetailTable AddOrderFromSupplier(string name, string type, int amount, int price,
                                                                        supplierTable selectedSupplier, string notes)
        {
            orderFromSupplierDetailTable ofsdt = db.orderFromSupplierDetailTable.Add(new orderFromSupplierDetailTable()
            {
                amount        = amount,
                notes         = notes,
                active        = 0,
                name          = name,
                materialType  = type,
                price         = price,
                supplier_id   = selectedSupplier.Id,
                supplierTable = selectedSupplier
            });

            db.SaveChanges();
            return(ofsdt);
        }
        public static void UpdateOrderFromSupplierDetail(string materialName, string materialType,
                                                         int amount, int price,
                                                         supplierTable selectedItem, orderFromSupplierDetailTable selectedOrder, int activity, string notes)
        {
            orderFromSupplierDetailTable ofsdt = selectedOrder;

            ofsdt.name         = materialName;
            ofsdt.materialType = materialType;
            ofsdt.amount       = amount;
            ofsdt.price        = price;
            if (selectedItem != null)
            {
                ofsdt.supplierTable    = selectedItem;
                ofsdt.supplierTable.Id = selectedItem.Id;
            }
            ofsdt.orderFromSupplier_id = selectedOrder.Id;
            ofsdt.active = activity;
            ofsdt.notes  = notes;
            db.SaveChanges();
        }
 public static void UpdateBL(string materialName, string materialType, int amount, int price,
                             supplierTable selectedItem, orderFromSupplierDetailTable selectedOrder, int activity, string notes)
 {
     DataLayer.UpdateOrderFromSupplierDetail(materialName, materialType, amount, price, selectedItem, selectedOrder, activity, notes);
 }
        public static orderFromSupplierDetailTable AddOrderFromSupllier(string name, string type, int amount, int price, supplierTable selectedSupplier, string notes)
        {
            orderFromSupplierDetailTable ofsdt = DataLayer.AddOrderFromSupplier(name, type, amount, price, selectedSupplier, notes);

            return(ofsdt);
        }