// Create a column set holding the names of the columns
// to be retrieved.
ColumnSet columnas= new ColumnSet();
columnas.Attributes = new string[] { "new_productosid" };
ConditionExpression ce = new ConditionExpression();
ce.AttributeName = "new_clienteid";
ce.Operator = ConditionOperator.Equal;
ce.Values = new object[1];
ce.Values[0]= contacto.contactid.Value;
FilterExpression fe = new FilterExpression();
fe.FilterOperator = LogicalOperator.And;
fe.Conditions = new ConditionExpression[] { ce };
QueryExpression qe = new QueryExpression();
qe.Criteria = fe;
qe.ColumnSet = columnas;
qe.EntityName = EntityName.new_relacionclienteproducto.ToString();
RetrieveMultipleRequest rmr = new RetrieveMultipleRequest();
rmr.Query = qe;
RetrieveMultipleResponse rmresp = (RetrieveMultipleResponse)service.Execute(rmr);
new_relacionclienteproducto relacionproducto = new new_relacionclienteproducto();
InstantiateTemplateResponse instResp2 ;
product producto = new product();
for(int i=0;i
relacionproducto = (new_relacionclienteproducto)rmresp.BusinessEntityCollection.BusinessEntities[i];
producto = (product)service.Retrieve(EntityName.product.ToString(), relacionproducto.new_productosid.Value, new AllColumns());
instResp2 = (InstantiateTemplateResponse)service.Execute(instTemplate2);
curso = (email)instResp2.BusinessEntityCollection.BusinessEntities[0];
curso.description = curso.description.Replace("[nombre]", producto.name);
curso.description = curso.description.Replace("[descripcion]", producto.description);
mail.description += curso.description;
}
No hay comentarios:
Publicar un comentario