/// <summary> /// Find by ID /// </summary> /// <returns></returns> IEntityInstanceEnumerator FindStuff() { IEnumerator it = _entityInst.GetMethodInstances().Keys.GetEnumerator(); MethodInstance m = null; while (it.MoveNext()) { String key = (String)it.Current; m = (MethodInstance)_entityInst.GetMethodInstances()[key]; { String b = m.MethodInstanceType.ToString(); if (b.Equals("IdEnumerator")) { break; } } } IEntityInstanceEnumerator itt = (IEntityInstanceEnumerator )_entityInst.Execute(m, _lobInst); while (itt.MoveNext()) { IEntityInstance e = (IEntityInstance)itt.Current; DataRow row = e.EntityAsDataRow(e.EntityAsDataTable); Object ob = row[0]; IEntityInstance ent = _entityInst.FindSpecific(ob, _lobInst); FormatRecord(ent); } return(itt); }
/// <summary> /// Gets the EntityInstances for SalesOrderHeader Entity and /// populate the DataTable /// </summary> /// <returns>Populated DataTable</returns> public DataTable GetSalesOrderHeaderItems() { if ((entitySalesOrderHeader != null) && (lobInstance != null)) { // Get the default filters IFilterCollection filters = entitySalesOrderHeader.GetMethodInstance( SalesOrderHeaderFinderName, MethodInstanceType.Finder).GetFilters(); // Execute the FindFiltered method online. IEntityInstanceEnumerator enumerator = entitySalesOrderHeader.FindFiltered( filters, SalesOrderHeaderFinderName, lobInstance, OperationMode.Online); SalesOrderTable = null; SalesOrderTable = catalog.Helper.CreateDataTable(enumerator); } return(SalesOrderTable); }
private List <Category> GetChildCategoriesByCategoryFromBDC(string categoryId) { List <Category> categories = new List <Category>(); if (!string.IsNullOrEmpty(categoryId)) { IEntityInstance sourceCategory = CategoryEntity.FindSpecific(categoryId, ProductCatalogSystem); EntityInstanceCollection source = new EntityInstanceCollection(); if (sourceCategory != null) { source.Add(sourceCategory); } IEntityInstanceEnumerator instanceEnumerator = CategoryEntity.FindAssociated(source, ProductCatalogSystem); while (instanceEnumerator.MoveNext()) { IEntityInstance categoryInstance = instanceEnumerator.Current; Category category = new Category(); category.CategoryId = (string)categoryInstance["CategoryId"]; category.Name = (string)categoryInstance["Name"]; category.ParentId = (string)categoryInstance["ParentId"]; categories.Add(category); string key = typeof(Category).FullName + categoryId; cache.Add(key, categories, null, Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(5f), CacheItemPriority.Normal, null); } } return(categories); }
private List <Product> GetProductsByCategoryFromBDC(string categoryId) { List <Product> products = new List <Product>(); IEntityInstance sourceCategory = CategoryEntity.FindSpecific(categoryId, ProductCatalogSystem); EntityInstanceCollection source = new EntityInstanceCollection(); if (source != null) { source.Add(sourceCategory); } IEntityInstanceEnumerator entitiesEnumerator = ProductEntity.FindAssociated(source, ProductCatalogSystem); while (entitiesEnumerator.MoveNext()) { IEntityInstance productInstance = entitiesEnumerator.Current; Product product = new Product(); product.CategoryId = (string)productInstance["CategoryId"]; product.ImagePath = (string)productInstance["ImagePath"]; product.LongDescription = (string)productInstance["LongDescription"]; product.ShortDescription = (string)productInstance["ShortDescription"]; product.Name = (string)productInstance["Name"]; product.Sku = (string)productInstance["Sku"]; product.ThumbnailImagePath = (string)productInstance["ThumbnailImagePath"]; products.Add(product); SetCachedProduct(product); } return(products); }
/// <summary> /// Gets the parts for a particular product specified by it's sku. /// </summary> /// <param name="sku">The sku to retrieve parts for.</param> /// <returns>The parts for this product.</returns> public IEnumerable <Part> GetPartsByProductSku(string sku) { List <Part> parts = new List <Part>(); IEntityInstance sourceProduct = ProductEntity.FindSpecific(sku, ProductCatalogSystem); EntityInstanceCollection source = new EntityInstanceCollection(); if (source != null) { source.Add(sourceProduct); } IEntityInstanceEnumerator entitiesEnumerator = PartEntity.FindAssociated(source, ProductCatalogSystem); while (entitiesEnumerator.MoveNext()) { IEntityInstance partInstance = entitiesEnumerator.Current; Part part = new Part(); part.Name = (string)partInstance["Name"]; part.PartId = (string)partInstance["PartId"]; parts.Add(part); } return(parts); }
public String find(String lob, String entityName, String fieldName, String query) { //DisplayLOBSystemsinBDC(); GetLob(lob); GetEntity(entityName); IEntityInstanceEnumerator enums = FindStuff(fieldName, query); return(this.GenerateXml(enums)); }
private static void IterateLOBSystems() { NamedLobSystemInstanceDictionary sysInstances = ApplicationRegistry.GetLobSystemInstances(); Console.WriteLine("Listing system instances..."); foreach (String name in sysInstances.Keys) { Console.WriteLine(name); } NamedLobSystemDictionary lobSystems = ApplicationRegistry.GetLobSystems(); foreach (LobSystem lobSystem in lobSystems.Values) { Console.WriteLine("Application: " + lobSystem.Name); NamedDataClassDictionary lobClasses = lobSystem.GetDataClasses(); foreach (DataClass dataClass in lobClasses.Values) { Console.WriteLine(" Entities: " + dataClass.Name); } if (lobSystem.Name == "AdventureWorksSample") { // work on a specific class DataClass customers = lobClasses["Customer"]; NamedMethodDictionary methods = customers.GetMethods(); foreach (Method meth in methods.Values) { Console.WriteLine(" Method: " + meth.Name); } } if (lobSystem.Name == "AdventureWorksLOBSystem") { // filter all femalce Employees Entity employees = lobSystem.GetEntities()["HumanResources.Employee"]; FilterCollection filtered = employees.GetFinderFilters(); (filtered[0] as ComparisonFilter).Value = 10; IEntityInstanceEnumerator empEnum = employees.FindFiltered(filtered, ApplicationRegistry.GetLobSystemInstances ()["AdventureWorksInstance"]); while (empEnum.MoveNext()) { DataTable dt = (empEnum.Current as DbEntityInstance).EntityAsDataTable; PrintDataRow(dt.Rows[0]); } } } }
//this method uses an Association from the model to return Items associated with the selected machine public List <BdcPart> GetPartsByMachineId(int machineId) { //Get Destination entity and Association IEntity entity = catalog.GetEntity(Constants.BdcEntityNameSpace, "Parts"); IAssociation association = (IAssociation)entity.GetMethodInstance("GetPartsByMachineID", MethodInstanceType.AssociationNavigator); //Get Source entity and add to collection (required for method call) IEntityInstance machineInstance = GetBdcEntityInstance(machineId, "Machines"); EntityInstanceCollection collection = new EntityInstanceCollection(); collection.Add(machineInstance); // Navigate the association. IEntityInstanceEnumerator associatedInstances = entity.FindAssociated(collection, association, partsManagementLobSystemInstance, OperationMode.Online); //Return a collection of View Models from the associated Data Table return(new DataMapper <BdcPart>(entity.Catalog.Helper.CreateDataTable(associatedInstances)).Collection); }
//This method uses a Wildcard Filter on the Read All Operation to return partial matches public List <BdcMachine> GetMachinesByModelNumber(string modelNumber) { //Get the BDC entity IEntity entity = catalog.GetEntity(Constants.BdcEntityNameSpace, "Machines"); //Get all Filters for the entity IFilterCollection filters = entity.GetDefaultFinderFilters(); //Set Filter value if (!string.IsNullOrEmpty(modelNumber)) { WildcardFilter filter = (WildcardFilter)filters[0]; filter.Value = modelNumber; } //Get Filtered ITems IEntityInstanceEnumerator enumerator = entity.FindFiltered(filters, partsManagementLobSystemInstance); return(new DataMapper <BdcMachine>(entity.Catalog.Helper.CreateDataTable(enumerator)).Collection); }
//This method uses a Wildcard Filter on the Read All Operation to return partial matches public List <BdcSupplier> GetSuppliersByName(string supplierName) { //Get the BDC entity IEntity entity = catalog.GetEntity(Constants.BdcContactsEntityNameSpace, "BdcSupplier"); //Get all Filters for the entity IFilterCollection filters = entity.GetMethodInstance("ReadList2", MethodInstanceType.Finder).GetFilters(); //Set Filter value) if (!string.IsNullOrEmpty(supplierName)) { WildcardFilter filter = (WildcardFilter)filters[0]; filter.Value = supplierName; } //Get Filtered ITems IEntityInstanceEnumerator enumerator = entity.FindFiltered(filters, "ReadList2", contactsLobSystemInstance); return(new DataMapper <BdcSupplier>(entity.Catalog.Helper.CreateDataTable(enumerator)).Collection); }
/// <summary> /// Get SalesOrderLine EntityInstances for a specific /// SalesOrderHeader. /// </summary> /// <param name="SalesOrderId">Id of SalesOrderHeader</param> /// <returns>Populated SalesOrderLine Instances</returns> public DataTable GetSalesOrderLineItems(int SalesOrderId) { Identity salesOrderIdentity = new Identity(SalesOrderId); // Get the specific SalesOrderHeader using FindSpecific IEntityInstance salesOrderinstance = entitySalesOrderHeader.FindSpecific( salesOrderIdentity, SalesOrderSpecificFinderName, lobInstance, OperationMode.Online); // Get the association IAssociation associationSalesOrderDetail = entitySalesOrderHeader.GetSourceAssociations() [SalesOrderAssociationName]; // Get the associated SalesOrderLine Instances IEntityInstanceEnumerator enumerator = salesOrderinstance.GetAssociatedInstances( associationSalesOrderDetail, OperationMode.Online); // Populate the SalesOrderLine table SalesOrderLineTable = null; // Clear the dirty rows, if any changedSalesLineRows.Clear(); SalesOrderLineTable = catalog.Helper.CreateDataTable(enumerator, true); if (SalesOrderLineTable != null) { SalesOrderLineTable.RowChanged += new DataRowChangeEventHandler(SalesOrderLineTable_RowChanged); } return(SalesOrderLineTable); }
/// <summary> /// Populates the Combo box with the available ECTs. /// </summary> public void PopulateControls() { RemoteSharedFileBackedMetadataCatalog Catalog = new RemoteSharedFileBackedMetadataCatalog(); IEntityInstanceEnumerator InstanceEnumerator = null; INamespacedEntityDictionaryDictionary entDictDict = Catalog.GetEntities("*"); foreach (INamedEntityDictionary entDict in entDictDict.Values) { foreach (IEntity entity in entDict.Values) { EntityLookup[entity.Name] = entity; ectList.Items.Add(entity.Name); } } //Fill the ECT combobox if (EntityLookup != null && EntityLookup.Count > 0) { foreach (IEntity entity in EntityLookup.Values) { InstanceEnumerator = entity.FindFiltered( entity.GetDefaultFinderFilters(), entity.GetMethodInstances(MethodInstanceType.Finder)[0].Value.Name, entity.GetLobSystem().GetLobSystemInstances()[0].Value, OperationMode.Online); System.Data.DataTable dt = Catalog.Helper.CreateDataTable(InstanceEnumerator); //System.Data.DataTable dt = Globals.ThisAddIn.GetBCSDataTest(); if (dt != null) { EntityDataLookup[entity] = dt; } } //ectList.DataSource = EntityCollection; ectList.SelectedIndex = 0; //ectList.SelectedItem = EntityCollection[0]; ectList.SelectedIndexChanged += new EventHandler(comboBox1_SelectedIndexChanged); } }
static void ExecuteBcsEctMethods(string siteUrl) { using (SPSite site = new SPSite(siteUrl)) { using (new SPServiceContextScope(SPServiceContext.GetContext(site))) { BdcServiceApplicationProxy proxy = (BdcServiceApplicationProxy)SPServiceContext.Current.GetDefaultProxy(typeof(BdcServiceApplicationProxy)); DatabaseBackedMetadataCatalog model = proxy.GetDatabaseBackedMetadataCatalog(); IEntity entity = model.GetEntity("EmployeeEntityModel.BdcModel1", "Entity1"); // Namespace, Entity name ILobSystemInstance lobSystemInstance = entity.GetLobSystem().GetLobSystemInstances()[0].Value; IMethodInstance method = entity.GetMethodInstance("ReadList", MethodInstanceType.Finder); // Finder method name IView view = entity.GetFinderView(method.Name); IFilterCollection filterCollection = entity.GetDefaultFinderFilters(); IEntityInstanceEnumerator entityInstanceEnumerator = entity.FindFiltered(filterCollection, method.Name, lobSystemInstance, OperationMode.Online); Console.WriteLine("Employee Login ID | Job Title"); while (entityInstanceEnumerator.MoveNext()) { Console.WriteLine(entityInstanceEnumerator.Current["LoginID"].ToString() + " - " + entityInstanceEnumerator.Current["JobTitle"].ToString()); // Column names } Console.ReadLine(); } } }
public override void Render(HtmlTextWriter output, bool isUpperBound) { string str = string.Empty; int num = 0; bool flag = this.Get <bool>("CheckStyle"); List <string> filterValues = this.GetFilterValues("filterval_" + base.ID, this.Get <string>("BdcInstanceID")); if (filterValues.Contains(string.Empty) || filterValues.Contains("0478f8f9-fbdc-42f5-99ea-f6e8ec702606")) { filterValues.Clear(); } if (!base.Le(4, true)) { output.WriteLine(ProductPage.GetResource("NopeEd", new object[] { roxority_FilterZen.FilterBase.GetFilterTypeTitle(base.GetType()), "Ultimate" })); base.Render(output, isUpperBound); } else { try { if (this.Get <bool>("DefaultIfEmpty")) { output.Write("<script type=\"text/javascript\" language=\"JavaScript\"> roxMultiMins['filterval_" + base.ID + "'] = '0478f8f9-fbdc-42f5-99ea-f6e8ec702606'; </script>"); if (!flag) { str = string.Format("<option value=\"{0}\"{2}>{1}</option>", "0478f8f9-fbdc-42f5-99ea-f6e8ec702606", base["Empty" + (this.Get <bool>("SendEmpty") ? "None" : "All"), new object[0]], (((filterValues.Count == 0) || filterValues.Contains(string.Empty)) || filterValues.Contains("0478f8f9-fbdc-42f5-99ea-f6e8ec702606")) ? " selected=\"selected\"" : string.Empty); } else { str = string.Format("<span><input class=\"rox-check-default\" name=\"filterval_" + base.ID + "\" type=\"" + (base.AllowMultiEnter ? "checkbox" : "radio") + "\" id=\"empty_filterval_" + base.ID + "\" value=\"{1}\" {3}" + (string.IsNullOrEmpty(base.HtmlOnChangeAttr) ? (" onclick=\"jQuery('.chk-" + base.ID + "').attr('checked', false);\"") : base.HtmlOnChangeAttr.Replace("onchange=\"", "onclick=\"jQuery('.chk-" + base.ID + "').attr('checked', false);")) + "/><label for=\"empty_filterval_" + base.ID + "\">{2}</label></span>", new object[] { ProductPage.GuidLower(Guid.NewGuid()), "0478f8f9-fbdc-42f5-99ea-f6e8ec702606", base["Empty" + (this.Get <bool>("SendEmpty") ? "None" : "All"), new object[0]], (((filterValues.Count == 0) || filterValues.Contains(string.Empty)) || filterValues.Contains("0478f8f9-fbdc-42f5-99ea-f6e8ec702606")) ? " checked=\"checked\"" : string.Empty }); } } if ((((this.LobInstance != null) && (this.Entity != null)) && ((this.View != null) && (this.ValueField != null))) && (this.DisplayField != null)) { using (IEntityInstanceEnumerator enumerator = this.Entity.FindFiltered(new FilterCollection(), this.LobInstance)) { while (enumerator.MoveNext()) { string str2; if ((enumerator.Current != null) && !string.IsNullOrEmpty(str2 = ProductPage.Serialize <object>(this.GetIdentifierValues(enumerator.Current)))) { num++; if (flag) { str = str + string.Format("<span><input class=\"chk-" + base.ID + " rox-check-value\" name=\"filterval_" + base.ID + "\" type=\"" + (base.AllowMultiEnter ? "checkbox" : "radio") + "\" id=\"x{0}\" value=\"{1}\" {3}" + ((string.IsNullOrEmpty(base.HtmlOnChangeAttr) && this.Get <bool>("DefaultIfEmpty")) ? (" onclick=\"document.getElementById('empty_filterval_" + base.ID + "').checked=false;\"") : base.HtmlOnChangeAttr.Replace("onchange=\"", "onclick=\"" + (this.Get <bool>("DefaultIfEmpty") ? ("document.getElementById('empty_filterval_" + base.ID + "').checked=false;") : string.Empty))) + "/><label for=\"x{0}\">{2}</label></span>", new object[] { ProductPage.GuidLower(Guid.NewGuid()), str2, base.GetDisplayValue(ProductPage.Trim(enumerator.Current[this.DisplayField.Name], new char[0])), filterValues.Contains(str2.ToString()) ? " checked=\"checked\"" : string.Empty }); } else { str = str + string.Format("<option value=\"{0}\"{2}>{1}</option>", str2, base.GetDisplayValue(ProductPage.Trim(enumerator.Current[this.DisplayField.Name], new char[0])), filterValues.Contains(str2.ToString()) ? " selected=\"selected\"" : string.Empty); } } if ((base.PickerLimit != 0) && (num >= base.PickerLimit)) { goto Label_04FB; } } } } Label_04FB: if (str.Length > 0) { if (flag) { output.Write("<div>" + str + "</div>"); } else { output.Write("<select" + (base.AllowMultiEnter ? " size=\"1\" multiple=\"multiple\" class=\"rox-multiselect ms-input\"" : " class=\"ms-input\"") + " name=\"{0}\" id=\"{0}\"{1}>" + str + "</select>", "filterval_" + base.ID, base.AllowMultiEnter ? base.HtmlOnChangeMultiAttr : base.HtmlOnChangeAttr); } } } catch (Exception exception) { base.Report(exception); } base.Render(output, isUpperBound); } }
String GenerateXml(IEntityInstanceEnumerator enums) { XmlDocument xmldoc = new XmlDocument(); //let's add the header XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration, "", ""); xmldoc.AppendChild(xmlnode); XmlElement xmlelem = xmldoc.CreateElement("", "OneBoxResults", "http://www.w3.org/2001/XMLSchema-instance"); xmldoc.AppendChild(xmlelem); XmlElement xmlelem2 = xmldoc.CreateElement(null, "resultCode", null); xmlelem.AppendChild(xmlelem2); xmlelem2.AppendChild(xmldoc.CreateTextNode("Success")); xmlelem2 = xmldoc.CreateElement("provider"); xmlelem.AppendChild(xmlelem2); xmlelem2.AppendChild(xmldoc.CreateTextNode("MOSS BDC")); xmlelem2 = xmldoc.CreateElement("title"); xmlelem.AppendChild(xmlelem2); XmlElement xmlelem3 = xmldoc.CreateElement("urlText"); xmlelem2.AppendChild(xmlelem3); xmlelem3.AppendChild(xmldoc.CreateTextNode("Results in MOSS - BDC")); xmlelem3 = xmldoc.CreateElement("urlLink"); xmlelem2.AppendChild(xmlelem3); xmlelem3.AppendChild(xmldoc.CreateTextNode(_entity.listUrl)); //find keys Regex reg = new Regex("{([^}]*)}"); //process actions //since onebox only allows one url,we only use one action here IEnumerator ait = _entity.actionCollection.GetEnumerator(); String url = null; while (ait.MoveNext()) { Action a = (Action)ait.Current; url = a.url; MatchCollection col = reg.Matches(url); IEnumerator it = col.GetEnumerator(); while (it.MoveNext()) { String match = ((Match)it.Current).Value; String key = match.Substring(1, match.Length - 2); _keys.Add(key, key); } } //now let's add body //let's add another element (child of the root) enums.Reset(); while (enums.MoveNext()) { xmlelem2 = xmldoc.CreateElement("MODULE_RESULT"); xmlelem.AppendChild(xmlelem2); IEntityInstance IE = enums.Current; String u = url; foreach (Field f in _entityInst.GetFinderView().Fields) { String key = f.Name; String value = IE[f] == null? "": IE[f].ToString(); if (_keys.ContainsKey(key)) { u = u.Replace("{" + key + "}", value); } xmlelem3 = xmldoc.CreateElement("Field"); XmlAttribute attr = xmldoc.CreateAttribute("name"); attr.Value = key; xmlelem3.Attributes.Append(attr); xmlelem2.AppendChild(xmlelem3); xmlelem3.AppendChild(xmldoc.CreateTextNode(value)); } if (u != null) { xmlelem3 = xmldoc.CreateElement("U"); xmlelem2.AppendChild(xmlelem3); xmlelem3.AppendChild(xmldoc.CreateTextNode(u)); } } return(toString(xmldoc)); }
public override void UpdatePanel(Panel panel) { string str = string.Format("<option value=\"{0}\"{2}>{1}</option>", string.Empty, string.Empty, string.Empty); string str2 = str; bool flag = false; "<div id=\"div_{0}\"><div class=\"rox-prop\"><label id=\"label_{0}\" for=\"{0}\">{1}</label></div><input style=\"width: 98%;\" class=\"ms-input\" type=\"text\" name=\"{0}\" id=\"{0}\" value=\"{2}\"{3}/></div>".Replace("<input ", "<input disabled=\"disabled\" "); string str5 = "<div id=\"div_{0}\"><div class=\"rox-prop\"><label id=\"label_{0}\" for=\"{0}\">{1}</label></div><select style=\"width: 98%;\" class=\"ms-input\" name=\"{0}\" id=\"{0}\"{2}>{3}</select></div>".Replace("<select ", "<select disabled=\"disabled\" "); string str6 = "<div id=\"div_{0}\" class=\"rox-prop\"><input onclick=\"{3}\" type=\"checkbox\" name=\"{0}\" id=\"{0}\"{2}/><label id=\"label_{0}\" for=\"{0}\">{1}</label></div>".Replace("<input ", "<input disabled=\"disabled\" "); "<div id=\"div_{0}\"><div class=\"rox-prop\"><label id=\"label_{0}\" for=\"{0}\">{1}</label></div><textarea rows=\"{3}\" onchange=\"{4}\" style=\"width: 96%;\" class=\"ms-input\" name=\"{0}\" id=\"{0}\">{2}</textarea></div>".Replace("<textarea ", "<textarea disabled=\"disabled\" "); panel.Controls.Add(new LiteralControl("<div class=\"roxsectionlink\"><a onclick=\"jQuery('#roxfilterspecial').slideToggle();\" href=\"#noop\">" + base["FilterProps", new object[] { roxority_FilterZen.FilterBase.GetFilterTypeTitle(base.GetType()) }] + "</a></div><fieldset style=\"padding: 4px; background-color: InfoBackground; color: InfoText;\" id=\"roxfilterspecial\" style=\"display: none;\">")); if (base.parentWebPart != null) { try { try { foreach (KeyValuePair <string, LobSystemInstance> pair in this.GetLobSystemInstances()) { try { foreach (KeyValuePair <string, Microsoft.Office.Server.ApplicationRegistry.MetadataModel.Entity> pair2 in this.GetEntities(pair.Value)) { try { if ((pair2.Value.GetIdentifierCount() == 1) && this.HasSpecificFinder(pair2.Value)) { string str3; str2 = str2 + string.Format("<option value=\"{0}\"{2}>{1}</option>", str3 = pair.Key + "{C453BF77-8CC4-4e1a-A50E-8A60B293CE94}" + pair2.Key, (pair.Value.ContainsLocalizedDisplayName() ? pair.Value.GetLocalizedDisplayName() : pair.Value.GetDefaultDisplayName()) + ": " + (pair2.Value.ContainsLocalizedDisplayName() ? pair2.Value.GetLocalizedDisplayName() : pair2.Value.GetDefaultDisplayName()), (flag = str3.Equals(this.Get <string>("BdcEntity"))) ? " selected=\"selected\"" : string.Empty); if (flag) { this.lobInstance = pair.Value; this.entity = pair2.Value; this.view = roxority_BusinessDataItemBuilderWebPart.GetView(this.entity); } } } catch (Exception exception) { base.Report(exception); } } } catch (Exception exception2) { base.Report(exception2); } } } catch (Exception exception3) { base.Report(exception3); } panel.Controls.Add(base.CreateControl(base.Le(4, false) ? "<div id=\"div_{0}\"><div class=\"rox-prop\"><label id=\"label_{0}\" for=\"{0}\">{1}</label></div><select style=\"width: 98%;\" class=\"ms-input\" name=\"{0}\" id=\"{0}\"{2}>{3}</select></div>" : str5, "BdcEntity", new object[] { " onchange=\"roxRefreshFilters();\"", str2 })); str2 = str; try { if (this.view != null) { foreach (Field field in this.view.Fields) { try { str2 = str2 + string.Format("<option value=\"{0}\"{2}>{1}</option>", field.Name, field.ContainsLocalizedDisplayName ? field.LocalizedDisplayName : field.DefaultDisplayName, (flag = field.Name.Equals(this.Get <string>("BdcValueField"))) ? " selected=\"selected\"" : string.Empty); if (flag) { this.valueField = field; } } catch (Exception exception4) { base.Report(exception4); } } } } catch (Exception exception5) { base.Report(exception5); } panel.Controls.Add(base.CreateControl(base.Le(4, false) ? "<div id=\"div_{0}\"><div class=\"rox-prop\"><label id=\"label_{0}\" for=\"{0}\">{1}</label></div><select style=\"width: 98%;\" class=\"ms-input\" name=\"{0}\" id=\"{0}\"{2}>{3}</select></div>" : str5, "BdcValueField", new object[] { " onchange=\"roxRefreshFilters();\"", str2 })); str2 = str; try { if (this.view != null) { foreach (Field field2 in this.view.Fields) { try { str2 = str2 + string.Format("<option value=\"{0}\"{2}>{1}</option>", field2.Name, field2.ContainsLocalizedDisplayName ? field2.LocalizedDisplayName : field2.DefaultDisplayName, (flag = field2.Name.Equals(this.Get <string>("BdcDisplayField"))) ? " selected=\"selected\"" : string.Empty); if (flag) { this.dispField = field2; } } catch (Exception exception6) { base.Report(exception6); } } } } catch (Exception exception7) { base.Report(exception7); } panel.Controls.Add(base.CreateControl(base.Le(4, false) ? "<div id=\"div_{0}\"><div class=\"rox-prop\"><label id=\"label_{0}\" for=\"{0}\">{1}</label></div><select style=\"width: 98%;\" class=\"ms-input\" name=\"{0}\" id=\"{0}\"{2}>{3}</select></div>" : str5, "BdcDisplayField", new object[] { " onchange=\"roxRefreshFilters();\"", str2 })); str2 = string.Format("<option value=\"{0}\"{2}>{1}</option>", string.Empty, base["Empty", new object[0]], string.Empty); if ((this.entity != null) && (this.view != null)) { if (this.valueField == null) { this.valueField = this.view.Fields[0]; } if (this.valueField != null) { if (this.dispField == null) { this.dispField = this.valueField; } using (IEntityInstanceEnumerator enumerator = this.entity.FindFiltered(new FilterCollection(), this.lobInstance)) { while (enumerator.MoveNext()) { string str4; if ((enumerator.Current != null) && !string.IsNullOrEmpty(str4 = ProductPage.Serialize <object>(this.GetIdentifierValues(enumerator.Current)))) { str2 = str2 + string.Format("<option value=\"{0}\"{2}>{1}</option>", str4, enumerator.Current[this.dispField.Name], str4.ToString().Equals(this.Get <string>("BdcInstanceID")) ? " selected=\"selected\"" : string.Empty); } } } } } panel.Controls.Add(base.CreateControl(base.Le(4, false) ? "<div id=\"div_{0}\"><div class=\"rox-prop\"><label id=\"label_{0}\" for=\"{0}\">{1}</label></div><select style=\"width: 98%;\" class=\"ms-input\" name=\"{0}\" id=\"{0}\"{2}>{3}</select></div>" : str5, "BdcInstanceID", new object[] { " onchange=\"" + scriptCheckDefault + "\"", str2 })); } catch (Exception exception8) { base.Report(exception8); } finally { try { if ((this.lobInstance != null) && (this.lobInstance.CurrentConnection != null)) { this.lobInstance.CloseConnection(); } } catch (Exception exception9) { base.Report(exception9); } } } panel.Controls.Add(new LiteralControl("</fieldset>")); try { panel.Controls.Add(base.CreateControl(base.Le(4, false) ? "<div id=\"div_{0}\" class=\"rox-prop\"><input onclick=\"{3}\" type=\"checkbox\" name=\"{0}\" id=\"{0}\"{2}/><label id=\"label_{0}\" for=\"{0}\">{1}</label></div>" : str6, "SendNull", new object[] { base.GetChecked(this.Get <bool>("SendNull")) })); base.UpdatePanel(panel); panel.Controls.Add(base.CreateScript(scriptCheckDefault)); } catch (Exception exception10) { base.Report(exception10); } }
public override void Render(System.Web.UI.HtmlTextWriter output, bool isUpperBound) { string options = string.Empty, valueID; int index = 0; bool checkStyle = Get <bool> ("CheckStyle"); List <string> filvals = GetFilterValues(PREFIX_FIELDNAME + ID, Get <string> ("BdcInstanceID")); if (filvals.Contains(string.Empty) || filvals.Contains(CHOICE_EMPTY)) { filvals.Clear(); } if (!Le(4, true)) { output.WriteLine(ProductPage.GetResource("NopeEd", GetFilterTypeTitle(GetType()), "Ultimate")); base.Render(output, isUpperBound); return; } try { if (Get <bool> ("DefaultIfEmpty")) { output.Write("<script type=\"text/javascript\" language=\"JavaScript\"> roxMultiMins['filterval_" + ID + "'] = '" + CHOICE_EMPTY + "'; </script>"); if (!checkStyle) { options = string.Format(FORMAT_LISTOPTION, CHOICE_EMPTY, this ["Empty" + (Get <bool> ("SendEmpty") ? "None" : "All")], ((filvals.Count == 0) || filvals.Contains(string.Empty) || filvals.Contains(CHOICE_EMPTY)) ? " selected=\"selected\"" : string.Empty); } else { options = string.Format("<span><input class=\"rox-check-default\" name=\"" + PREFIX_FIELDNAME + ID + "\" type=\"" + (AllowMultiEnter ? "checkbox" : "radio") + "\" id=\"empty_" + PREFIX_FIELDNAME + ID + "\" value=\"{1}\" {3}" + (string.IsNullOrEmpty(HtmlOnChangeAttr) ? (" onclick=\"jQuery(\'.chk-" + ID + "\').attr(\'checked\', false);\"") : HtmlOnChangeAttr.Replace("onchange=\"", "onclick=\"jQuery('.chk-" + ID + "').attr('checked', false);")) + "/><label for=\"empty_" + PREFIX_FIELDNAME + ID + "\">{2}</label></span>", ProductPage.GuidLower(Guid.NewGuid()), CHOICE_EMPTY, this ["Empty" + (Get <bool> ("SendEmpty") ? "None" : "All")], ((filvals.Count == 0) || filvals.Contains(string.Empty) || filvals.Contains(CHOICE_EMPTY)) ? " checked=\"checked\"" : string.Empty); } } if ((LobInstance != null) && (Entity != null) && (View != null) && (ValueField != null) && (DisplayField != null)) { using (IEntityInstanceEnumerator values = Entity.FindFiltered(new BdcFilterCollection(), LobInstance)) while (values.MoveNext()) { if ((values.Current != null) && !string.IsNullOrEmpty(valueID = ProductPage.Serialize <object> (GetIdentifierValues(values.Current)))) { index++; if (checkStyle) { options += string.Format("<span><input class=\"chk-" + ID + " rox-check-value\" name=\"" + PREFIX_FIELDNAME + ID + "\" type=\"" + (AllowMultiEnter ? "checkbox" : "radio") + "\" id=\"x{0}\" value=\"{1}\" {3}" + ((string.IsNullOrEmpty(HtmlOnChangeAttr) && Get <bool> ("DefaultIfEmpty")) ? (" onclick=\"document.getElementById('empty_" + PREFIX_FIELDNAME + ID + "').checked=false;\"") : HtmlOnChangeAttr.Replace("onchange=\"", "onclick=\"" + (Get <bool> ("DefaultIfEmpty") ? ("document.getElementById('empty_" + PREFIX_FIELDNAME + ID + "').checked=false;") : string.Empty))) + "/><label for=\"x{0}\">{2}</label></span>", ProductPage.GuidLower(Guid.NewGuid()), valueID, GetDisplayValue(ProductPage.Trim(values.Current [DisplayField.Name])), filvals.Contains(valueID.ToString()) ? " checked=\"checked\"" : string.Empty); } else { options += string.Format(FORMAT_LISTOPTION, valueID, GetDisplayValue(ProductPage.Trim(values.Current [DisplayField.Name])), filvals.Contains(valueID.ToString()) ? " selected=\"selected\"" : string.Empty); } } if ((PickerLimit != 0) && (index >= PickerLimit)) { break; } } } if (options.Length > 0) { if (checkStyle) { output.Write("<div>" + options + "</div>"); } else { output.Write("<select" + (AllowMultiEnter ? " size=\"1\" multiple=\"multiple\" class=\"rox-multiselect ms-input\"" : " class=\"ms-input\"") + " name=\"{0}\" id=\"{0}\"{1}>" + options + "</select>", PREFIX_FIELDNAME + ID, AllowMultiEnter ? HtmlOnChangeMultiAttr : HtmlOnChangeAttr); } } } catch (Exception ex) { Report(ex); } base.Render(output, isUpperBound); }
public override void UpdatePanel(Panel panel) { string baseOptions = string.Format(FORMAT_LISTOPTION, string.Empty, string.Empty, string.Empty), options = baseOptions, tmp; bool isSel = false; string valueID, formatDisabledTextBox = FORMAT_TEXTBOX.Replace("<input ", "<input disabled=\"disabled\" "), formatDisabledList = FORMAT_LIST.Replace("<select ", "<select disabled=\"disabled\" "), formatDisabledCheckBox = FORMAT_CHECKBOX.Replace("<input ", "<input disabled=\"disabled\" "), formatDisabledTextArea = FORMAT_TEXTAREA.Replace("<textarea ", "<textarea disabled=\"disabled\" "); panel.Controls.Add(new LiteralControl("<div class=\"roxsectionlink\"><a onclick=\"jQuery('#roxfilterspecial').slideToggle();\" href=\"#noop\">" + this ["FilterProps", GetFilterTypeTitle(GetType())] + "</a></div><fieldset style=\"padding: 4px; background-color: InfoBackground; color: InfoText;\" id=\"roxfilterspecial\" style=\"display: none;\">")); if (parentWebPart != null) { try { try { foreach (KeyValuePair <string, BdcLobSysInst> kvpLob in GetLobSystemInstances()) { try { foreach (KeyValuePair <string, BdcEntity> kvpEntity in GetEntities(kvpLob.Value)) { try { if ((kvpEntity.Value.GetIdentifierCount() == 1) && HasSpecificFinder(kvpEntity.Value)) { options += string.Format(FORMAT_LISTOPTION, tmp = kvpLob.Key + SEPARATOR + kvpEntity.Key, (kvpLob.Value.ContainsLocalizedDisplayName() ? kvpLob.Value.GetLocalizedDisplayName() : kvpLob.Value.GetDefaultDisplayName()) + ": " + (kvpEntity.Value.ContainsLocalizedDisplayName() ? kvpEntity.Value.GetLocalizedDisplayName() : kvpEntity.Value.GetDefaultDisplayName()), (isSel = tmp.Equals(Get <string> ("BdcEntity"))) ? " selected=\"selected\"" : string.Empty); if (isSel) { lobInstance = kvpLob.Value; entity = kvpEntity.Value; view = roxority_BusinessDataItemBuilderWebPart.GetView(entity); } } } catch (Exception ex) { Report(ex); } } } catch (Exception ex) { Report(ex); } } } catch (Exception ex) { Report(ex); } panel.Controls.Add(CreateControl(Le(4, false) ? FORMAT_LIST : formatDisabledList, "BdcEntity", " onchange=\"roxRefreshFilters();\"", options)); options = baseOptions; try { if (view != null) { foreach (BdcField field in view.Fields) { try { options += string.Format(FORMAT_LISTOPTION, field.Name, field.ContainsLocalizedDisplayName ? field.LocalizedDisplayName : field.DefaultDisplayName, (isSel = field.Name.Equals(Get <string> ("BdcValueField"))) ? " selected=\"selected\"" : string.Empty); if (isSel) { valueField = field; } } catch (Exception ex) { Report(ex); } } } } catch (Exception ex) { Report(ex); } panel.Controls.Add(CreateControl(Le(4, false) ? FORMAT_LIST : formatDisabledList, "BdcValueField", " onchange=\"roxRefreshFilters();\"", options)); options = baseOptions; try { if (view != null) { foreach (BdcField field in view.Fields) { try { options += string.Format(FORMAT_LISTOPTION, field.Name, field.ContainsLocalizedDisplayName ? field.LocalizedDisplayName : field.DefaultDisplayName, (isSel = field.Name.Equals(Get <string> ("BdcDisplayField"))) ? " selected=\"selected\"" : string.Empty); if (isSel) { dispField = field; } } catch (Exception ex) { Report(ex); } } } } catch (Exception ex) { Report(ex); } panel.Controls.Add(CreateControl(Le(4, false) ? FORMAT_LIST : formatDisabledList, "BdcDisplayField", " onchange=\"roxRefreshFilters();\"", options)); options = string.Format(FORMAT_LISTOPTION, string.Empty, this ["Empty"], string.Empty); if ((entity != null) && (view != null)) { if (valueField == null) { valueField = view.Fields [0]; } if (valueField != null) { if (dispField == null) { dispField = valueField; } using (IEntityInstanceEnumerator values = entity.FindFiltered(new BdcFilterCollection(), lobInstance)) while (values.MoveNext()) { if ((values.Current != null) && !string.IsNullOrEmpty(valueID = ProductPage.Serialize <object> (GetIdentifierValues(values.Current)))) { options += string.Format(FORMAT_LISTOPTION, valueID, values.Current [dispField.Name], valueID.ToString().Equals(Get <string> ("BdcInstanceID")) ? " selected=\"selected\"" : string.Empty); } } } } panel.Controls.Add(CreateControl(Le(4, false) ? FORMAT_LIST : formatDisabledList, "BdcInstanceID", " onchange=\"" + scriptCheckDefault + "\"", options)); } catch (Exception ex) { Report(ex); } finally { try { if ((lobInstance != null) && (lobInstance.CurrentConnection != null)) { lobInstance.CloseConnection(); } } catch (Exception ex) { Report(ex); } } } panel.Controls.Add(new LiteralControl("</fieldset>")); try { panel.Controls.Add(CreateControl(Le(4, false) ? FORMAT_CHECKBOX : formatDisabledCheckBox, "SendNull", GetChecked(Get <bool> ("SendNull")))); base.UpdatePanel(panel); panel.Controls.Add(CreateScript(scriptCheckDefault)); } catch (Exception ex) { Report(ex); } }