public MultiSearchViewModel2013()
        {
            OrganizationServiceProxy.WithCredentials = true;

            // Get Config
            Dictionary <string, string> dataConfig = PageEx.GetWebResourceData();

            // Query the quick search entities
            QueryQuickSearchEntities();
            Dictionary <string, Entity> views = GetViewQueries();

            _parser = new QueryParser();

            foreach (string typeName in _entityTypeNames)
            {
                Entity view      = views[typeName];
                string fetchXml  = view.GetAttributeValueString("fetchxml");
                string layoutXml = view.GetAttributeValueString("layoutxml");

                // Parse the fetch and layout to get the attributes and columns
                FetchQuerySettings config = _parser.Parse(fetchXml, layoutXml);
                config.RecordCount = Knockout.Observable <string>();

                config.DataView = new VirtualPagedEntityDataViewModel(25, typeof(Entity), true);
                config.RecordCount.SetValue(GetResultLabel(config));
                Config.Push(config);


                // Wire up record count change
                config.DataView.OnPagingInfoChanged.Subscribe(OnPagingInfoChanged(config));
            }

            _parser.QueryDisplayNames();
        }
        public MultiSearchViewModel2013()
        {
            OrganizationServiceProxy.WithCredentials = true;

            // Get Config
            Dictionary<string, string> dataConfig = PageEx.GetWebResourceData();

            // Query the quick search entities
            QueryQuickSearchEntities();
            Dictionary<string, Entity> views = GetViewQueries();

            _parser = new QueryParser();

            foreach (string typeName in _entityTypeNames)
            {
                Entity view = views[typeName];
                string fetchXml = view.GetAttributeValueString("fetchxml");
                string layoutXml = view.GetAttributeValueString("layoutxml");

                // Parse the fetch and layout to get the attributes and columns
                FetchQuerySettings config = _parser.Parse(fetchXml, layoutXml);
                config.RecordCount = Knockout.Observable<string>();

                config.DataView = new VirtualPagedEntityDataViewModel(25, typeof(Entity), true);
                config.RecordCount.SetValue(GetResultLabel(config));
                Config.Push(config);

                // Wire up record count change
                config.DataView.OnPagingInfoChanged.Subscribe(OnPagingInfoChanged(config));

            }

            _parser.QueryDisplayNames();
        }
Ejemplo n.º 3
0
        public MultiSearchViewModel2013()
        {
            //OrganizationServiceProxy.WithCredentials = true;
            DependentObservableOptions<string> throttledSearchTermObservable = new DependentObservableOptions<string>();
            throttledSearchTermObservable.Model = this;
            throttledSearchTermObservable.GetValueFunction = new Func<string>(delegate
            {
                return this.SearchTerm.GetValue();

            });
            ThrottledSearchTerm = Knockout.DependentObservable<string>(throttledSearchTermObservable).Extend(new Dictionary("throttle", 400));
            ThrottledSearchTerm.Subscribe(new Action<string>(delegate(string search)
            {
                // Search whilst typing using the throttle extension
                SearchCommand();
            }));

            // Get Config
            Dictionary<string, string> dataConfig = PageEx.GetWebResourceData();
   
            // Query the quick search entities
            QueryQuickSearchEntities();
            Dictionary<string, Entity> views = GetViewQueries();

            _parser = new QueryParser();
           
            foreach (string typeName in _entityTypeNames)
            {
                Entity view = views[typeName];
                string fetchXml = view.GetAttributeValueString("fetchxml");
                string layoutXml = view.GetAttributeValueString("layoutxml");
                
                // Parse the fetch and layout to get the attributes and columns
                FetchQuerySettings config = _parser.Parse(fetchXml, layoutXml);
                config.RecordCount = Knockout.Observable<string>();
              
                config.DataView = new VirtualPagedEntityDataViewModel(25, typeof(Entity), true);
                config.RecordCount.SetValue(GetResultLabel(config));
                Config.Push(config);


                // Wire up record count change
                config.DataView.OnPagingInfoChanged.Subscribe(OnPagingInfoChanged(config));
                
            }

            _parser.QueryDisplayNames();

        }
Ejemplo n.º 4
0
        public MultiSearchViewModel2013()
        {
            //OrganizationServiceProxy.WithCredentials = true;
            DependentObservableOptions <string> throttledSearchTermObservable = new DependentObservableOptions <string>();

            throttledSearchTermObservable.Model            = this;
            throttledSearchTermObservable.GetValueFunction = new Func <string>(delegate
            {
                return(this.SearchTerm.GetValue());
            });
            ThrottledSearchTerm = Knockout.DependentObservable <string>(throttledSearchTermObservable).Extend(new Dictionary("throttle", 400));
            ThrottledSearchTerm.Subscribe(new Action <string>(delegate(string search)
            {
                // Search whilst typing using the throttle extension
                SearchCommand();
            }));

            // Get Config
            Dictionary <string, string> dataConfig = PageEx.GetWebResourceData();

            // Query the quick search entities
            QueryQuickSearchEntities();
            Dictionary <string, Entity> views = GetViewQueries();

            _parser = new QueryParser();

            foreach (string typeName in _entityTypeNames)
            {
                Entity view      = views[typeName];
                string fetchXml  = view.GetAttributeValueString("fetchxml");
                string layoutXml = view.GetAttributeValueString("layoutxml");

                // Parse the fetch and layout to get the attributes and columns
                FetchQuerySettings config = _parser.Parse(fetchXml, layoutXml);
                config.RecordCount = Knockout.Observable <string>();

                config.DataView = new VirtualPagedEntityDataViewModel(25, typeof(Entity), true);
                config.RecordCount.SetValue(GetResultLabel(config));
                Config.Push(config);


                // Wire up record count change
                config.DataView.OnPagingInfoChanged.Subscribe(OnPagingInfoChanged(config));
            }

            _parser.QueryDisplayNames();
        }
Ejemplo n.º 5
0
        public ActivitySubGridViewModel()
        {

            // Get the Quick Find View for the entity
            string getviewfetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                              <entity name='savedquery'>
                                <attribute name='name' />
                                <attribute name='fetchxml' />
                                <attribute name='layoutxml' />
                                <attribute name='returnedtypecode' />
                                <filter type='and'>
                                <filter type='or'>";

            getviewfetchXml += @"<condition attribute='returnedtypecode' operator='eq' value='" + "4200" + @"'/>";
            
            getviewfetchXml += @"
                                    </filter>
                                 <condition attribute='isquickfindquery' operator='eq' value='1'/>
                                    <condition attribute='isdefault' operator='eq' value='1'/>
                                </filter>
                               
                              </entity>
                            </fetch>";
            // Get the Quick Find View
            EntityCollection quickFindQuery = OrganizationServiceProxy.RetrieveMultiple(getviewfetchXml);
            _parser = new QueryParser();
            Entity view = quickFindQuery.Entities[0];
            string fetchXml = view.GetAttributeValueString("fetchxml");
            string layoutXml = view.GetAttributeValueString("layoutxml");

            // Parse the fetch and layout to get the attributes and columns
            ViewConfig = _parser.Parse(fetchXml, layoutXml);
            ViewConfig.DataView = new EntityDataViewModel(10, typeof(Entity), true);
            
            // Load the display name metadata
            _parser.QueryDisplayNames();
            
           
        }
Ejemplo n.º 6
0
        public MultiSearchViewModel()
        {
            // Get Config
            Dictionary<string, string> dataConfig = PageEx.GetWebResourceData();

            List<string> typeCodes = new List<string>();
            List<string> typeNames = new List<string>();

            // There is an odd behaviour with the savedquery fetchxml where you query with typecodes and get back typenames
            // so we need both to preserve the display order
            if (dataConfig.ContainsKey("typeCodes"))
            {
                typeCodes = (List<string>)(object)dataConfig["typeCodes"].Split(",");
                typeNames = (List<string>)(object)dataConfig["typeNames"].Split(",");
            }
            else
            {
                typeCodes = new List<string>("1", "2", "4", "4200", "3");
                typeNames = new List<string>("account", "contact", "lead", "activitypointer","opportunity");
            }

            // Get the Quick Find View for the entity
            string getviewfetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                              <entity name='savedquery'>
                                <attribute name='name' />
                                <attribute name='fetchxml' />
                                <attribute name='layoutxml' />
                                <attribute name='returnedtypecode' />
                                <filter type='and'>
                                <filter type='or'>";
            foreach (string view in typeCodes)
            {
                getviewfetchXml += @"<condition attribute='returnedtypecode' operator='eq' value='" + view + @"'/>";
            }
            getviewfetchXml += @"
                                    </filter>
                                 <condition attribute='isquickfindquery' operator='eq' value='1'/>
                                    <condition attribute='isdefault' operator='eq' value='1'/>
                                </filter>
                               
                              </entity>
                            </fetch>";
            // Get the Quick Find View
            EntityCollection quickFindQuery = OrganizationServiceProxy.RetrieveMultiple(getviewfetchXml);
            parser = new QueryParser();
            Dictionary<string, Entity> entityLookup = new Dictionary<string, Entity>();

            // Preseve the requested view order
            foreach (Entity view in quickFindQuery.Entities)
            {
                entityLookup[view.GetAttributeValueString("returnedtypecode")] = view;
            }
            foreach (string typeName in typeNames)
            {
                Entity view = entityLookup[typeName];
                string fetchXml = view.GetAttributeValueString("fetchxml");
                string layoutXml = view.GetAttributeValueString("layoutxml");

                // Parse the fetch and layout to get the attributes and columns
                FetchQuerySettings config = parser.Parse(fetchXml, layoutXml);
                config.DataView = new EntityDataViewModel(10, typeof(Entity), true);
                Config.Push(config);
            }

            // Load the display name metadata
            parser.QueryDisplayNames();

        }
Ejemplo n.º 7
0
        public MultiSearchViewModel()
        {
            // Get Config
            Dictionary <string, string> dataConfig = PageEx.GetWebResourceData();

            List <string> typeCodes = new List <string>();
            List <string> typeNames = new List <string>();

            // There is an odd behaviour with the savedquery fetchxml where you query with typecodes and get back typenames
            // so we need both to preserve the display order
            if (dataConfig.ContainsKey("typeCodes"))
            {
                typeCodes = (List <string>)(object) dataConfig["typeCodes"].Split(",");
                typeNames = (List <string>)(object) dataConfig["typeNames"].Split(",");
            }
            else
            {
                typeCodes = new List <string>("1", "2", "4", "4200", "3");
                typeNames = new List <string>("account", "contact", "lead", "activitypointer", "opportunity");
            }

            // Get the Quick Find View for the entity
            string getviewfetchXml = @"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                              <entity name='savedquery'>
                                <attribute name='name' />
                                <attribute name='fetchxml' />
                                <attribute name='layoutxml' />
                                <attribute name='returnedtypecode' />
                                <filter type='and'>
                                <filter type='or'>";

            foreach (string view in typeCodes)
            {
                getviewfetchXml += @"<condition attribute='returnedtypecode' operator='eq' value='" + view + @"'/>";
            }
            getviewfetchXml += @"
                                    </filter>
                                 <condition attribute='isquickfindquery' operator='eq' value='1'/>
                                    <condition attribute='isdefault' operator='eq' value='1'/>
                                </filter>
                               
                              </entity>
                            </fetch>";
            // Get the Quick Find View
            EntityCollection quickFindQuery = OrganizationServiceProxy.RetrieveMultiple(getviewfetchXml);

            parser = new QueryParser();
            Dictionary <string, Entity> entityLookup = new Dictionary <string, Entity>();

            // Preseve the requested view order
            foreach (Entity view in quickFindQuery.Entities)
            {
                entityLookup[view.GetAttributeValueString("returnedtypecode")] = view;
            }
            foreach (string typeName in typeNames)
            {
                Entity view      = entityLookup[typeName];
                string fetchXml  = view.GetAttributeValueString("fetchxml");
                string layoutXml = view.GetAttributeValueString("layoutxml");

                // Parse the fetch and layout to get the attributes and columns
                FetchQuerySettings config = parser.Parse(fetchXml, layoutXml);
                config.DataView = new EntityDataViewModel(10, typeof(Entity), true);
                Config.Push(config);
            }

            // Load the display name metadata
            parser.QueryDisplayNames();
        }