|
using System;
using System.Collections.Generic;
using System.ServiceModel;
using System.Windows;
using System.Windows.Input;
using AdventureWorks.Client.Objects;
using AdventureWorks.Services;
using Xomega.Framework;
namespace AdventureWorks.Client.WPF
{
public partial class EmployeeSearch : Window
{
private EmployeeCriteria criteria;
private DataObjectList<EmployeeRowObject> list;
public EmployeeSearch()
{
InitializeComponent();
}
protected override void OnInitialized(EventArgs e)
{
base.OnInitialized(e);
criteria = new EmployeeCriteria();
pnlCriteria.DataContext = criteria;
list = new DataObjectList<EmployeeRowObject>();
list.Editable = false;
gridResults.ItemsSource = list;
PostInitialize();
}
partial void PostInitialize();
public void Refresh()
{
btnSearch_Click(null, null);
}
private void btnSearch_Click(object sender, RoutedEventArgs e)
{
criteria.Validate(true);
ErrorList valErr = criteria.GetValidationErrors();
if (valErr.HasErrors())
{
Errors.Show(valErr);
return;
}
Employee_ReadListInput input = new Employee_ReadListInput();
criteria.ToDataContract(input);
ChannelFactory<IEmployeeService> factory = new ChannelFactory<IEmployeeService>("IEmployeeService");
IEmployeeService svc = factory.CreateChannel();
List<Employee_ReadListOutput> output = svc.ReadList(input);
list.FromDataContract(output);
factory.Close();
}
private void btnReset_Click(object sender, RoutedEventArgs e)
{
list.Clear();
}
private void btnClose_Click(object sender, RoutedEventArgs e)
{
Close();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Xomega Team is striving to increase productivity and development quality by utilizing Model Driven Development coupled with Code Generation and the best design practices for application development.
We provide MDD tools, code generators and frameworks for Visual Studio and .Net development.
Visit us at
http://www.xomega.net