This is a migrated thread and some comments may be shown as answers.

how to create telerik sales dashboard

6 Answers 143 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
big-O
Top achievements
Rank 1
big-O asked on 03 Jun 2010, 03:14 PM
Hello, I'm new in silverlight. I want to create a sales dashboard like in telerik demo (RadGridView, First Look Sample).
I can display Employees data from northwind database on silverlight radgridview. I uses Linq to SQL Class and WCF Service.
but I don't know how to get Orders and Order Details Data that relate with each employee, could anyone suggest me, please.

here is my code.

EmployeeService.vb

Imports System.ServiceModel  
Imports System.ServiceModel.Activation  
 
<ServiceContract(Namespace:="")>  
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>  
Public Class EmployeeService  
 
    <OperationContract()>  
    Function GetEmployee() As List(Of Employee)  
        Dim db = New EmployeeDataDataContext()  
        Dim emp = From e In db.Employees Where e.Title = "Sales Representative" Select e.Photo, e.EmployeeID, e.FirstName, e.LastName, e.Title, e.Address, e.City, e.PostalCode, e.HomePhone, e.BirthDate, e.HireDate Order By EmployeeID  
        Dim SalesRepList As List(Of Employee) = New List(Of Employee)  
        For Each e In emp  
            Dim SaleRep As Employee = New Employee()  
            SaleRep.EmployeeID = e.EmployeeID  
            SaleRep.FirstName = e.FirstName  
            SaleRep.LastName = e.LastName  
            SaleRep.Title = e.Title  
            SaleRep.Address = e.Address  
            SaleRep.City = e.City  
            SaleRep.PostalCode = e.PostalCode  
            SaleRep.HomePhone = e.HomePhone  
            SaleRep.BirthDate = e.BirthDate  
            SaleRep.HireDate = e.HireDate  
            SalesRepList.Add(SaleRep)  
        Next 
        Return SalesRepList  
 
    End Function 

MainPage.xaml.vb

Imports Telerik.Windows.Controls  
 
Partial Public Class MainPage  
    Inherits UserControl  
 
    Public Sub New()  
        InitializeComponent()  
        Dim svc As EmployeeServiceReference.EmployeeServiceClient = New EmployeeServiceReference.EmployeeServiceClient()  
        AddHandler svc.GetEmployeeCompleted, AddressOf svc_GetEmployeeCompleted  
        svc.GetEmployeeAsync()  
    End Sub 
 
    Private Sub svc_GetEmployeeCompleted(ByVal sender As ObjectByVal e As EmployeeServiceReference.GetEmployeeCompletedEventArgs)  
        gvEmployee.ItemsSource = e.Result  
    End Sub 
 
End Class 

please suggest me how to get orders and orderdetails that relate to each employee.
thank you.

6 Answers, 1 is accepted

Sort by
0
Valentin.Stoychev
Telerik team
answered on 04 Jun 2010, 09:07 AM
Hi prat,

you can download the source code of the sales dashboard from your account and to examine it.

Kind regards,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
big-O
Top achievements
Rank 1
answered on 04 Jun 2010, 12:54 PM
Thank you for your reply, I've already examined source code before I post this forum. I'm very new in silverlight. I see many class in source code and I don't understand it. I try to do like the example but it doesn't work in my project. so could you describe me again, please. my problem is only I don't know how to write code in WCF RIA Service to retrieve orders and order details data from northwind database. this is a part of source code that i told you I don't understand it.

        Private ReadOnly Property Employees() As ObservableCollection(Of Employee)  
            Get  
                If Me.m_employees Is Nothing Then  
                    m_employees = New RadObservableCollection(Of Employee)()  
 
                    Dim client As New WebClient()  
                    client.OpenReadAsync(New Uri(HtmlPage.Document.DocumentUri, EmployeesDataSource))  
                    AddHandler client.OpenReadCompleted, New OpenReadCompletedEventHandler(AddressOf GetEmployeesCompleted)  
 
 
                End If  
                Return Me.m_employees  
            End Get  
        End Property  
 
        Private Sub GetEmployeesCompleted(sender As Object, e As OpenReadCompletedEventArgs)  
            Dim document As XDocumentXDocument = XDocument.Load(e.Result)  
 
            Dim items As IEnumerable(Of Employee) = From element In document.Descendants("Employee") _  
                Select New Employee()  
 
            Me.m_employees.SuspendNotifications()  
            Me.m_employees.AddRange(items)  
            Me.m_employees.ResumeNotifications()  
 
            Me.SetEmployeeOrders()  
        End Sub 

AND...

 
        Private Sub SetEmployeeOrders()  
            For Each employee As Employee In Me.Employees  
                Dim employeeID As Integer = employee.EmployeeID  
 
                Dim employeeOrders As IEnumerable(Of Order) = From order In Me.Orders _  
                    Where order.EmployeeID = employeeID _  
                    Select order  
                For Each order As Order In employeeOrders  
                    employee.Orders.Add(order)  
                Next  
            Next  
            For Each order As Order In Me.Orders  
                Dim employeeID As System.Nullable(Of Integer) = order.EmployeeID  
 
                order.Employee = (From employee In Me.Employees _  
                    Where employeeemployeeID = employee.EmployeeID _  
                    Select employee).FirstOrDefault()  
            Next  
        End Sub 

Thank you again for your reply.
0
Valentin.Stoychev
Telerik team
answered on 04 Jun 2010, 01:00 PM
Hi prat,

the sales dashboard demos is not using WCF RIA services - it is using the Telerik ORM to connect to the DB. There is a nice whitepaper that describes everything in details:
http://www.telerik.com/libraries/whitepapers/Telerik_Sales_Dashboard_whitepaper.sflb

Regards,
Valentin.Stoychev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
big-O
Top achievements
Rank 1
answered on 05 Jun 2010, 05:05 AM
really thanks for your help. I try to create simple sales dashboard like in first look of radgridview demo.

http://demos.telerik.com/silverlight/#GridView/FirstLook

and I want to use WCF RIA services.
do you have any suggestion?

love telelik.
0
Accepted
Vlad
Telerik team
answered on 08 Jun 2010, 08:37 AM
Hi,

 You can copy the code from the first look demo and bind the grid to DomainDataSource similar to this demo.

Regards,
Vlad
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
big-O
Top achievements
Rank 1
answered on 08 Jun 2010, 11:17 AM
ohh, That's my need. Thank you very much
Tags
General Discussions
Asked by
big-O
Top achievements
Rank 1
Answers by
Valentin.Stoychev
Telerik team
big-O
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or