Exemple #1
0
 public static void createDataInTridion(ICoreServiceFrameworkContext coreService, string SchemaId, List <Lead> leadFromSF)
 {
     try
     {
         foreach (var item in leadFromSF)
         {
             string serializeXml = "";
             bool   bln          = DataTransformation.Serialize <Lead>(item, ref serializeXml);
             string xml          = serializeXml;
             string tcmuri       = TridionComponent.GenerateComponent(coreService, xml, SetPublication.Publication(ConfigurationManager.AppSettings["FolderLocation"].ToString(), SchemaId), EnumType.SchemaType.Component, ConfigurationManager.AppSettings["FolderLocation"].ToString(), item.FName.Text + " " + item.LName.Text, item.FName.Text + " " + item.LName.Text);
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemple #2
0
 public static void process(List <News> DataFromExchange)
 {
     try
     {
         coreService = CoreServiceFactory.GetCoreServiceContext(new Uri(ConfigurationSettings.AppSettings["CoreServiceURL"].ToString()), new NetworkCredential(ConfigurationSettings.AppSettings["UserName"].ToString(), ConfigurationSettings.AppSettings["Password"].ToString(), ConfigurationSettings.AppSettings["Domain"].ToString()));
         SchemaFieldsData schemaFieldData = coreService.Client.ReadSchemaFields(ConfigurationSettings.AppSettings["SchemaID"].ToString(), true, new ReadOptions());
         foreach (News p in DataFromExchange)
         {
             string serializeXml = "";
             bool   bln          = helper.helper.Serialize <News>(p, ref serializeXml);
             string xml          = serializeXml;
             var    tcmuri       = TridionComponent.GenerateComponent(coreService, xml, helper.helper.SetPublication(ConfigurationSettings.AppSettings["FolderLocation"].ToString(), ConfigurationSettings.AppSettings["SchemaID"].ToString()), helper.helper.SchemaType.Component, ConfigurationSettings.AppSettings["FolderLocation"].ToString(), p.title, p.title);
             if (p.IsPublish.ToLower() == "true")
             {
                 TridionComponent.Publish(tcmuri, ConfigurationSettings.AppSettings["PublicationTargetIDs"].ToString(), coreService);
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }