Esempio n. 1
0
 protected virtual void OnRowReady(RowReadyEventArgs e)
 {
     e.SelectionStatus = "Standard";
     if (this.RowReady != null)
     {
         this.RowReady(this, e);
     }
 }
        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);
                }
            }
        }
 void IRowConsumer.RowReady(object sender, RowReadyEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.SelectionStatus))
     {
         rowSel = e.SelectionStatus;
     }
     rows = e.Rows;
     if ((--consumersWaiting) == 0)
     {
         PartCommunicationMain();
     }
 }
Esempio n. 4
0
        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 PartCommunicationMain()
 {
     if (this.consumersWaiting == 0)
     {
         if (this.CellReady != null)
         {
             CellReadyEventArgs e = new CellReadyEventArgs {
                 Cell = this.Provide(ProviderPreference.SingleValue)
             };
             this.CellReady(this, e);
         }
         if (this.filterClear && (this.ClearFilter != null))
         {
             this.ClearFilter(this, EventArgs.Empty);
         }
         else if (this.filterNone && (this.NoFilter != null))
         {
             this.NoFilter(this, EventArgs.Empty);
         }
         else if (this.SetFilter != null)
         {
             SetFilterEventArgs args2 = new SetFilterEventArgs {
                 FilterExpression = this.Provide(ProviderPreference.FilterString) as string
             };
             this.SetFilter(this, args2);
         }
         if (this.listPartial && (this.PartialListReady != null))
         {
             PartialListReadyEventArgs args3 = new PartialListReadyEventArgs {
                 List = this.Provide(ProviderPreference.Table) as DataTable
             };
             this.PartialListReady(this, args3);
         }
         else if (this.ListReady != null)
         {
             ListReadyEventArgs args4 = new ListReadyEventArgs {
                 List = this.Provide(ProviderPreference.Table) as DataTable
             };
             this.ListReady(this, args4);
         }
         if (this.paramInNone && (this.NoParametersIn != null))
         {
             this.NoParametersIn(this, EventArgs.Empty);
         }
         else if (this.ParametersInReady != null)
         {
             ParametersInReadyEventArgs args5 = new ParametersInReadyEventArgs {
                 ParameterValues = this.Provide(ProviderPreference.Values) as string[]
             };
             this.ParametersInReady(this, args5);
         }
         if (this.paramOutNone && (this.NoParametersOut != null))
         {
             this.NoParametersOut(this, EventArgs.Empty);
         }
         else if (this.ParametersOutReady != null)
         {
             ParametersOutReadyEventArgs args6 = new ParametersOutReadyEventArgs {
                 ParameterValues = this.Provide(ProviderPreference.Values) as string[]
             };
             this.ParametersOutReady(this, args6);
         }
         if (this.RowReady != null)
         {
             RowReadyEventArgs args7 = new RowReadyEventArgs {
                 SelectionStatus = this.rowSel,
                 Rows            = this.Provide(ProviderPreference.Rows) as DataRow[]
             };
             this.RowReady(this, args7);
         }
     }
 }