public SponsorsApiController(
     CodecampDbContext context,
     ISponsorBusinessLogic sponsorBL)
 {
     _context   = context;
     _sponsorBL = sponsorBL;
 }
 public TimeslotsController(CodecampDbContext context,
                            ITimeslotBusinessLogic timeslotBL,
                            IEventBusinessLogic eventBL)
 {
     _context    = context;
     _timeslotBL = timeslotBL;
     _eventBL    = eventBL;
 }
示例#3
0
 public TracksController(CodecampDbContext context,
                         ITrackBusinessLogic trackBL,
                         IEventBusinessLogic eventBL)
 {
     _context = context;
     _trackBL = trackBL;
     _eventBL = eventBL;
 }
示例#4
0
 public SponsorsController(
     CodecampDbContext context,
     ISponsorBusinessLogic sponsorBL,
     IEventBusinessLogic eventBL)
 {
     _context   = context;
     _sponsorBL = sponsorBL;
     _eventBL   = eventBL;
 }
 public AnnouncementsController(
     CodecampDbContext context,
     IAnnouncementBusinessLogic announcementBL,
     IEventBusinessLogic eventBL)
 {
     _context        = context;
     _announcementBL = announcementBL;
     _eventBL        = eventBL;
 }
 public SpeakersController(
     UserManager <CodecampUser> userManager,
     CodecampDbContext context,
     ISpeakerBusinessLogic speakerBL,
     IUserBusinessLogic userBL)
 {
     _context     = context;
     _userManager = userManager;
     _speakerBL   = speakerBL;
     _userBL      = userBL;
 }
 public LoginModel(SignInManager <CodecampUser> signInManager,
                   UserManager <CodecampUser> userManager,
                   IEventBusinessLogic eventBL,
                   CodecampDbContext context,
                   ILogger <LoginModel> logger)
 {
     _signInManager = signInManager;
     _userManager   = userManager;
     _context       = context;
     _eventBL       = eventBL;
     _logger        = logger;
 }
示例#8
0
 public ScheduleController(CodecampDbContext context,
                           IScheduleBusinessLogic scheduleBL,
                           ITimeslotBusinessLogic timeslotBL,
                           ITrackBusinessLogic trackBL,
                           ISessionBusinessLogic sessionBL)
 {
     _context    = context;
     _scheduleBL = scheduleBL;
     _timeslotBL = timeslotBL;
     _trackBL    = trackBL;
     _sessionBL  = sessionBL;
 }
示例#9
0
 public HomeController(
     CodecampDbContext context,
     UserManager <CodecampUser> userManager,
     IEventBusinessLogic eventBL,
     IAnnouncementBusinessLogic announcementBL,
     ISponsorBusinessLogic sponsorBL)
 {
     _context        = context;
     _userManager    = userManager;
     _eventBL        = eventBL;
     _announcementBL = announcementBL;
     _sponsorBL      = sponsorBL;
 }
 public SessionsController(
     CodecampDbContext context,
     UserManager <CodecampUser> userManager,
     ISessionBusinessLogic sessionBL,
     IEventBusinessLogic eventBL,
     ISpeakerBusinessLogic speakerBL)
 {
     _context     = context;
     _userManager = userManager;
     _sessionBL   = sessionBL;
     _eventBL     = eventBL;
     _speakerBL   = speakerBL;
 }
示例#11
0
 public IndexModel(
     UserManager <CodecampUser> userManager,
     SignInManager <CodecampUser> signInManager,
     IEmailSender emailSender,
     CodecampDbContext context,
     IEventBusinessLogic eventBL,
     ISpeakerBusinessLogic speakerBL)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _emailSender   = emailSender;
     _context       = context;
     _eventBL       = eventBL;
     _speakerBL     = speakerBL;
 }
示例#12
0
 public RegisterAttendeeModel(
     UserManager <CodecampUser> userManager,
     SignInManager <CodecampUser> signInManager,
     ILogger <RegisterAttendeeModel> logger,
     IEmailSender emailSender,
     CodecampDbContext context,
     IEventBusinessLogic eventBL,
     IHttpContextAccessor httpAccessor,
     IOptions <AppOptions> options)
 {
     _userManager   = userManager;
     _signInManager = signInManager;
     _logger        = logger;
     _emailSender   = emailSender;
     _context       = context;
     _eventBL       = eventBL;
     _httpAccessor  = httpAccessor;
     _options       = options;
 }
 public SponsorsApiBusinessLogic(CodecampDbContext context) : base(context,
                                                                   "sponsors")
 {
 }
 public UserBusinessLogic(CodecampDbContext context)
 {
     _context = context;
 }
示例#15
0
 public ScheduleBusinessLogic(CodecampDbContext context)
 {
     _context = context;
 }
示例#16
0
 public ScheduleController(CodecampDbContext context,
                           IScheduleBusinessLogic scheduleBL)
 {
     _context    = context;
     _scheduleBL = scheduleBL;
 }
示例#17
0
 public SessionsApiBusinessLogic(CodecampDbContext context) : base(context)
 {
 }
 public AnnouncementBusinessLogic(
     CodecampDbContext context)
 {
     _context = context;
 }
示例#19
0
 public TrackBusinessLogic(CodecampDbContext context)
 {
     _context = context;
 }
示例#20
0
 public SpeakerBusinessLogic(CodecampDbContext context,
                             ISessionBusinessLogic sessionBL)
 {
     _context   = context;
     _sessionBL = sessionBL;
 }
示例#21
0
 protected ApiBusinessLogic(CodecampDbContext context, string imageFolder = "")
 {
     Context     = context;
     ImageFolder = imageFolder;
 }
        static void Main(string[] args)
        {
            const int MaxSizePixels = 290;

            StreamWriter log = new StreamWriter("db_image_resize.txt");

            log.WriteLine("Beginning image resize");

            using (var context = new CodecampDbContext())
            {
                var speakers = (from speaker in context.Speakers
                                join _event in context.Events
                                on speaker.EventId equals _event.EventId
                                where _event.IsActive == true
                                select speaker).ToList();

                for (int index = 0; index < speakers.Count(); index++)
                {
                    if (speakers[index].SpeakerId == 46)
                    {
                        continue;
                    }

                    // Get the speaker image
                    var imageArray = speakers[index].Image;
                    if (imageArray != null)
                    {
                        var imageStream = new MemoryStream(imageArray);
                        try
                        {
                            using (var image = new Bitmap(imageStream))
                            {
                                // If the image width or height is greater
                                if (image.Width > MaxSizePixels ||
                                    image.Height > MaxSizePixels)
                                {
                                    Console.WriteLine("SpeakerId: {0}, Height: {1} px, Width: {2}."
                                                      + "  Speaker will be resized.",
                                                      speakers[index].SpeakerId, image.Width, image.Height);
                                    log.WriteLine("SpeakerId: {0}, Height: {1} px, Width: {2}."
                                                  + "  Speaker will be resized.",
                                                  speakers[index].SpeakerId, image.Width, image.Height);

                                    // Resize this image
                                    int width, height;
                                    if (image.Width > image.Height)
                                    {
                                        width  = MaxSizePixels;
                                        height = Convert.ToInt32(image.Height * MaxSizePixels
                                                                 / (double)image.Width);
                                    }
                                    else
                                    {
                                        width = Convert.ToInt32(image.Width * MaxSizePixels
                                                                / (double)image.Height);
                                        height = MaxSizePixels;
                                    }

                                    var resized = new Bitmap(width, height);
                                    using (var graphics = Graphics.FromImage(resized))
                                    {
                                        graphics.CompositingQuality = CompositingQuality.HighSpeed;
                                        graphics.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                                        graphics.CompositingMode    = CompositingMode.SourceCopy;
                                        graphics.DrawImage(image, 0, 0, width, height);

                                        using (var ms = new MemoryStream())
                                        {
                                            var qualityParamId    = Encoder.Quality;
                                            var encoderParameters = new EncoderParameters(1);
                                            encoderParameters.Param[0]
                                                = new EncoderParameter(qualityParamId, 100L);
                                            var codec = ImageCodecInfo.GetImageDecoders()
                                                        .FirstOrDefault(c => c.FormatID == ImageFormat.Jpeg.Guid);
                                            resized.Save(ms, codec, encoderParameters);

                                            speakers[index].Image = ms.ToArray();
                                        }
                                    }

                                    context.SaveChanges();
                                }
                            }
                        }
                        catch (Exception)
                        {
                            Console.WriteLine("SpeakerId: {0} image is invalid, deleting speaker image.",
                                              speakers[index].SpeakerId);
                            log.WriteLine("SpeakerId: {0} image is invalid, deleting speaker image.",
                                          speakers[index].SpeakerId);

                            speakers[index].Image = null;

                            context.SaveChanges();
                        }
                    }
                }
            }

            log.WriteLine("End image resize");
            log.Close();
        }
示例#23
0
 public AnnouncementsApiBusinessLogic(CodecampDbContext context) : base(context)
 {
 }
示例#24
0
 public TracksApiBusinessLogic(CodecampDbContext context) : base(context)
 {
 }
 public TimeslotBusinessLogic(CodecampDbContext context)
 {
     _context = context;
 }
示例#26
0
 public EventsController(CodecampDbContext context,
                         IEventBusinessLogic eventBL)
 {
     _context = context;
     _eventBL = eventBL;
 }
 public SessionBusinessLogic(CodecampDbContext context)
 {
     _context = context;
 }
示例#28
0
 public TimeslotsApiBusinessLogic(CodecampDbContext context) : base(context)
 {
 }
示例#29
0
 public SponsorBusinessLogic(CodecampDbContext context)
 {
     _context = context;
 }
 public EventsApiBusinessLogic(CodecampDbContext context) : base(context)
 {
 }