public void CellReady(object sender, CellReadyEventArgs cellReadyArgs) { RowReadyEventArgs rowArgs = new RowReadyEventArgs(); BdcView view = null; cellValue = cellReadyArgs.Cell; bool doit = IsEd || !Exed; if (_cellConnected && _rowConnected) { if (rowTable != null) { rowTable.Dispose(); } rowTable = new DataTable(); if (RowArgs.FieldList.Length > 0) { foreach (string f in RowArgs.FieldList) { rowTable.Columns.Add(f); } if (doit) { try { view = entity.GetSpecificFinderView(); if (entityInstance == null) { entityInstance = GetEntityInstance(view); } } catch { } } rowArgs.Rows = new DataRow [] { rowTable.Rows.Add(new List <string> (RowArgs.FieldList).ConvertAll <object> (delegate(string fieldName) { object val; if (!doit) { return(CellValue); } else if ((entityInstance != null) && (view != null)) { try{ foreach (Field f in view.Fields) { if (f.Name == fieldName) { return(((val = entityInstance [f]) == null) ? string.Empty : val.ToString()); } } } catch { } } return(string.Empty); }).ToArray()) }; OnRowReady(rowArgs); } } }
public IEntityInstance GetEntityInstance(Microsoft.Office.Server.ApplicationRegistry.MetadataModel.View desiredView) { if (!BdcClientUtilAvailable) { throw new Exception(base["BdcNotAvailable", new object[0]]); } if ((desiredView != null) && !string.Equals(desiredView.Name, GetView(this.entity).Name)) { throw new NotSupportedException(); } if (this.entityInstance == null) { this.entityInstance = this.entity.FindSpecific(this.IdentifierValues, this.systemInstance); } return(this.entityInstance); }
public IEntityInstance GetEntityInstance(BdcView desiredView) { if (!BdcClientUtilAvailable) { throw new Exception(this ["BdcNotAvailable"]); } if ((desiredView != null) && !string.Equals(desiredView.Name, entity.GetSpecificFinderView().Name)) { throw new NotSupportedException(); } if (entityInstance == null) { entityInstance = BdcClientUtil <IEntityInstance> ("FindEntity", entity, IdentifierValues, systemInstance); } return(entityInstance); }
public IEntityInstance GetEntityInstance(BdcView desiredView) { if (!BdcClientUtilAvailable) { throw new Exception(this ["BdcNotAvailable"]); } if ((desiredView != null) && !string.Equals(desiredView.Name, GetView(entity).Name)) { throw new NotSupportedException(); } if (entityInstance == null) #if SP12 { entityInstance = entity.FindSpecific(IdentifierValues, systemInstance); } #else { if (Identity != null) { try { entityInstance = entity.FindSpecific(identity, systemInstance); } catch (InvalidOperationException ex) { object [] arr; string s; Guid guid; if ((ex.Source == "Microsoft.SharePoint") && ex.Message.Contains("'System.Guid'") && ex.Message.Contains("'System.String'") && ((arr = IdentifierValues) != null) && (arr.Length > 0) && (!string.IsNullOrEmpty(s = arr [0] as string)) && !Guid.Empty.Equals(guid = ProductPage.GetGuid(s))) { arr [0] = guid; identity = new Identity(arr); entityInstance = entity.FindSpecific(identity, systemInstance); } else { throw; } } } } #endif return(entityInstance); }
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 void CellReady(object sender, CellReadyEventArgs cellReadyArgs) { Converter <string, object> converter = null; RowReadyEventArgs e = new RowReadyEventArgs(); Microsoft.Office.Server.ApplicationRegistry.MetadataModel.View view = null; this.cellValue = cellReadyArgs.Cell; bool doit = base.LicEd(4) || !this.Exed; if (this._cellConnected && this._rowConnected) { if (this.rowTable != null) { this.rowTable.Dispose(); } this.rowTable = new DataTable(); if (this.RowArgs.FieldList.Length > 0) { foreach (string str in this.RowArgs.FieldList) { this.rowTable.Columns.Add(str); } if (doit) { try { view = GetView(this.entity); if (this.entityInstance == null) { this.entityInstance = this.GetEntityInstance(view); } } catch { } } DataRow[] rowArray = new DataRow[1]; if (converter == null) { converter = delegate(string fieldName) { if (!doit) { return(this.CellValue); } if ((this.entityInstance != null) && (view != null)) { try { foreach (Field field in view.Fields) { if (field.Name == fieldName) { object obj2; return(((obj2 = this.entityInstance[field]) == null) ? string.Empty : obj2.ToString()); } } } catch { } } return(string.Empty); }; } rowArray[0] = this.rowTable.Rows.Add(new List <string>(this.RowArgs.FieldList).ConvertAll <object>(converter).ToArray()); e.Rows = rowArray; this.OnRowReady(e); } } }
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); } }