public static void LoadUserGroupCombo(ComboBox cbo, Boolean allowEmpty, String id) { CTable obj = new CTable("USER_GROUP"); ArrayList arr = OnixWebServiceAPI.GetUserGroupList(obj); List <MUserGroup> items = new List <MUserGroup>(); int idx = 0; int selectedIndex = 0; if (allowEmpty) { MUserGroup v = new MUserGroup(null); v.RowIndex = idx; items.Add(v); idx++; } foreach (CTable o in arr) { MUserGroup v = new MUserGroup(o); v.RowIndex = idx; items.Add(v); if (v.GroupID.Equals(id)) { selectedIndex = idx; } idx++; } cbo.ItemsSource = items; cbo.SelectedIndex = selectedIndex; }
public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData() { items = OnixWebServiceAPI.GetUserGroupList(model.GetDbObject()); lastObjectReturned = OnixWebServiceAPI.GetLastObjectReturned(); itemSources.Clear(); foreach (CTable o in items) { MUserGroup v = null; v = new MUserGroup(o); itemSources.Add(v); } Tuple <CTable, ObservableCollection <MBaseModel> > tuple = new Tuple <CTable, ObservableCollection <MBaseModel> >(lastObjectReturned, itemSources); return(tuple); }
protected override MBaseModel createObject() { MUserGroup mv = new MUserGroup(new CTable("")); return(mv); }