public void SetInfo(Course course) { var context = new CourseContext(); var template = context.CourseTemplates.FirstOrDefault(t => t.Id == course.CourseTemplateId); int duration = 0; if (template != null) { duration = template.NumberOfHours; } Id = course.Id; DisplayName = String.Format("{0} - {1:g} bis {2:t} - {3} SFr.", course.Name, course.StartDateTime, course.StartDateTime.AddHours(duration), course.Price); }
public ScoresController(ScoreContext context, CourseContext courseContext) { _scoreContext = context; _courseContext = courseContext; }
public AboutModel(CourseContext context) { _context = context; }
protected ServiceBase(CourseContext context) { Context = context; }
public CourseReviewRepository(CourseContext context) : base(context) { }
public PlaylistRepository(CourseContext context) : base(context) { }
public LecturesController(CourseContext context) { _context = context; }
/// <summary> /// The confirm registration direct. /// </summary> /// <param name="registrationId"> /// The registration id. /// </param> public static void ConfirmRegistrationDirect(int registrationId) { var context = new CourseContext(); var registration = context.Registrations.Include("Courses").FirstOrDefault(r => r.Id == registrationId); if (registration != null) { var myMessage = new SendGridMessage(); myMessage.AddTo(registration.EMail); myMessage.From = new MailAddress("*****@*****.**", "Fahrschule Grütter-Stooss"); myMessage.Subject = "Anmeldung erhalten"; if (registration.Courses.Count == 1) { var course = registration.Courses.ElementAt(0); myMessage.Text = string.Format("Für den Kurs {0} am {1}\n", course.Name, course.StartDateTime); } if (registration.Courses.Count > 1) { var sb = new StringBuilder(); sb.AppendLine("Für die Kurse:"); foreach (var course in registration.Courses) { sb.AppendLine(string.Format("Für den Kurs {0} am {1}\n", course.Name, course.StartDateTime)); myMessage.Text = sb.ToString(); } } var transportWeb = new Web("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"); // Send the email. transportWeb.DeliverAsync(myMessage); } }
public CreateModel(CourseContext context) { _context = context; }
public ShoppingCartRepository(CourseContext context) : base(context) { }
public PlaylistSeeder( CourseContext context ) { _context = context; }
public CourseCategoryRepository(CourseContext courseContext) { this.courseContext = courseContext; }
/// <summary> /// Initializes a new instance of the <see cref="CourseRegistrationController"/> class. /// </summary> public CourseRegistrationController() { this.context = new CourseContext(); }
/// <summary> /// Initializes a new instance of the <see cref="CoursesController"/> class. /// </summary> public CoursesController() { this.context = new CourseContext(); }
public AppCourseListRepository(CourseContext courseContext) { this.courseContext = courseContext; }
public LectureRepository(CourseContext context) : base(context) { }
public CourseRepository(CourseContext courseContext) { this._courseContext = courseContext; }
public ProgramsController(CourseContext context) { _context = context; }
public IdentityTokenRepository(CourseContext context) : base(context) { }
public static void Seed(CourseContext context) { }
public TipUplateService(CourseContext context) { _context = context; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env, MemberContext ctx, HobbyContext ctx2, CourseContext ctx3) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } ctx.Database.Migrate(); ctx2.Database.Migrate(); ctx3.Database.Migrate(); app.UseOpenApi(); app.UseSwaggerUi3(); app.UseHttpsRedirection(); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); }
public CourseService(CourseContext CourseList) { _CourseList = CourseList; }
public UserRepository(CourseContext context) : base(context) { }
public UpdatesService(CourseContext context) : base(context) { }
public override void Seed(CourseContext context) { if (!context.FSMTransitions.Any()) { // (p&q)|r -> p,q,r => FSMConditions var data = new[] { new FSMTransition { ConditionSequence = "AccountIsConfirmed", FSMTransitionId = 1, OrderStatusIdFrom = 0, OrderStatusIdTo = 1 }, new FSMTransition { ConditionSequence = "PaymentIsProcessed", FSMTransitionId = 2, OrderStatusIdFrom = 1, OrderStatusIdTo = 2 }, new FSMTransition { ConditionSequence = "", FSMTransitionId = 3, OrderStatusIdFrom = 2, OrderStatusIdTo = 3 }, }; context.FSMTransitions.AddRange(data); context.Database.OpenConnection(); context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT dbo.FSMTransitions ON"); context.SaveChanges(); context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT dbo.FSMTransitions OFF"); context.Database.CloseConnection(); } if (!context.FSMConditions.Any()) { var data = new[] { new FSMCondition { ConditionName = "AccountIsConfirmed", ConditionTypeId = (int)FSMConditionType.AccountConfirmedCheck, FSMConditionId = 1, FSMTransitionId = 1 }, new FSMCondition { ConditionName = "PaymentIsProcessed", ConditionTypeId = (int)FSMConditionType.ProcessedPaymentCheck, FSMConditionId = 2, FSMTransitionId = 2 } }; context.FSMConditions.AddRange(data); context.Database.OpenConnection(); context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT dbo.FSMConditions ON"); context.SaveChanges(); context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT dbo.FSMConditions OFF"); context.Database.CloseConnection(); } if (!context.FSMActions.Any()) { var data = new[] { new FSMAction { FSMActionId = 1, ActionTypeId = (int)FSMActionType.SendEmail, FSMTransitionId = 1 }, new FSMAction { FSMActionId = 2, ActionTypeId = (int)FSMActionType.SendEmail, FSMTransitionId = 2 }, new FSMAction { FSMActionId = 3, ActionTypeId = (int)FSMActionType.SendEmail, FSMTransitionId = 3 } }; context.FSMActions.AddRange(data); context.Database.OpenConnection(); context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT dbo.FSMActions ON"); context.SaveChanges(); context.Database.ExecuteSqlRaw("SET IDENTITY_INSERT dbo.FSMActions OFF"); context.Database.CloseConnection(); } }
public CoursesController(CourseContext context) { _context = context; }
public CourseAttributesRepository(CourseContext context) : base(context) { }
public CasService(CourseContext context, IMapper mapper) : base(context, mapper) { }
public void GetAuthors_PageSizeIsThree_ReturnsThreeAuthors() { // Arrange var connectionStringBuilder = new SqliteConnectionStringBuilder { DataSource = ":memory:" }; var connection = new SqliteConnection(connectionStringBuilder.ToString()); var options = new DbContextOptionsBuilder <CourseContext>() .UseSqlite(connection) .Options; using (var context = new CourseContext(options)) { context.Database.OpenConnection(); context.Database.EnsureCreated(); context.Countries.Add(new Entities.Country() { Id = "BE", Description = "Belgium" }); context.Countries.Add(new Entities.Country() { Id = "US", Description = "United States of America" }); context.Authors.Add(new Entities.Author() { FirstName = "Kevin", LastName = "Dockx", CountryId = "BE" }); context.Authors.Add(new Entities.Author() { FirstName = "Gill", LastName = "Cleeren", CountryId = "BE" }); context.Authors.Add(new Entities.Author() { FirstName = "Julie", LastName = "Lerman", CountryId = "US" }); context.Authors.Add(new Entities.Author() { FirstName = "Shawn", LastName = "Wildermuth", CountryId = "BE" }); context.Authors.Add(new Entities.Author() { FirstName = "Deborah", LastName = "Kurata", CountryId = "US" }); context.SaveChanges(); } using (var context = new CourseContext(options)) { var authorRepository = new AuthorRepository(context); // Act var authors = authorRepository.GetAuthors(1, 3); // Assert Assert.Equal(3, authors.Count()); } }
public IspitKlijentService(CourseContext context) { _context = context; }
public ClustersController(CourseContext context) { _context = context; }
public CourseAuditingRepository(CourseContext context) : base(context) { }
public CredentialsController(CourseContext context) { _context = context; }
public void Dispose() { if (courseContext != null) courseContext.Dispose(); courseContext = null; }
public static void ConfirmRegistration(int registrationId, string reportpath) { var context = new CourseContext(); var registration = context.Registrations.Include("Courses").FirstOrDefault(r => r.Id == registrationId); if (registration != null) { var myMessage = new SendGridMessage(); myMessage.AddTo(registration.EMail); myMessage.AddTo("*****@*****.**"); myMessage.From = new MailAddress("*****@*****.**", "Fahrschule Grütter-Stooss"); var stream = new MemoryStream(); var report = ReportHelper.GetReportFromFile(reportpath); report.ReportParameters["RegistrationId"].Value = registrationId; var reportProcessor = new Telerik.Reporting.Processing.ReportProcessor(); var renderingResult = reportProcessor.RenderReport("PDF", report, null); stream.Write(renderingResult.DocumentBytes, 0, renderingResult.DocumentBytes.Length); stream.Position = 0; myMessage.AddAttachment(stream, "Anmeldung.pdf"); myMessage.Subject = "Bestätigung Deiner Anmeldung"; if (registration.Courses.Count == 1) { var course = registration.Courses.ElementAt(0); myMessage.Text = string.Format("Für den Kurs {0} am {1}", course.Name, course.StartDateTime); } if (registration.Courses.Count > 1) { var sb = new StringBuilder(); sb.AppendLine("Für die Kurse:"); foreach (var course in registration.Courses) { sb.AppendLine(string.Format("Für den Kurs {0} am {1}", course.Name, course.StartDateTime)); myMessage.Text = sb.ToString(); } } // Create credentials, specifying your user name and password. var credentials = new NetworkCredential("*****@*****.**", "*****@*****.**"); // Create an Web transport for sending email, using credentials... //var transportWeb = new Web(credentials); // ...OR create a Web transport, using API Key (preferred) var transportWeb = new Web("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"); // Send the email. transportWeb.DeliverAsync(myMessage); } }