示例#1
0
        private static void BorrarPruebas(Crm crm, Comun co)
        {
            #region BORRAR PRODUCTOS
            var queprod = new QueryExpression("product");
            //quece.TopCount = 5000;

            var prods = new EntityCollection();
            while (true)
            {
                var res1 = crm.GetIOS().RetrieveMultiple(queprod);
                prods.Entities.AddRange(res1.Entities);
                if (res1.MoreRecords)
                {
                    queprod.PageInfo.PageNumber++;
                    queprod.PageInfo.PagingCookie = res1.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var ce in prods.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("product", ce.Id)
                });
            }
            crm.ProcesarUltimosEmr();
            #endregion BORRAR PRODuCTOS
            co.LogText("\n=============================== PRODUCTOS  BORRADOS ===================================\n");
        }
示例#2
0
        private static void BorrarPrueba(Crm crm)
        {
            var q = new QueryExpression("account");

            q.Criteria.Conditions.AddRange(
                new ConditionExpression("createdon", ConditionOperator.Today)
                );
            var terceros = new EntityCollection();

            while (true)
            {
                var res = crm.GetIOS().RetrieveMultiple(q);
                terceros.Entities.AddRange(res.Entities);
                if (res.MoreRecords)
                {
                    q.PageInfo.PageNumber++;
                    q.PageInfo.PagingCookie = res.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var t in terceros.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("account", t.Id)
                });
            }
            crm.ProcesarUltimosEmr();
        }
示例#3
0
        private static void BorrarPruebas(Crm crm, Comun co)
        {
            #region BORRAR PRODUCTOS
            var queprod = new QueryExpression("product");
            //quece.TopCount = 5000;

            var prods = new EntityCollection();
            while (true)
            {
                var res1 = crm.GetIOS().RetrieveMultiple(queprod);
                prods.Entities.AddRange(res1.Entities);
                if (res1.MoreRecords)
                {
                    queprod.PageInfo.PageNumber++;
                    queprod.PageInfo.PagingCookie = res1.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var ce in prods.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("product", ce.Id)
                });
            }
            crm.ProcesarUltimosEmr();
            #endregion BORRAR PRODuCTOS
            co.LogText("\n=============================== PRODUCTOS  BORRADOS ===================================\n");

            #region BORRAR ICS
            var queics = new QueryExpression("aen_ics");
            //quece.TopCount = 5000;

            var icss = new EntityCollection();
            while (true)
            {
                var res1 = crm.GetIOS().RetrieveMultiple(queics);
                icss.Entities.AddRange(res1.Entities);
                if (res1.MoreRecords)
                {
                    queics.PageInfo.PageNumber++;
                    queics.PageInfo.PagingCookie = res1.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var ce in icss.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("aen_ics", ce.Id)
                });
            }
            crm.ProcesarUltimosEmr();
            #endregion BORRAR ICS
            co.LogText("\n=============================== ICS  BORRADOS ===================================\n");

            #region BORRAR VERSION
            var quever = new QueryExpression("aen_versin");
            //quece.TopCount = 5000;

            var vers = new EntityCollection();
            while (true)
            {
                var res1 = crm.GetIOS().RetrieveMultiple(quever);
                vers.Entities.AddRange(res1.Entities);
                if (res1.MoreRecords)
                {
                    quever.PageInfo.PageNumber++;
                    quever.PageInfo.PagingCookie = res1.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var ce in vers.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("aen_versin", ce.Id)
                });
            }
            crm.ProcesarUltimosEmr();
            #endregion BORRAR VERSION
            co.LogText("\n=============================== VERSION  BORRADAS ===================================\n");

            #region BORRAR NORMA RAIZ
            var quenor = new QueryExpression("aen_norma");
            //quece.TopCount = 5000;

            var norm = new EntityCollection();
            while (true)
            {
                var res1 = crm.GetIOS().RetrieveMultiple(quenor);
                norm.Entities.AddRange(res1.Entities);
                if (res1.MoreRecords)
                {
                    quenor.PageInfo.PageNumber++;
                    quenor.PageInfo.PagingCookie = res1.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var ce in norm.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("aen_norma", ce.Id)
                });
            }
            crm.ProcesarUltimosEmr();
            #endregion BORRAR VERSION
            co.LogText("\n=============================== NORMAS  BORRADAS ===================================\n");

            #region BORRAR COMITES
            var quecom = new QueryExpression("aen_comitetecnicodenormalizacion");
            //quece.TopCount = 5000;

            var com = new EntityCollection();
            while (true)
            {
                var res1 = crm.GetIOS().RetrieveMultiple(quecom);
                com.Entities.AddRange(res1.Entities);
                if (res1.MoreRecords)
                {
                    quecom.PageInfo.PageNumber++;
                    quecom.PageInfo.PagingCookie = res1.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var ce in com.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("aen_comitetecnicodenormalizacion", ce.Id)
                });
            }
            crm.ProcesarUltimosEmr();
            #endregion BORRAR COMITES
            co.LogText("\n=============================== COMITES  BORRADAS ===================================\n");
        }
示例#4
0
        private static void BorrarPruebas(Crm crm, Comun co)
        {
            #region CNAES Tercero
            var quece = new QueryExpression("aen_cnaetercero");
            //quece.TopCount = 5000;

            var cenaes = new EntityCollection();
            while (true)
            {
                var res1 = crm.GetIOS().RetrieveMultiple(quece);
                cenaes.Entities.AddRange(res1.Entities);
                if (res1.MoreRecords)
                {
                    quece.PageInfo.PageNumber++;
                    quece.PageInfo.PagingCookie = res1.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var ce in cenaes.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("aen_cnaetercero", ce.Id)
                });
            }
            crm.ProcesarUltimosEmr();
            #endregion CNAES Tercero

            co.LogText("\n=============================== CNAES BORRADOS ===================================\n");

            #region DIRECCIONES
            var qdir = new QueryExpression("aen_direccion");
            //q.Criteria.AddCondition(new ConditionExpression("createdon", ConditionOperator.Today));
            //qdir.TopCount = 5000;

            while (true)
            {
                var entidadesdir = Crm.IOS.RetrieveMultiple(qdir);
                foreach (var t in entidadesdir.Entities)
                {
                    crm.AnadirElementoEmr(new DeleteRequest {
                        Target = new EntityReference("aen_direccion", t.Id)
                    });
                }
                if (entidadesdir.MoreRecords)
                {
                    qdir.PageInfo.PageNumber++;
                    qdir.PageInfo.PagingCookie = entidadesdir.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            crm.ProcesarUltimosEmr();
            #endregion DIRECCIONES

            co.LogText("\n=============================== DIRECCIONES BORRADAS ===================================\n");

            #region CONTACTOS
            var qcon = new QueryExpression("contact");
            //q.Criteria.AddCondition(new ConditionExpression("createdon", ConditionOperator.Today));
            //qcon.TopCount = 5000;
            while (true)
            {
                var entidadescon = Crm.IOS.RetrieveMultiple(qcon);
                foreach (var t in entidadescon.Entities)
                {
                    crm.AnadirElementoEmr(new DeleteRequest {
                        Target = new EntityReference("contact", t.Id)
                    });
                }
                if (entidadescon.MoreRecords)
                {
                    qcon.PageInfo.PageNumber++;
                    qcon.PageInfo.PagingCookie = entidadescon.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            crm.ProcesarUltimosEmr();
            #endregion CONTACTOS

            co.LogText("\n=============================== CONTACTOS BORRADAS ===================================\n");

            #region CERTIFICACION
            qcon = new QueryExpression("aen_certificacion");
            //q.Criteria.AddCondition(new ConditionExpression("createdon", ConditionOperator.Today));
            //qcon.TopCount = 5000;
            while (true)
            {
                var entidadescon = Crm.IOS.RetrieveMultiple(qcon);
                foreach (var t in entidadescon.Entities)
                {
                    crm.AnadirElementoEmr(new DeleteRequest {
                        Target = new EntityReference("aen_certificacion", t.Id)
                    });
                }
                if (entidadescon.MoreRecords)
                {
                    qcon.PageInfo.PageNumber++;
                    qcon.PageInfo.PagingCookie = entidadescon.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            crm.ProcesarUltimosEmr();
            #endregion CERTIFICACION

            co.LogText("\n=============================== CERTIFICACION BORRADAS ===================================\n");

            #region aen_normacomprada
            qcon = new QueryExpression("aen_normacomprada");
            //q.Criteria.AddCondition(new ConditionExpression("createdon", ConditionOperator.Today));
            //qcon.TopCount = 5000;
            while (true)
            {
                var entidadescon = Crm.IOS.RetrieveMultiple(qcon);
                foreach (var t in entidadescon.Entities)
                {
                    crm.AnadirElementoEmr(new DeleteRequest {
                        Target = new EntityReference("aen_normacomprada", t.Id)
                    });
                }
                if (entidadescon.MoreRecords)
                {
                    qcon.PageInfo.PageNumber++;
                    qcon.PageInfo.PagingCookie = entidadescon.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            crm.ProcesarUltimosEmr();
            #endregion aen_normacomprada

            co.LogText("\n=============================== aen_normacomprada BORRADAS ===================================\n");

            #region aen_publicacionesadquiridas
            qcon = new QueryExpression("aen_publicacionesadquiridas");
            //q.Criteria.AddCondition(new ConditionExpression("createdon", ConditionOperator.Today));
            //qcon.TopCount = 5000;
            while (true)
            {
                var entidadescon = Crm.IOS.RetrieveMultiple(qcon);
                foreach (var t in entidadescon.Entities)
                {
                    crm.AnadirElementoEmr(new DeleteRequest {
                        Target = new EntityReference("aen_publicacionesadquiridas", t.Id)
                    });
                }
                if (entidadescon.MoreRecords)
                {
                    qcon.PageInfo.PageNumber++;
                    qcon.PageInfo.PagingCookie = entidadescon.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            crm.ProcesarUltimosEmr();
            #endregion aen_publicacionesadquiridas

            co.LogText("\n=============================== aen_publicacionesadquiridas BORRADAS ===================================\n");

            #region aen_potencialcliente
            qcon = new QueryExpression("aen_potencialcliente");
            //q.Criteria.AddCondition(new ConditionExpression("createdon", ConditionOperator.Today));
            //qcon.TopCount = 5000;
            while (true)
            {
                var entidadescon = Crm.IOS.RetrieveMultiple(qcon);
                foreach (var t in entidadescon.Entities)
                {
                    crm.AnadirElementoEmr(new DeleteRequest {
                        Target = new EntityReference("aen_potencialcliente", t.Id)
                    });
                }
                if (entidadescon.MoreRecords)
                {
                    qcon.PageInfo.PageNumber++;
                    qcon.PageInfo.PagingCookie = entidadescon.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            crm.ProcesarUltimosEmr();
            #endregion aen_potencialcliente

            co.LogText("\n=============================== aen_potencialcliente BORRADAS ===================================\n");


            #region aen_suscripcionadquirida
            qcon = new QueryExpression("aen_suscripcionadquirida");
            //q.Criteria.AddCondition(new ConditionExpression("createdon", ConditionOperator.Today));
            //qcon.TopCount = 5000;
            while (true)
            {
                var entidadescon = Crm.IOS.RetrieveMultiple(qcon);
                foreach (var t in entidadescon.Entities)
                {
                    crm.AnadirElementoEmr(new DeleteRequest {
                        Target = new EntityReference("aen_suscripcionadquirida", t.Id)
                    });
                }
                if (entidadescon.MoreRecords)
                {
                    qcon.PageInfo.PageNumber++;
                    qcon.PageInfo.PagingCookie = entidadescon.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            crm.ProcesarUltimosEmr();
            #endregion aen_suscripcionadquirida

            co.LogText("\n=============================== aen_suscripcionadquirida BORRADAS ===================================\n");


            #region TERCEROS
            var qter = new QueryExpression("account");

            /*q.Criteria.Conditions.AddRange(
             *  new ConditionExpression("createdon", ConditionOperator.Today)
             *  );*/
            //qter.TopCount = 5000;
            var terceros = new EntityCollection();
            while (true)
            {
                var res2 = crm.GetIOS().RetrieveMultiple(qter);
                terceros.Entities.AddRange(res2.Entities);
                if (res2.MoreRecords)
                {
                    qter.PageInfo.PageNumber++;
                    qter.PageInfo.PagingCookie = res2.PagingCookie;
                }
                else
                {
                    break;
                }
            }
            foreach (var t in terceros.Entities)
            {
                crm.AnadirElementoEmr(new DeleteRequest()
                {
                    Target = new EntityReference("account", t.Id)
                });
            }
            crm.ProcesarUltimosEmr();
            #endregion TERCEROS

            co.LogText("\n=============================== TERCEROS BORRADOS ===================================\n");
        }