public void GetOrderRoles() { WebserviceObject wsObj = WebserviceCalls.GetOrderRoles(order.OrderId); List<OrderRole> orderRoleList = new List<OrderRole>(); if (wsObj.Success) { foreach (OrderRole obj in (List<object>)wsObj.Response) orderRoleList.Add(obj); } else MessageBox.Show(wsObj.Response.ToString()); orderRoleList = orderRoleList.OrderBy(x => x.Name).ToList(); ObservableCollection<object> oList; oList = new ObservableCollection<object>(orderRoleList); dgOrderRoles.ItemsSource = oList; ordersWindow.GetOrders(); }
private void btnCreate_Click(object sender, RoutedEventArgs e) { if (tbOrderName.Text == "" || tbOrderDescription.Text == "" || cbbCustomers.SelectedItem == null) { MessageBox.Show("Please fill out the fields"); return; } string name = tbOrderName.Text; string description = tbOrderDescription.Text; int customerId = customersList[cbbCustomers.SelectedIndex].CustomerId; WebserviceObject wsObj = WebserviceCalls.CreateOrder(user.UserId, name, description, customerId); if (wsObj.Success) { ordersWindow.GetOrders(); Close(); } else { MessageBox.Show(wsObj.Response.ToString()); } }