Exemplo n.º 1
0
        public static Task GetHendersonZoom(HttpContext context)
        {
            var depthRouteValue = (string)context.GetRouteValue("n");
            var depth           = int.Parse(depthRouteValue);

            Picture p = new EPicture();

            for (int i = 0; i < depth; i++)
            {
                p = new ZoomPicture(p);
            }

            return(SvgRequestHandler.GetSvg(context, p));
        }
Exemplo n.º 2
0
        public void UpPicture(string fileName)
        {
            string strFileName = fileName;
            string SmallPath   = HttpContext.Current.Server.MapPath("~") + "Upload\\SmallClaimInfoPicture\\";
            string BigPath     = HttpContext.Current.Server.MapPath("~") + "Upload\\BigClaimInfoPicture\\";
            Guid   TaggantID   = Guid.NewGuid();

            List <XMClaimInfoPicture> list = new List <XMClaimInfoPicture>();

            if (Session["XMClaimInfoAdd-PictureList"] != null)
            {
                list = (List <XMClaimInfoPicture>)Session["XMClaimInfoAdd-PictureList"];
                if (list.Count == 6)
                {
                    base.ShowMessage("最多只能上传6张图片!");
                    return;
                }
            }

            //判断上传图片格式
            string fileExtension = System.IO.Path.GetExtension(fileName);

            if (fileExtension.ToLower() != ".png" && fileExtension.ToLower() != ".jpg")
            {
                base.ShowMessage("请上传jpg或png格式的图片!");
                return;
            }
            //判断上传图片大小
            var setting = base.SettingManager.GetSettingByName("IDCard.ImgSiz");//公共参数

            if (setting != null)
            {
                if (FileUpFigureMap.PostedFile.ContentLength > Convert.ToInt32(setting.Value))
                {
                    base.ShowMessage("请选择不大于1M的图片上传!");
                    return;
                }
            }

            if (!Directory.Exists(SmallPath))
            {
                Directory.CreateDirectory(SmallPath);
            }
            if (!Directory.Exists(BigPath))
            {
                Directory.CreateDirectory(BigPath);
            }

            string[] strExtensions = fileName.Split('.');
            string   strExtension  = string.Empty;

            if (strExtensions.Length > 0)
            {
                Random myRandom = new Random();
                strExtension = strExtensions[strExtensions.Length - 1];
                strFileName  = DateTime.Now.ToString("yyMMddHHmmssfff") + myRandom.Next(100, 999).ToString() + "." + strExtension;
            }

            FileUpFigureMap.SaveAs(BigPath + strFileName);
            ZoomPicture.GenerateHighThumbnail(BigPath + strFileName, SmallPath + strFileName, 87, 87);

            XMClaimInfoPicture info = new XMClaimInfoPicture();

            info.ID          = 0;
            info.PicturePath = strFileName;
            info.IsEnable    = false;
            info.CreateID    = HozestERPContext.Current.User.SCustomerInfo.CustomerID;
            info.CreateDate  = DateTime.Now;
            info.UpdateID    = HozestERPContext.Current.User.SCustomerInfo.CustomerID;
            info.UpdateDate  = DateTime.Now;
            list.Add(info);
            Session["XMClaimInfoAdd-PictureList"] = list;

            LoadPicture(list);
        }