public TranspondersWorkflow(IVantageContext context, ITransponderCodeConverter transponderCodeConverter)
        {
            this.context = context;
            this.transponderCodeConverter = transponderCodeConverter;

            context.ProxyCreationEnabled = false;
            context.LazyLoadingEnabled   = false;
        }
示例#2
0
        private static async Task ImportPeopleAsync(IVantageContext context, ICollection <Person> people)
        {
            var identifiers    = people.Select(p => p.Id);
            var existingPeople = await(from p in context.Persons.Include(p => p.Licenses)
                                       where identifiers.Contains(p.Id)
                                       select p).ToListAsync();

            foreach (var item in from np in people
                     join ep in existingPeople on np.Id equals ep.Id into g
                     from ep in g.DefaultIfEmpty()
                     select new
            {
                New = np,
                Existing = ep
            })
            {
                if (item.Existing == null)
                {
                    context.Persons.Add(item.New);
                }
                else
                {
                    Mapper.Map(item.New, item.Existing);
                    foreach (var license in from nl in item.New.Licenses
                             join el in item.Existing.Licenses on new
                    {
                        nl.IssuerId,
                        nl.Discipline,
                        nl.Key
                    } equals new
                    {
                        el.IssuerId,
                        el.Discipline,
                        el.Key
                    } into g
                             from el in g.DefaultIfEmpty()
                             select new
                    {
                        New = nl,
                        Existing = el
                    })
                    {
                        if (license.Existing == null)
                        {
                            context.PersonLicenses.Add(license.New);
                        }
                        else
                        {
                            Mapper.Map(license.New, license.Existing);
                        }
                    }
                }
            }
            await context.SaveChangesAsync();
        }
示例#3
0
        private static async Task ImportReportTemplateAsync(IVantageContext context, Competition competition)
        {
            if (competition.ReportTemplate != null)
            {
                var reportTemplate = await context.ReportTemplates
                                     .FirstOrDefaultAsync(t => t.LicenseIssuerId == competition.LicenseIssuerId && t.Name == competition.ReportTemplate.Name);

                if (reportTemplate == null)
                {
                    context.ReportTemplates.Add(competition.ReportTemplate);
                }
                else
                {
                    competition.ReportTemplate = reportTemplate;
                }
            }
        }
示例#4
0
 public VenuesWorkflow(IVantageContext context)
 {
     this.context = context;
 }
 public LicensesWorkflow(IVantageContext context, IDisciplineCalculatorManager calculatorManager, IEventRecorder recorder)
 {
     this.context           = context;
     this.calculatorManager = calculatorManager;
     this.recorder          = recorder;
 }
示例#6
0
 public PeopleWorkflow(IVantageContext context)
 {
     this.context = context;
 }
示例#7
0
 public ReportTemplatesWorkflow(IVantageContext context)
 {
     this.context = context;
 }
示例#8
0
 public PersonCategoriesWorkflow(IVantageContext context)
 {
     this.context = context;
 }
 public UserSecurityWorkflow(IVantageContext context)
 {
     this.context = context;
 }
示例#10
0
 public ClubsWorkflow(IVantageContext context)
 {
     this.context = context;
 }