Пример #1
0
        public static void SyncList(Guid listId)
        {
            var configProvider = new RosterConfigService();
            var mappingSetting = configProvider.GetMappingByList(listId.ToString());

            if (mappingSetting == null)
            {
                return;
            }
            var dataProvider = new RosterDataService();
            {
                var list      = SPContext.Current.SPList(listId);
                var listitems = list.ListItems(mappingSetting.Key,
                                               String.Join("$", mappingSetting.ListMappingFields.Select(item => item.ItemName).ToList()), true);

                dataProvider.SaveRows(mappingSetting, listitems);
            }
        }
Пример #2
0
 public override void ItemDeleting(SPItemEventProperties properties)
 {
     base.ItemDeleting(properties);
     try
     {
         var configProvider = new RosterConfigService(properties.Web);
         var mappingSetting = configProvider.GetMappingByList(properties.ListId.ToString());
         if (mappingSetting == null)
         {
             return;
         }
         var dataProvider = new RosterDataService(properties.Web);
         {
             dataProvider.Delete(mappingSetting.TableName, mappingSetting.Key, properties.ListItemId);
         }
     }
     catch (Exception ex)
     {
         LogHelper.Instance.ErrorULS("ItemDeleting error", ex);
     }
 }
Пример #3
0
 public override void ItemUpdated(SPItemEventProperties properties)
 {
     base.ItemUpdated(properties);
     try
     {
         var configProvider = new RosterConfigService(properties.Web);
         var mappingSetting = configProvider.GetMappingByList(properties.ListId.ToString());
         if (mappingSetting == null)
         {
             return;
         }
         var dataProvider = new RosterDataService(properties.Web);
         {
             dataProvider.SaveRow(mappingSetting, properties.ListItem.ToSyncObject(mappingSetting));
         }
     }
     catch (Exception ex)
     {
         LogHelper.Instance.ErrorULS("ItemUpdated error", ex);
     }
 }