Ejemplo n.º 1
0
        private void cmb_systemViews_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownViewItem selectedView = this.cmb_systemViews.SelectedItem as DropDownViewItem;

            if (selectedView != null)
            {
                cmb_systemViews.SelectedItem  = selectedView;
                this.rTxtB_FetchXMLQuery.Text = selectedView.FetchXML;
            }
        }
Ejemplo n.º 2
0
        private void LoadSystemViews(EntityMetadata selectedEntity)
        {
            QueryExpression query = new QueryExpression("savedquery");

            query.ColumnSet.AddColumns(new string[] { "name", "fetchxml" });
            query.Criteria.AddCondition("returnedtypecode", ConditionOperator.Equal, selectedEntity.LogicalName);

            EntityCollection savedQueryCollection = _service.RetrieveMultiple(query);

            if (savedQueryCollection.Entities != null && savedQueryCollection.Entities.Count > 0)
            {
                IOrderedEnumerable <Entity> views = savedQueryCollection.Entities.OrderBy(v => v["name"] as string);
                foreach (Entity view in views)
                {
                    cmb_systemViews.Items.Add(new DropDownViewItem(view["name"] as string, view["fetchxml"] as string));
                }
                DropDownViewItem selectedView = cmb_systemViews.Items[0] as DropDownViewItem;
                cmb_systemViews.SelectedItem  = selectedView;
                this.rTxtB_FetchXMLQuery.Text = selectedView.FetchXML;
            }
        }