Пример #1
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public Error.Types UpdateTenantImage(Context context, byte[] bin)
        {
            BinaryType = "TenantImage";
            var imageData = new Libraries.Images.ImageData(
                bin,
                ReferenceId,
                Libraries.Images.ImageData.Types.TenantImage);

            switch (Parameters.BinaryStorage.Provider)
            {
            case "Local": imageData.WriteToLocal(); break;

            default:
                Bin = imageData.ReSizeBytes(Libraries.Images.ImageData.SizeTypes.Logo);
                Rds.ExecuteNonQuery(
                    context: context,
                    transactional: true,
                    statements: Rds.UpdateOrInsertBinaries(
                        where : Rds.BinariesWhere()
                        .ReferenceId(ReferenceId)
                        .BinaryType("TenantImage"),
                        param: Rds.BinariesParamDefault(
                            context: context,
                            binaryModel: this,
                            setDefault: true)));
                break;
            }
            return(Error.Types.None);
        }
Пример #2
0
        /// <summary>
        /// Fixed:
        /// </summary>
        public Error.Types UpdateSiteImage(byte[] data)
        {
            BinaryType = "SiteImage";
            var imageData = new Libraries.Images.ImageData(
                data,
                ReferenceId,
                Libraries.Images.ImageData.Types.SiteImage);

            switch (Parameters.BinaryStorage.Provider)
            {
            case "Local": imageData.WriteToLocal(); break;

            default:
                Bin       = imageData.ReSizeBytes(Libraries.Images.ImageData.SizeTypes.Regular);
                Thumbnail = imageData.ReSizeBytes(
                    Libraries.Images.ImageData.SizeTypes.Thumbnail);
                Icon = imageData.ReSizeBytes(Libraries.Images.ImageData.SizeTypes.Icon);
                Rds.ExecuteNonQuery(transactional: true, statements:
                                    Rds.UpdateOrInsertBinaries(
                                        selectIdentity: true,
                                        where : Rds.BinariesWhere()
                                        .ReferenceId(ReferenceId)
                                        .BinaryType("SiteImage"),
                                        param: Rds.BinariesParamDefault(this, setDefault: true)));
                break;
            }
            return(Error.Types.None);
        }
        /// <summary>
        /// Fixed:
        /// </summary>
        public Error.Types UpdateSiteImage(
            Context context,
            SiteSettings ss,
            byte[] bin)
        {
            BinaryType = "SiteImage";
            var imageData = new Libraries.Images.ImageData(
                bin,
                ReferenceId,
                Libraries.Images.ImageData.Types.SiteImage);

            switch (Parameters.BinaryStorage.GetSiteImageProvider())
            {
            case "Local": imageData.WriteToLocal(); break;

            default:
                Bin       = imageData.ReSizeBytes(Libraries.Images.ImageData.SizeTypes.Regular);
                Thumbnail = imageData.ReSizeBytes(
                    Libraries.Images.ImageData.SizeTypes.Thumbnail);
                Icon        = imageData.ReSizeBytes(Libraries.Images.ImageData.SizeTypes.Icon);
                ContentType = "image/png";
                Repository.ExecuteNonQuery(
                    context: context,
                    transactional: true,
                    statements: Rds.UpdateOrInsertBinaries(
                        where : Rds.BinariesWhere()
                        .ReferenceId(ReferenceId)
                        .BinaryType("SiteImage"),
                        param: Rds.BinariesParamDefault(
                            context: context,
                            ss: ss,
                            binaryModel: this,
                            setDefault: true)));
                break;
            }
            return(Error.Types.None);
        }