public ProcedureController(ICountry serv, IProductName prodName, IProductCode prodCode, IMarketingAuthorizNumber marketingAuthorizNumber, IPackSize packSize,
                            IApprDocsType apprDocsType, IStrength strength, IManufacturer manufacturer, IArtwork artwork, IMarketingAuthorizHolder marketingAuthorizHolder,
                            IPharmaceuticalForm pharmaceuticalForm, IProductService product, IProcedure procedure, IBaseEmailService emailService, IArchProccessor archProccessor)
 {
     _countryService                 = serv;
     _productNameService             = prodName;
     _productCodeService             = prodCode;
     _packSizeService                = packSize;
     _marketingAuthorizNumberService = marketingAuthorizNumber;
     _apprDocsTypeService            = apprDocsType;
     _strengthService                = strength;
     _manufacturerService            = manufacturer;
     _artworkService                 = artwork;
     _marketingAuthorizHolderService = marketingAuthorizHolder;
     _pharmaceuticalFormService      = pharmaceuticalForm;
     _productService                 = product;
     _emailService     = emailService;
     _procedureService = procedure;
     _archProccessor   = archProccessor;
     emailer           = new Emailer()
     {
         Login         = WebConfigurationManager.AppSettings["login"],
         Pass          = WebConfigurationManager.AppSettings["password"],
         From          = WebConfigurationManager.AppSettings["from"],
         Port          = int.Parse(WebConfigurationManager.AppSettings["smtpPort"]),
         SmtpServer    = WebConfigurationManager.AppSettings["smtpSrv"],
         DirectorMail  = WebConfigurationManager.AppSettings["directorMail"],
         DeveloperMail = WebConfigurationManager.AppSettings["developerMail"],
     };
     _currentUser = GetCurrentUser();
 }
Esempio n. 2
0
 private static int GetMatchingGenresCount(IArtwork artwork1, IArtwork artwork2)
 {
     return(artwork1
            .Genres
            .Select(g => artwork2.Genres.Contains(g) ? 1 : 0)
            .Sum());
 }
Esempio n. 3
0
        public static void AddToSelection(User user, Selection selection, IArtwork artwork)
        {
            switch (artwork)
            {
            case Book book:
                if (!selection.Books.Contains(book))
                {
                    selection.Books.Add(book);
                }
                break;

            case Film film:
                if (!selection.Films.Contains(film))
                {
                    selection.Films.Add(film);
                }
                break;

            case Serial serial:
                if (!selection.Serials.Contains(serial))
                {
                    selection.Serials.Add(serial);
                }
                break;

            default:
                throw new ArgumentException();
            }

            Repository.SaveChanges();
        }
Esempio n. 4
0
 private static double GetPopularity(IArtwork artwork)
 {
     return(artwork switch
     {
         Book book => GetRating(book) *
         Repository.Filter <BookEvaluation>(e => e.Book.First() == book).Count(),
         Film film => GetRating(film) *
         Repository.Filter <FilmEvaluation>(e => e.Film.First() == film).Count(),
         Serial serial => GetRating(serial) *
         Repository.Filter <SerialEvaluation>(e => e.Serial.First() == serial).Count(),
         _ => throw new ArgumentException()
     });
 // GET: Settings
 public SettingsController(ICountry serv, IProductName prodName, IProductCode prodCode, IMarketingAuthorizNumber marketingAuthorizNumber, IPackSize packSize,
                           IApprDocsType apprDocsType, IStrength strength, IManufacturer manufacturer, IArtwork artwork, IMarketingAuthorizHolder marketingAuthorizHolder,
                           IPharmaceuticalForm pharmaceuticalForm, IBase <CountrySettingDTO> countrySettingsService)
 {
     _countryService                 = serv;
     _productNameService             = prodName;
     _productCodeService             = prodCode;
     _packSizeService                = packSize;
     _marketingAuthorizNumberService = marketingAuthorizNumber;
     _apprDocsTypeService            = apprDocsType;
     _strengthService                = strength;
     _manufacturerService            = manufacturer;
     _artworkService                 = artwork;
     _marketingAuthorizHolderService = marketingAuthorizHolder;
     _pharmaceuticalFormService      = pharmaceuticalForm;
     _countrySettingsService         = countrySettingsService;
 }
Esempio n. 6
0
 public ArtDisplay([MetadataFilter("Age", 1000)] IArtwork artwork)
 {
     this.artwork = artwork ?? throw new ArgumentNullException(nameof(artwork));
 }
Esempio n. 7
0
 public EventArgsArtwork(IArtwork aArtwork)
 {
     Artwork = aArtwork;
 }
Esempio n. 8
0
 public ArtDisplay([MetadataFilter("Gender", true)] IArtwork artwork)
 {
     this.artwork = artwork ?? throw new ArgumentNullException(nameof(artwork));
 }
Esempio n. 9
0
        private void PaintItem(Graphics aGraphics, int aWidth, int aHeight, int aOffsetX, int aOffsetY, Uri aArtworkUri, string aTitle, string aAlbum, string aArtist, string aGenre, bool aCurrent)
        {
            int height = aHeight;
            int width  = height;

            int offsetY = aOffsetY;
            int offsetX = aOffsetX;

            Rectangle itemRect = new Rectangle(offsetX, ClientRectangle.Y, kItemWidth, ClientSize.Height);

            if (ClientRectangle.IntersectsWith(itemRect))
            {
                bool  drawTime   = false;
                Color fontColour = iViewSupport.ForeColour;
                if (aCurrent)
                {
                    fontColour = iViewSupport.ForeColourBright;
                    drawTime   = (iTransportState == ETransportState.ePlaying || iTransportState == ETransportState.ePaused);
                }

                Uri uri = aArtworkUri;

                IArtwork artwork = null;
                Image    image   = kImageNoArtwork;
                if (uri != null)
                {
                    artwork = iArtworkCache.Artwork(uri);

                    if (artwork.Image != null)
                    {
                        image = artwork.Image;
                    }
                }

                width = (int)(image.Width * (height / (float)image.Height));
                int offset = (int)((height - width) * 0.5f) + 20;
                aGraphics.DrawImage(image, offsetX + offset, offsetY, width, height);

                image = null;
                if (artwork != null)
                {
                    image = artwork.ImageReflected;
                }
                if (image == null)
                {
                    image = kImageReflectedNoArtwork;
                }
                int reflectionHeight = (int)(image.Height * (width / (float)image.Width));
                aGraphics.DrawImage(image, offsetX + offset, offsetY + height, width, reflectionHeight);

                TextFormatFlags flags = TextFormatFlags.Left | TextFormatFlags.EndEllipsis;
                int             x     = offsetX + height + 30;
                int             y     = offsetY;
                width = Width - (height + 30);
                Size size = TextRenderer.MeasureText(aGraphics, aTitle, iLargeFont);
                TextRenderer.DrawText(aGraphics, aTitle, iLargeFont, new Rectangle(x, y, width, size.Height), fontColour, flags);
                y += (int)(size.Height + (height * 0.1f));

                if (aArtist.Length > 0)
                {
                    size = TextRenderer.MeasureText(aGraphics, aArtist, iMediumFont);
                    TextRenderer.DrawText(aGraphics, aArtist, iMediumFont, new Rectangle(x, y, width, size.Height), fontColour, flags);
                    y += size.Height;
                }

                if (aAlbum.Length > 0)
                {
                    size = TextRenderer.MeasureText(aGraphics, aAlbum, iSmallFont);
                    TextRenderer.DrawText(aGraphics, aAlbum, iSmallFont, new Rectangle(x, y, width, size.Height), fontColour, flags);
                    y += size.Height;
                }

                if (aGenre.Length > 0)
                {
                    size = TextRenderer.MeasureText(aGraphics, aGenre, iSmallFont);
                    TextRenderer.DrawText(aGraphics, aGenre, iSmallFont, new Rectangle(x, y, width, size.Height), fontColour, flags);
                    y += size.Height;
                }

                y = height + offsetY - iSmallFont.Height;
                //int yOffset = (int)(Height * 0.12f);

                /*using (Pen p = new Pen(iViewSupport.ForeColourBright))
                 * {
                 *  //Rectangle rect = new Rectangle(x, y, width - 30, size.Height);
                 *  //e.Graphics.DrawRectangle(p, rect);
                 *  int startOffset = (i == 0) ? 20 : 0;
                 *  int endOffset = (i == (iPlaylist.Count - 1)) ? 20 : 0;
                 *  if (i == 0)
                 *  {
                 *      e.Graphics.DrawLine(p, new Point(startOffset + offsetX, ClientSize.Height - iSmallFont.Height - yOffset), new Point(startOffset + offsetX, ClientSize.Height - yOffset));
                 *  }
                 *  if (i == (iPlaylist.Count - 1))
                 *  {
                 *      e.Graphics.DrawLine(p, new Point(ClientSize.Width - endOffset + offsetX, ClientSize.Height - iSmallFont.Height - yOffset), new Point(ClientSize.Width - endOffset + offsetX, ClientSize.Height - yOffset));
                 *  }
                 *  e.Graphics.DrawLine(p, new Point(startOffset + offsetX, ClientSize.Height - iSmallFont.Height - yOffset), new Point(offsetX + ClientSize.Width - endOffset, ClientSize.Height - iSmallFont.Height - yOffset));
                 *  e.Graphics.DrawLine(p, new Point(startOffset + offsetX, ClientSize.Height - yOffset), new Point(offsetX + ClientSize.Width - endOffset, ClientSize.Height - yOffset));
                 * }*/
                /*using (Brush b = new SolidBrush(iViewSupport.HighlightBackColour))
                 * {
                 *  int startOffset = (i == 0) ? 21 : 0;
                 *  int endOffset = (i == (iPlaylist.Count - 1)) ? 21 : 0;
                 *  if (i < iIndex)
                 *  {
                 *      Rectangle rect = new Rectangle(startOffset + offsetX, ClientSize.Height - iSmallFont.Height - (yOffset - 1), ClientSize.Width - startOffset, iSmallFont.Height - 1);
                 *      e.Graphics.FillRectangle(b, rect);
                 *  }
                 *  else if (drawTime && iDuration > 0)
                 *  {
                 *      Rectangle rect = new Rectangle(startOffset + offsetX, ClientSize.Height - iSmallFont.Height - yOffset + 1, (int)((ClientSize.Width - startOffset - endOffset) * (iSeconds / (float)iDuration)), iSmallFont.Height - 1);
                 *      e.Graphics.FillRectangle(b, rect);
                 *  }
                 * }*/

                if (aCurrent)
                {
                    Time time     = new Time((int)iSeconds);
                    Time duration = new Time((int)iDuration);

                    string t = (drawTime ? time.ToPrettyString() : "");
                    if (duration.SecondsTotal > 0)
                    {
                        t += (drawTime ? " / " : "") + duration.ToPrettyString();
                    }

                    Size tSize = TextRenderer.MeasureText(aGraphics, t, iMicroFont);
                    TextRenderer.DrawText(aGraphics, t, iMicroFont, new Rectangle(x, y - iMicroFont.Height, tSize.Width, tSize.Height), fontColour, TextFormatFlags.Default);

                    /*size = TextRenderer.MeasureText(e.Graphics, duration.ToPrettyString(), iMicroFont);
                     * TextRenderer.DrawText(e.Graphics, duration.ToPrettyString(), iMicroFont, new Rectangle(x + width - 30 - size.Width, y - size.Height, size.Width, size.Height), fontColour, TextFormatFlags.Right);*/

                    if (iCodec != string.Empty)
                    {
                        string info     = iBitrate.ToString() + " kbps, " + iSampleRate.ToString() + " kHz" + (iLossless ? " / " + iBitDepth.ToString() + " bits, " : ", ") + iCodec;
                        Size   infoSize = TextRenderer.MeasureText(aGraphics, info, iMicroFont);
                        TextRenderer.DrawText(aGraphics, info, iMicroFont, new Rectangle(x, y - iMicroFont.Height - iMicroFont.Height, infoSize.Width, infoSize.Height), fontColour, TextFormatFlags.Default);
                    }
                }
            }
        }