private void ViewModel() { BOProperty _obj = (BOProperty)cboSearchFieldName.SelectedItem; string fieldname = "", fieldvalue = ""; if (_obj != null) { fieldname = (string)_obj.Value; fieldvalue = txtSearchFieldValue.Text; } this.dgvAll.DataSource = mModel.ItemDataGridView(false, false, false, fieldname, fieldvalue); lblCountAll.Text = string.Format("# Records Found: {0}", dgvAll.Rows.Count); this.dgvSold.DataSource = mModel.ItemDataGridView(true, false, false, fieldname, fieldvalue); this.lblCountSold.Text = string.Format("# Records Found: {0}", dgvSold.Rows.Count); this.dgvBought.DataSource = mModel.ItemDataGridView(false, true, false, fieldname, fieldvalue); this.lblCountBought.Text = string.Format("# Records Found: {0}", dgvBought.Rows.Count); this.dgvInventoried.DataSource = mModel.ItemDataGridView(false, false, true, fieldname, fieldvalue); this.lblCountInventoried.Text = string.Format("# Records Found: {0}", dgvInventoried.Rows.Count); }
public AuthItem CreateBOAuthItem(BusinessObject _obj) { AuthItem _item = mAccountant.AuthItemMgr.CreateEntity(); _item.Type = AuthItem.AuthItemType.Category; AuthItem child_item_attribute = mAccountant.AuthItemMgr.CreateEntity(); child_item_attribute.Type = AuthItem.AuthItemType.Attribute; child_item_attribute.ItemName = string.Format("{0}.{1}", _obj.ObjectID, BOPropertyAttrType.Visible); child_item_attribute.Description = child_item_attribute.ItemName; child_item_attribute.DisplayName = child_item_attribute.ItemName; child_item_attribute.ParentItem = _item; _item.Children.Add(child_item_attribute); DecorateAuthItem(child_item_attribute, child_item_attribute.ItemName); child_item_attribute = mAccountant.AuthItemMgr.CreateEntity(); child_item_attribute.Type = AuthItem.AuthItemType.Attribute; child_item_attribute.ItemName = string.Format("{0}.{1}", _obj.ObjectID, BOPropertyAttrType.Enabled); child_item_attribute.Description = child_item_attribute.ItemName; child_item_attribute.DisplayName = child_item_attribute.ItemName; child_item_attribute.ParentItem = _item; _item.Children.Add(child_item_attribute); DecorateAuthItem(child_item_attribute, child_item_attribute.ItemName); _item.Tag = _obj; _item.GetItemNameFunc = delegate(object tag) { BusinessObject _tag = tag as BusinessObject; return(_tag.ObjectID); }; Dictionary <string, BOProperty> properties = _obj.Properties; foreach (BOProperty property in properties.Values) { AuthItem child_item = mAccountant.AuthItemMgr.CreateEntity(); child_item.Type = AuthItem.AuthItemType.Property; child_item.Tag = property; child_item.GetItemNameFunc = delegate(object tag) { BOProperty _tag = tag as BOProperty; return(string.Format("{0}.{1}", _obj.ObjectID, _tag.PropertyName)); }; child_item.ParentItem = _item; _item.Children.Add(child_item); DecorateAuthItem(child_item, child_item.ItemName); child_item_attribute = mAccountant.AuthItemMgr.CreateEntity(); child_item_attribute.Type = AuthItem.AuthItemType.Attribute; child_item_attribute.ItemName = string.Format("{0}.{1}.{2}", _obj.ObjectID, property.PropertyName, BOPropertyAttrType.Visible); child_item_attribute.Description = child_item_attribute.ItemName; child_item_attribute.DisplayName = child_item_attribute.ItemName; child_item_attribute.ParentItem = child_item; child_item.Children.Add(child_item_attribute); DecorateAuthItem(child_item_attribute, child_item_attribute.ItemName); child_item_attribute = mAccountant.AuthItemMgr.CreateEntity(); child_item_attribute.Type = AuthItem.AuthItemType.Attribute; child_item_attribute.ItemName = string.Format("{0}.{1}.{2}", _obj.ObjectID, property.PropertyName, BOPropertyAttrType.Enabled); child_item_attribute.Description = child_item_attribute.ItemName; child_item_attribute.DisplayName = child_item_attribute.ItemName; child_item_attribute.ParentItem = child_item; child_item.Children.Add(child_item_attribute); DecorateAuthItem(child_item_attribute, child_item_attribute.ItemName); } return(_item); }