Esempio n. 1
0
 public static void CreateFieldMappings(FieldMapping fieldMapping)
 {
     using (var db = new AftDbContext())
     {
         db.FieldMappings.Add(fieldMapping);
         db.SaveChanges();
     }
 }
Esempio n. 2
0
 public static void CreateDefaultSyncConfigs()
 {
     RemoveAllSyncConfigs();
     using (var db = new AftDbContext())
     {
         db.SyncConfigs.Add(new SyncConfig {ObjectType = "supporter", SyncDirection = "export", Order = 1});
         db.SyncConfigs.Add(new SyncConfig {ObjectType = "supporter", SyncDirection = "import", Order = 2});
         db.SaveChanges();
     }
 }
Esempio n. 3
0
 public static void CreateSyncConfig(string objectType, string syncDirection, int order)
 {
     using (var db = new AftDbContext())
     {
         db.SyncConfigs.Add(new SyncConfig { ObjectType = objectType, SyncDirection = syncDirection, Order = order });
         db.SaveChanges();
     }
 }
Esempio n. 4
0
 public static void RemoveFieldMappings()
 {
     using (var db = new AftDbContext())
     {
         db.Database.ExecuteSqlCommand("delete from FieldMappings");
         db.SaveChanges();
     }
 }
Esempio n. 5
0
        public static void RecreateFieldMappingForTest()
        {
            using (var db = new AftDbContext())
            {
                db.Database.ExecuteSqlCommand("delete from FieldMappings");
                db.SaveChanges();

                new List<FieldMapping>
                    {
                        new FieldMapping{ObjectType = "supporter",AftField = "Title",SalsaField = "Title",
                                         DataType = "string",MappingRule = MappingRules.salsaWins},
                         new FieldMapping{ObjectType = "supporter",AftField = "Phone",SalsaField = "Phone",
                                         DataType = "string",MappingRule = MappingRules.aftWins},
                        new FieldMapping{ObjectType = "supporter",AftField = "First_Name",SalsaField = "First_Name",
                                         DataType = "string",MappingRule = MappingRules.onlyIfBlank},
                        new FieldMapping{ObjectType = "supporter",AftField = "Last_Name",SalsaField = "Last_Name",
                                         DataType = "string",MappingRule = MappingRules.onlyIfBlank},
                        new FieldMapping{ObjectType = "supporter",AftField = "Email",SalsaField = "Email",
                                         DataType = "string",MappingRule = MappingRules.primaryKey},
                        new FieldMapping{ObjectType = "supporter",AftField = "AFT_Match_DateTime",SalsaField = "cdb_match_date",
                                         DataType = "datetime",MappingRule = MappingRules.aftWins},
                        new FieldMapping{ObjectType = "supporter",AftField = "Chapter_KEY",SalsaField = "chapter_KEY",
                                         DataType = "int",MappingRule = MappingRules.writeOnlyNewMembership},
                        new FieldMapping{ObjectType = "chapter",AftField = "Name",SalsaField = "Name",
                                         DataType = "string",MappingRule = MappingRules.aftWins},
                        new FieldMapping{ObjectType = "supporter",AftField = "Last_Modified",SalsaField = "Last_Modified",
                                         DataType = "datetime",MappingRule = MappingRules.readOnly},
                    }.ForEach(f => db.FieldMappings.Add(f));

                db.SaveChanges();
            }
        }