Advertisement
Guest User

Untitled

a guest
Dec 10th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. { ID = 3, CustomerName = xyz, SaleDate = 05.08.2013 00:00:00, TotalAmount = 10 }
  2.  
  3. var copyitem = Datagrid_NewSale.SelectedItem;
  4.  
  5. if (copyitem == null)
  6. {
  7. MessageBox.Show("Please select values from list");
  8. }
  9. if (copyitem != null)
  10. {
  11. MessageBox.Show(copyitem.ToString());
  12. }
  13.  
  14. public class CustomerDetailes
  15. {
  16. public string CustomerName { get; set; }
  17. }
  18.  
  19. public void viewcustomername()
  20. {
  21. List<CustomerDetailes> ilist = null;
  22. ilist = (from order in db.Customer
  23. select new CustomerDetailes
  24. {
  25. CustomerName= order.CustomerName
  26. }).ToList();
  27. txtCustumer.Text = ilist.ToString();
  28.  
  29. }
  30.  
  31. CustomerDetailes copyitem = (CustomerDetailes)Datagrid_NewSale.SelectedItem;
  32.  
  33. if (copyitem == null)
  34. {
  35. MessageBox.Show("Please select values from list");
  36. }
  37. if (copyitem != null)
  38. {
  39. MessageBox.Show(copyitem.ToString());
  40. }
  41.  
  42. txtCustomer.text=copyitem.CustomerName; //CustomerName into a textbox
  43.  
  44. List<CustomerDetails> customerDetails = new List<CustomerDetails>();
  45. List<CustomerDetails> MyCollection
  46. {
  47. get
  48. {
  49.  
  50. return myList;
  51. }
  52. set
  53. {
  54. myList = value;
  55. PropertyChanged(this, new PropertyChangedEventArgs("MyCollection"));
  56. }
  57. }
  58.  
  59. <DataGrid ItemsSource="{Binding MyCollection}"/>
  60.  
  61. dataGrid.Items.Add(new CustomerDetails(){Name = "abc"}, xyz propertis)
  62.  
  63. dynamic copyitem = dataGrid1.SelectedItem;
  64.  
  65. int localId = copyitem.ID;
  66.  
  67. var query= (from order in db.Customer
  68. where order.ID=localId
  69. select order).ToList();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement