d gj

d gj

  • NA
  • 64
  • 2.7k

How to group Northwind orders based on Customer ContactName

Apr 28 2017 5:47 AM
Im using northwind database . U may see the attached files .My view displays all orders from the database without an order . I want to display orders based on contactname (customer) and alphabetically . For example contact name AVARIA and under it to display all orders of this costumer and so on .

These are  the classes :Order and Customer

//------------------------------------------------------------------------------ // <auto-generated> //     This code was generated from a template. // //     Manual changes to this file may cause unexpected behavior in your application. //     Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------   namespace Northwind {     using System;     using System.Collections.Generic;     using System.ComponentModel.DataAnnotations.Schema;       public partial class Order     {         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]         public Order()         {             this.Order_Details = new HashSet<Order_Detail>();         }              public int OrderID { get; set; }         public string CustomerID { get; set; }         public Nullable<int> EmployeeID { get; set; }         public Nullable<System.DateTime> OrderDate { get; set; }         public Nullable<System.DateTime> RequiredDate { get; set; }         public Nullable<System.DateTime> ShippedDate { get; set; }         public Nullable<int> ShipVia { get; set; }         public Nullable<decimal> Freight { get; set; }         public string ShipName { get; set; }         public string ShipAddress { get; set; }         public string ShipCity { get; set; }         public string ShipRegion { get; set; }         public string ShipPostalCode { get; set; }         public string ShipCountry { get; set; }              public virtual Customer Customer { get; set; }         public virtual Employee Employee { get; set; }         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]         public virtual ICollection<Order_Detail> Order_Details { get; set; }         public virtual Shipper Shipper { get; set; }            } } 
//------------------------------------------------------------------------------ // <auto-generated> //     This code was generated from a template. // //     Manual changes to this file may cause unexpected behavior in your application. //     Manual changes to this file will be overwritten if the code is regenerated. // </auto-generated> //------------------------------------------------------------------------------   namespace Northwind {     using System;     using System.Collections.Generic;     using System.ComponentModel.DataAnnotations;     using System.ComponentModel.DataAnnotations.Schema;       public partial class Customer     {         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]         public Customer()         {             this.Orders = new HashSet<Order>();             this.CustomerDemographics = new HashSet<CustomerDemographic>();         }           public string CustomerID { get; set; }         public string CompanyName { get; set; }         public string ContactName { get; set; }         public string ContactTitle { get; set; }         public string Address { get; set; }         public string City { get; set; }           //     [StringLength(15, MinimumLength = 3, ErrorMessage = "Invalid")]         //  [MaxLength(15), MinLength(5)]                   //  public virtual Shipper Shipper { get; set; }             public string Region { get; set; }         public string PostalCode { get; set; }         public string Country { get; set; }         public string Phone { get; set; }         public string Fax { get; set; }           [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]         public virtual ICollection<Order> Orders { get; set; }         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]         public virtual ICollection<CustomerDemographic> CustomerDemographics { get; set; }        //   [NotMapped]        // public virtual Region Regionn { get; set; }        public virtual Region Regionn { get; set; }         public Nullable<int> RegionVia { get; set; }           //    public string Region { get; set; }         //  [NotMapped]         //   public List<Region> RegionList { get; set; }           //public Region Regionn { get; set; } // Navigation Property             //[NotMapped]         //  public string RegionID { get; set; }           //  [NotMapped]         //     public List<Region> RegionList { get; set; }           //   public int RegionID { get; set; }               } }   


Thank u so.

Attachment: test.zip

Answers (2)