public void SetConsumerEntities(IEnumerator <BdcEntity> enumerator) { using (enumerator) if (enumerator.MoveNext()) { entity = enumerator.Current; } }
void GetEntity(String entityName) { IEnumerator it = _lob.entityCollection.GetEnumerator(); while (it.MoveNext()) { Entity en = (Entity)it.Current; if (en.name.Equals(entityName)) { _entity = en; break; } } _entityInst = _lobInst.GetEntities()[entityName]; }
internal bool HasSpecificFinder(BdcEntity ent) { #if SP12 return(ent.HasSpecificFinder()); #else try { Microsoft.SharePoint.BusinessData.Administration.Entity entity = ((object)ent) as Microsoft.SharePoint.BusinessData.Administration.Entity; if (entity == null) { entity = Microsoft.SharePoint.BusinessData.Administration.Entity.GetById((uint)ent.Id, bdcService.GetAdministrationMetadataCatalog(SPServiceContext.Current)); } return(entity.HasSpecificFinder()); } catch { return(true); } #endif }
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); } }
public static BdcView GetView(BdcEntity entity) { return(entity.GetDefaultSpecificFinderView()); }
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); } }
internal bool HasSpecificFinder(Microsoft.Office.Server.ApplicationRegistry.MetadataModel.Entity ent) { return(ent.HasSpecificFinder()); }