private void Button_Click(object sender, RoutedEventArgs e)
        {
            orderFromSupplierTable selectedOrder    = (orderFromSupplierTable)purchasingUpdateComboBox.SelectedItem;
            EmployeeTable          selectedEmployee = (EmployeeTable)EmployeeSelectionComboBox.SelectedItem;

            PurchasingFromSupplierBL.UpdateBL(selectedOrder, shippingNumber_txb.Text, receptoionNumber_txb.Text, selectedEmployee, Convert.ToDateTime(order_datepicker.Text), Convert.ToDateTime(supplying_datepicker.Text), notes_txb.Text, Convert.ToInt32(activity_txb.Text));
            this.Close();
        }
 public static void UpdatePurchaseFromSupplier(orderFromSupplierTable selectedOrder, string shippingNumber, string receptionNumber,
                                               EmployeeTable selectedEmployee, DateTime orderDate, DateTime supplyingDate, string notes, int active)
 {
     selectedOrder.shippingNumber  = shippingNumber;
     selectedOrder.receptionNumber = receptionNumber;
     selectedOrder.orderDate       = orderDate;
     selectedOrder.supplyingDate   = supplyingDate;
     if (selectedEmployee != null)
     {
         selectedOrder.employee_id   = selectedEmployee.Id;
         selectedOrder.EmployeeTable = selectedEmployee;
     }
     selectedOrder.notes  = notes;
     selectedOrder.active = active;
     db.SaveChanges();
 }
        public static void AddPurchaseFromSupplier(string shippingNumber, string receptionNumber, EmployeeTable employee,
                                                   DateTime orderDate, DateTime supplyingDate, string notes, List <orderFromSupplierDetailTable> Idlist)
        {
            orderFromSupplierTable ofst = db.orderFromSupplierTable.Add(new orderFromSupplierTable()
            {
                shippingNumber  = shippingNumber,
                receptionNumber = receptionNumber,
                employee_id     = employee.Id,
                EmployeeTable   = employee,
                orderDate       = orderDate,
                supplyingDate   = supplyingDate,
                notes           = notes,
                active          = 0
            });

            db.SaveChanges();
            foreach (orderFromSupplierDetailTable element in Idlist)
            {
                element.orderFromSupplier_id = ofst.Id;
            }
            db.SaveChanges();
        }
 public static void UpdateBL(orderFromSupplierTable selectedOrder, string shippingNumber, string receptionNumber,
                             EmployeeTable selectedEmployee, DateTime orderDate, DateTime supplyingDate, string notes, int active)
 {
     DataLayer.UpdatePurchaseFromSupplier(selectedOrder, shippingNumber, receptionNumber, selectedEmployee, orderDate, supplyingDate, notes, active);
 }