示例#1
0
        public override object Deserialize(IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            DocumentProperty docProp = new DocumentProperty();

            docProp.Id          = dictionary.GetValue("Id", (string)null);
            docProp.InitialData = dictionary.GetValue("InitialData", (string)null);
            if (dictionary.ContainsKey("DocumentImages"))
            {
                DocumentImageList docImages = JSONSerializerExecute.Deserialize <DocumentImageList>(dictionary["DocumentImages"]);
                docProp.DocumentImages = docImages;
            }

            //if (dictionary.ContainsKey("DocImageProps"))
            //{
            //    ImagePropertyCollection imageProps = JSONSerializerExecute.Deserialize<ImagePropertyCollection>(dictionary["DocImageProps"]);
            //    docProp.DocImageProps = imageProps;
            //}

            return(docProp);
        }
 public DocumentProperty()
 {
     docImages = new DocumentImageList();
     //docImageProps = new ImagePropertyCollection();
 }
示例#3
0
        /// <summary>
        /// Upload Images
        /// </summary>
        /// <returns></returns>
        public string UploadImage(HttpPostedFileBase file, Section section, string userId, long parentId)
        {
            string rootpath = ServiceHelper.ServerPath(section, userId, out string SubPath, out string virtualpathname);

            string error = null;

            error = makePath(rootpath);
            if (error != null)
            {
                return(error);
            }

            error = makePath(SubPath);
            if (error != null)
            {
                return(error);
            }

            //-------------------virtual path-----------------------------
            string originalVirtualPath = virtualpathname + ServiceHelper.FileName(section, FileType._Original) + System.IO.Path.GetExtension(file.FileName);
            string medeumVirtualPath   = virtualpathname + ServiceHelper.FileName(section, FileType._Medium) + System.IO.Path.GetExtension(file.FileName);
            string lowVirtualPath      = virtualpathname + ServiceHelper.FileName(section, FileType._Low) + System.IO.Path.GetExtension(file.FileName);
            //-------------------virtual path-----------------------------

            List <DocumentImageList> imagelist = new List <DocumentImageList>();


            //original image save
            string            originalpath = imageSave(file, SubPath, ServiceHelper.FileName(section, FileType._Original));
            DocumentImageList or_imageList = new DocumentImageList()
            {
                fileType = FileType._Original,
                path     = originalVirtualPath,
            };

            imagelist.Add(or_imageList);


            //mediumImageSave
            string mediumpath = imageSave(file, SubPath, ServiceHelper.FileName(section, FileType._Medium));

            SaveByte(mediumpath, FileType._Medium);
            DocumentImageList me_imageList = new DocumentImageList()
            {
                fileType = FileType._Medium,
                path     = medeumVirtualPath,
            };

            imagelist.Add(me_imageList);


            //lowResolutionImage
            string lowpath = imageSave(file, SubPath, ServiceHelper.FileName(section, FileType._Low));

            SaveByte(lowpath, FileType._Low);
            DocumentImageList lo_imageList = new DocumentImageList()
            {
                fileType = FileType._Low,
                path     = lowVirtualPath,
            };

            imagelist.Add(lo_imageList);

            //save document
            var docarray = _docDbService.SaveDocument(imagelist, userId, out string errordoc);

            if (errordoc != null)
            {
                return(errordoc);
            }

            string errorGloble = _globleService.SaveGlobleNote(section, docarray, userId, parentId);

            return(errorGloble);
        }
示例#4
0
 public DocumentProperty()
 {
     docImages = new DocumentImageList();
     //docImageProps = new ImagePropertyCollection();
 }