/// <summary> /// /// Find on a field value /// </summary> /// <param name="name"></param> /// <param name="value"></param> /// <returns></returns> IEntityInstanceEnumerator FindStuff(String name, String value) { FilterCollection fc = _entityInst.GetFinderFilters(); FilterCollection newfc = new FilterCollection(); for (int i = 0; i < fc.Count; i++) { if (fc[i].GetType().FullName == "Microsoft.Office.Server.ApplicationRegistry.Runtime.WildcardFilter") { if (string.IsNullOrEmpty(name) || (0 == string.Compare(fc[i].Name.ToLower(), name.ToLower()))) { newfc.Add (fc[i]); } } } ((WildcardFilter)newfc[0]).Value = "%" + value + "%"; return(_entityInst.FindFiltered(newfc, _lobInst)); }
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); } }