- Xomega.Fwk_samples_1.3.zip
- AdventureWorks
- AdventureWorks.Client.Objects
- AdventureWorks.Client.Silverlight.Web
- AdventureWorks.Client.Silverlight
- AdventureWorks.Client.Web
- AdventureWorks.Client.WPF
- AdventureWorks.Entities
- AdventureWorks.Model
- _types.xom
- AdventureWorks.Model.xomproj
- aw_build_version.xom
- database_log.xom
- error_log.xom
- Framework
- base_operators.xom
- base_types.xom
- global.xom
- HumanResources
- department.xom
- employee.xom
- job_candidate.xom
- shift.xom
- Person
- address.xom
- address_type.xom
- contact.xom
- contact_type.xom
- country_region.xom
- state_province.xom
- Production
- bill_of_materials.xom
- culture.xom
- document.xom
- illustration.xom
- location.xom
- product.xom
- product_category.xom
- product_cost_history.xom
- product_description.xom
- product_document.xom
- product_inventory.xom
- product_list_price_history.xom
- product_model.xom
- product_model_illustration.xom
- product_model_product_description_culture.xom
- product_photo.xom
- product_product_photo.xom
- product_review.xom
- product_subcategory.xom
- scrap_reason.xom
- transaction_history.xom
- transaction_history_archive.xom
- unit_measure.xom
- work_order.xom
- work_order_routing.xom
- Purchasing
- product_vendor.xom
- purchase_order_detail.xom
- purchase_order_header.xom
- ship_method.xom
- vendor.xom
- Sales
- contact_credit_card.xom
- country_region_currency.xom
- credit_card.xom
- currency.xom
- currency_rate.xom
- customer.xom
- customer_address.xom
- individual.xom
- sales_order_detail.xom
- sales_order_header.xom
- sales_person.xom
- sales_reason.xom
- sales_tax_rate.xom
- sales_territory.xom
- sales_territory_history.xom
- shopping_cart_item.xom
- special_offer.xom
- special_offer_product.xom
- store.xom
- store_contact.xom
- AdventureWorks.Services
- AdventureWorks.sln
- Readme.txt
- Xomega.Fwk_src_1.3.zip
- Xomega.Framework
- xomega.fwk_src_1.3.zip
|
using System;
using System.Collections.Generic;
using System.Linq;
using Xomega.Framework;
using Xomega.Framework.Properties;
using Xomega.Framework.Lookup;
using System.ServiceModel;
using System.Collections;
using AdventureWorks.Client.Silverlight.EmployeeServiceRef;
namespace AdventureWorks.Client.Objects
{
public class StateProperty : EnumIntProperty
{
public const string EnumTypeStates = "states";
public const string AttributeCountry = "country";
public const string AttributeAbbrev = "abbrev";
public StateProperty(DataObject parent, string name)
: base(parent, name)
{
EnumType = EnumTypeStates;
}
protected void SetLookupTable(IEnumerable<State> states)
{
LookupTable res = GetLookupTable();
if (res == null)
{
List<Header> data = new List<Header>();
foreach (State st in states)
{
Header h = new Header(EnumType, "" + st.StateProvinceId, st.Name);
h[AttributeCountry] = st.CountryRegionCode;
h[AttributeAbbrev] = st.StateProvinceCode;
data.Add(h);
}
res = new LookupTable(EnumType, data, true);
LookupCache cache = LookupCache.Get(CacheType);
if (cache != null) cache.CacheLookupTable(res);
}
FirePropertyChange(new PropertyChangeEventArgs(PropertyChange.Items, null, null));
}
}
public class EmployeeStateProperty : StateProperty
{
public const string EnumTypeEmpStates = "employee states";
public EmployeeStateProperty(DataObject parent, string name)
: base(parent, name)
{
EnumType = EnumTypeEmpStates;
LookupTable res = GetLookupTable();
if (res == null)
{
EmployeeServiceClient clt = new EmployeeServiceClient();
clt.GetStatesCompleted += new EventHandler<GetStatesCompletedEventArgs>(clt_GetStatesCompleted);
clt.GetStatesAsync();
clt.CloseAsync();
}
}
void clt_GetStatesCompleted(object sender, GetStatesCompletedEventArgs e)
{
SetLookupTable(e.Result);
}
}
}
|
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