private void SaveMapping() { var list = SPContext.Current.Web.Lists[ListId]; var mapping = Mapping ?? new ListMapping { Id = Guid.NewGuid(), ListName = list.ID.ToString(), TableName = ddlDbTables.SelectedValue, Key = ddlTableKey.SelectedValue }; // collect mapping info mapping.ListMappingFields.Clear(); foreach (RepeaterItem rItm in ColumnsMapperRep.Items) { var dbColumnId = ((HiddenField)rItm.FindControl("hidDbColumnId")).Value; var shpFieldName = ((DropDownList)rItm.FindControl("ddlListFields")).SelectedValue; if (!string.IsNullOrEmpty(shpFieldName)) { mapping.ListMappingFields.Add(new ListMappingField { Id = Guid.NewGuid(), ListMappingId = mapping.Id, FieldName = dbColumnId, ItemName = shpFieldName }); } } if (mapping.ListMappingFields.IsEmpty()) { throw new Exception("Select at least one mapping pare."); } // save mapping _configService.SaveMapping(mapping); // add EventReceiver AddReceiverToList(list, Constants.ReceiversNames.SYNC_DATA_ADDED, SPEventReceiverType.ItemAdded, 10010); AddReceiverToList(list, Constants.ReceiversNames.SYNC_DATA_UPDATED, SPEventReceiverType.ItemUpdated, 10011); AddReceiverToList(list, Constants.ReceiversNames.SYNC_DATA_DELETING, SPEventReceiverType.ItemDeleting, 10012); }