当前位置: 首页>>代码示例>>C#>>正文


C# XrmServiceContext.RetrieveMultiple方法代码示例

本文整理汇总了C#中XrmServiceContext.RetrieveMultiple方法的典型用法代码示例。如果您正苦于以下问题:C# XrmServiceContext.RetrieveMultiple方法的具体用法?C# XrmServiceContext.RetrieveMultiple怎么用?C# XrmServiceContext.RetrieveMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XrmServiceContext的用法示例。


在下文中一共展示了XrmServiceContext.RetrieveMultiple方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateTree

        public CreateTree(XrmServiceContext context, Guid userGuid)
        {
            string fetchxml = "<fetch>"+
                "<entity name='expl_obecnasiec' >" +
                "<attribute name='expl_dyrektorregionu' />"+
                "<attribute name='expl_dyrektor' />"+
                "<attribute name='expl_koordynator' />"+
                "<attribute name='expl_konsultant' />" +
                "<order attribute='expl_dyrektorregionu' descending='true' />" +
                "<order attribute='expl_dyrektor' descending='true' />" +
                "<order attribute='expl_koordynator' descending='true' />" +
                "<order attribute='expl_konsultant' descending='true' />" +
                "<filter type='or' >" +
                "<condition entityname='Konsultant' attribute='contactid' operator='eq' value='" + userGuid + "' />"+
                "<condition entityname='Koordynator' attribute='contactid' operator='eq' value='" + userGuid + "' /> "+
                "<condition entityname = 'Dyrektor' attribute ='contactid' operator= 'eq' value = '" + userGuid + "' />"+
                "<condition entityname='DyrektorRegionu' attribute='contactid' operator='eq' value='" + userGuid + "' />"+
                "</filter>"+
                "<link-entity name='expl_pracownik' from='expl_pracownikid' to='expl_konsultant' alias='a_konsultant' >"+
                "<attribute name='expl_name' />" +
                "<attribute name='expl_pracownikid' />" +
                "<link-entity name='contact' from='contactid' to='expl_kontakt' alias='Konsultant' >" +
                "<attribute name='contactid' alias='KonsultantID' />"+
                "</link-entity>"+
                "</link-entity>"+
                "<link-entity name = 'expl_koordynator' from = 'expl_koordynatorid' to = 'expl_koordynator' alias='a_koordynator' >"+
                "<attribute name='expl_name' />" +
                "<attribute name='expl_koordynatorid' />" +
                "<link-entity name = 'contact' from = 'contactid' to = 'expl_kontakt' alias = 'Koordynator' >" +
                "<attribute name='contactid' alias='KoordynatorID' />"+
                "</link-entity>"+
                "</link-entity>"+
                "<link-entity name='expl_dyrektorsprzedzay' from = 'expl_dyrektorsprzedzayid' to='expl_dyrektor' alias='a_dyrektor' >"+
                "<attribute name='expl_name' />" +
                "<attribute name='expl_dyrektorsprzedzayid' />" +
                "<link-entity name='contact' from='contactid' to='expl_kontakt' alias='Dyrektor' >" +
                "<attribute name='contactid' alias='DyrektorID' />"+
                "</link-entity>"+
                "</link-entity>"+
                "<link-entity name='expl_dyrektorregionu' from='expl_dyrektorregionuid' to='expl_dyrektorregionu' alias='a_dyrektorregionu' >" +
                "<attribute name='expl_name' />" +
                "<attribute name='expl_dyrektorregionuid' />" +
                "<link-entity name='contact' from='contactid' to='expl_kontakt' alias='DyrektorRegionu' >" +
                "<attribute name='contactid' alias='DyrektorRegionuID' />"+
                "</link-entity>"+
                "</link-entity>"+
                "</entity>"+
                "</fetch>";

            #region oldxml
            //string fetchxml =

            //@"<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false' >" +
            //"<entity name='expl_obecnasiec' >" +
            //"<attribute name='createdon' />" +
            //"<attribute name='expl_koordynator' />" +
            //"<attribute name='expl_konsultant' />" +
            //"<attribute name='expl_dyrektor' />" +
            //"<attribute name='expl_dyrektorregionu' />" +
            //"<attribute name='expl_obecnasiecid' />" +
            //"<order attribute='expl_dyrektorregionu' descending='true' />" +
            //"<order attribute='expl_dyrektor' descending='true' />" +
            //"<order attribute='expl_koordynator' descending='true' />" +
            //"<filter type='and' >" +
            //"<condition attribute='statecode' operator='eq' value='0' />" +
            //"</filter>" +
            //"<link-entity name='expl_pracownik' from='expl_pracownikid' to='expl_konsultant' visible='false' link-type='outer' alias='a_konsultant'>" +
            //"<attribute name='expl_name' />" +
            //"<attribute name='expl_pracownikid' />" +
            //"<attribute name='expl_kontakt' />" +
            //"</link-entity> " +
            //"<link-entity name='expl_koordynator' from='expl_koordynatorid' to='expl_koordynator' visible='false' link-type='outer' alias='a_koordynator' >" +
            //"<attribute name='expl_name' />" +
            //"<attribute name='expl_koordynatorid' />" +
            //"<attribute name='expl_kontakt' />" +
            //"</link-entity>" +
            //"<link-entity name='expl_dyrektorsprzedzay' from='expl_dyrektorsprzedzayid' to='expl_dyrektor' visible='false' link-type='outer' alias='a_dyrektor' >" +
            //"<attribute name='expl_name' />" +
            //"<attribute name='expl_dyrektorsprzedzayid' />" +
            //"<attribute name='expl_kontakt' />" +
            //"</link-entity>" +
            //"<link-entity name='expl_dyrektorregionu' from='expl_dyrektorregionuid' to='expl_dyrektorregionu' visible='false' link-type='outer' alias='a_dyrektorregionu' >" +
            //"<attribute name='expl_name' />" +
            //"<attribute name='expl_dyrektorregionuid' />" +
            //"<attribute name='expl_kontakt' />" +
            //"</link-entity>" +
            //"</entity ></fetch>";
            #endregion oldxml

            EntityCollection result = context.RetrieveMultiple(new FetchExpression(fetchxml));

            if(result.Entities.Count == 0)
            {
                _html = "";
                return;
            }

            string currentAreaDirector = null;
            string currentSalesDirector = null;
            string currentCoordinator = null;
//.........这里部分代码省略.........
开发者ID:rnestcv,项目名称:Portal,代码行数:101,代码来源:CreateTree.cs


注:本文中的XrmServiceContext.RetrieveMultiple方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。