Пример #1
0
 public static string GetOpenWindowStringToTextBox(int siteId, EUploadType uploadType, string textBoxClientId)
 {
     return(LayerUtils.GetOpenScript2("上传附件", PageUtils.GetCmsUrl(siteId, nameof(ModalUploadFile), new NameValueCollection
     {
         { "uploadType", EUploadTypeUtils.GetValue(uploadType) },
         { "TextBoxClientID", textBoxClientId }
     }), 550, 250));
 }
Пример #2
0
 public static string GetOpenWindowStringToTextBox(int publishmentSystemId, EUploadType uploadType, string textBoxClientId)
 {
     return(PageUtils.GetOpenWindowString("上传附件", PageUtils.GetCmsUrl(nameof(ModalUploadFile), new NameValueCollection
     {
         { "PublishmentSystemID", publishmentSystemId.ToString() },
         { "uploadType", EUploadTypeUtils.GetValue(uploadType) },
         { "TextBoxClientID", textBoxClientId }
     }), 480, 300));
 }
Пример #3
0
 public static string GetOpenWindowStringToList(int publishmentSystemId, EUploadType uploadType, string realtedPath)
 {
     return(PageUtils.GetOpenWindowString("上传附件", PageUtils.GetCmsUrl(nameof(ModalUploadFile), new NameValueCollection
     {
         { "PublishmentSystemID", publishmentSystemId.ToString() },
         { "uploadType", EUploadTypeUtils.GetValue(uploadType) },
         { "realtedPath", realtedPath }
     }), 480, 300));
 }
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnFormLoaded(object sender, EventArgs e)
        {
            SetFunctionVisable();
            EUploadType eUpType = (EUploadType)OrderHelper.GetUploadType();

            _uploadFolder = CnasUtilityTools.GetFolderName(eUpType);
            string tempCode = _imageMode != 3 ? BatchNum : BarCode;

            LoadData(tempCode);
        }
Пример #5
0
 public UploadHandler(HttpContext context, UploadConfig config, int publishmentSystemID, EUploadType uploadType)
     : base(context)
 {
     UploadConfig = config;
     Result       = new UploadResult()
     {
         State = UploadState.Unknown
     };
     PublishmentSystemID = publishmentSystemID;
     UploadType          = uploadType;
 }
Пример #6
0
 public UploadHandler(HttpContext context, UploadConfig config, int siteId, EUploadType uploadType)
     : base(context)
 {
     UploadConfig = config;
     Result       = new UploadResult()
     {
         State = UploadState.Unknown
     };
     SiteId     = siteId;
     UploadType = uploadType;
 }
Пример #7
0
        public HCSWF_device_result_add(SortedList data, int resultMode)
        {
            InitializeComponent();
            Data       = data;
            ResultMode = resultMode;
            EUploadType eUpType = (EUploadType)GetUploadType();

            _uploadFolder = CnasUtilityTools.GetFolderName(eUpType);
            InitalizeData(data);
            InitializeButtonImage();
            Icon = new Icon(ResourcesImageHelper.Instance.GetResourcesStream("Common.icon", "MainIco", EnumImageType.ICO));
        }
Пример #8
0
 public static bool Equals(EUploadType type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Пример #9
0
        public static bool IsUploadSizeAllowed(EUploadType uploadType, SiteInfo siteInfo, int contentLength)
        {
            switch (uploadType)
            {
            case EUploadType.Image:
                return(IsImageSizeAllowed(siteInfo, contentLength));

            case EUploadType.Video:
                return(IsVideoSizeAllowed(siteInfo, contentLength));

            case EUploadType.File:
                return(IsFileSizeAllowed(siteInfo, contentLength));
            }
            return(false);
        }
Пример #10
0
        private static ISheet GetSheet(string pathOrUrl, EUploadType eUploadType)
        {
            if (pathOrUrl.IsNullOrEmpty())
            {
                throw new ArgumentNullException(nameof(pathOrUrl));
            }

            if (!pathOrUrl.EndsWith("xlsx") && !pathOrUrl.EndsWith("xls"))
            {
                throw new ArgumentNullException("error excel file.");
            }

            var memoryStream = new MemoryStream();

            if (eUploadType == EUploadType.Remote)
            {
                var client = new HttpClient();
                using (var stream = client.GetStreamAsync(pathOrUrl).Result)
                {
                    stream.CopyTo(memoryStream);
                    memoryStream.Seek(0, SeekOrigin.Begin);
                }
            }
            else
            {
                using (var fs = new FileStream(pathOrUrl, FileMode.Open, FileAccess.Read))
                {
                    fs.CopyTo(memoryStream);
                    memoryStream.Seek(0, SeekOrigin.Begin);
                }
            }

            ISheet sheet = null;

            if (pathOrUrl.EndsWith("xlsx"))
            {
                var workBook = new XSSFWorkbook(memoryStream);
                sheet = workBook.GetSheetAt(0);
            }
            else
            {
                // 2003版 excel
                var workBook = new HSSFWorkbook(memoryStream);
                sheet = workBook.GetSheetAt(0);
            }

            return(sheet);
        }
Пример #11
0
 public static bool IsUploadExtenstionAllowed(EUploadType uploadType, SiteInfo siteInfo, string fileExtention)
 {
     if (uploadType == EUploadType.Image)
     {
         return(IsImageExtenstionAllowed(siteInfo, fileExtention));
     }
     else if (uploadType == EUploadType.Video)
     {
         return(IsVideoExtenstionAllowed(siteInfo, fileExtention));
     }
     else if (uploadType == EUploadType.File)
     {
         return(IsFileExtenstionAllowed(siteInfo, fileExtention));
     }
     return(false);
 }
Пример #12
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            _uploadType      = EUploadTypeUtils.GetEnumType(Body.GetQueryString("uploadType"));
            _realtedPath     = Body.GetQueryString("realtedPath");
            _textBoxClientId = Body.GetQueryString("TextBoxClientID");

            if (!IsPostBack)
            {
                EBooleanUtils.AddListItems(rblIsFileUploadChangeFileName, "采用系统生成文件名", "采用原有文件名");
                ControlUtils.SelectListItemsIgnoreCase(rblIsFileUploadChangeFileName, PublishmentSystemInfo.Additional.IsFileUploadChangeFileName.ToString());
            }
        }
Пример #13
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("siteId");
            _uploadType      = EUploadTypeUtils.GetEnumType(AuthRequest.GetQueryString("uploadType"));
            _realtedPath     = AuthRequest.GetQueryString("realtedPath");
            _textBoxClientId = AuthRequest.GetQueryString("TextBoxClientID");

            if (IsPostBack)
            {
                return;
            }

            EBooleanUtils.AddListItems(DdlIsFileUploadChangeFileName, "采用系统生成文件名", "采用原有文件名");
            ControlUtils.SelectSingleItemIgnoreCase(DdlIsFileUploadChangeFileName, SiteInfo.Additional.IsFileUploadChangeFileName.ToString());
        }
Пример #14
0
        public static string GetLibraryVirtualPath(EUploadType uploadType, string fileName)
        {
            var uploadDirectoryName = string.Empty;

            if (uploadType == EUploadType.Image)
            {
                uploadDirectoryName = "images";
            }
            else if (uploadType == EUploadType.Video)
            {
                uploadDirectoryName = "videos";
            }
            else if (uploadType == EUploadType.File)
            {
                uploadDirectoryName = "files";
            }
            else if (uploadType == EUploadType.Special)
            {
                uploadDirectoryName = "specials";
            }

            return($"/{DirectoryUtils.SiteFiles.DirectoryName}/{DirectoryUtils.SiteFiles.Library}/{uploadDirectoryName}/{DateTime.Now.Year}/{DateTime.Now.Month}/{fileName}");
        }
Пример #15
0
 public static string GetText(EUploadType type)
 {
     if (type == EUploadType.Image)
     {
         return("图片");
     }
     if (type == EUploadType.Video)
     {
         return("视频");
     }
     if (type == EUploadType.File)
     {
         return("文件");
     }
     if (type == EUploadType.Special)
     {
         return("专题");
     }
     if (type == EUploadType.AdvImage)
     {
         return("广告");
     }
     throw new Exception();
 }
Пример #16
0
 public static string GetValue(EUploadType type)
 {
     if (type == EUploadType.Image)
     {
         return("Image");
     }
     if (type == EUploadType.Video)
     {
         return("Video");
     }
     if (type == EUploadType.File)
     {
         return("File");
     }
     if (type == EUploadType.Special)
     {
         return("Special");
     }
     if (type == EUploadType.AdvImage)
     {
         return("AdvImage");
     }
     throw new Exception();
 }
Пример #17
0
        public static string GetUploadDirectoryPath(SiteInfo siteInfo, DateTime datetime, EUploadType uploadType)
        {
            var uploadDateFormatString = string.Empty;
            var uploadDirectoryName    = string.Empty;

            if (uploadType == EUploadType.Image)
            {
                uploadDateFormatString = siteInfo.Additional.ImageUploadDateFormatString;
                uploadDirectoryName    = siteInfo.Additional.ImageUploadDirectoryName;
            }
            else if (uploadType == EUploadType.Video)
            {
                uploadDateFormatString = siteInfo.Additional.VideoUploadDateFormatString;
                uploadDirectoryName    = siteInfo.Additional.VideoUploadDirectoryName;
            }
            else if (uploadType == EUploadType.File)
            {
                uploadDateFormatString = siteInfo.Additional.FileUploadDateFormatString;
                uploadDirectoryName    = siteInfo.Additional.FileUploadDirectoryName;
            }
            else if (uploadType == EUploadType.Special)
            {
                uploadDateFormatString = siteInfo.Additional.FileUploadDateFormatString;
                uploadDirectoryName    = "/Special";
            }
            else if (uploadType == EUploadType.AdvImage)
            {
                uploadDateFormatString = siteInfo.Additional.FileUploadDateFormatString;
                uploadDirectoryName    = "/AdvImage";
            }

            string directoryPath;
            var    dateFormatType = EDateFormatTypeUtils.GetEnumType(uploadDateFormatString);
            var    sitePath       = GetSitePath(siteInfo);

            if (dateFormatType == EDateFormatType.Year)
            {
                directoryPath = PathUtils.Combine(sitePath, uploadDirectoryName, datetime.Year.ToString());
            }
            else if (dateFormatType == EDateFormatType.Day)
            {
                directoryPath = PathUtils.Combine(sitePath, uploadDirectoryName, datetime.Year.ToString(), datetime.Month.ToString(), datetime.Day.ToString());
            }
            else
            {
                directoryPath = PathUtils.Combine(sitePath, uploadDirectoryName, datetime.Year.ToString(), datetime.Month.ToString());
            }
            DirectoryUtils.CreateDirectoryIfNotExists(directoryPath);
            return(directoryPath);
        }
Пример #18
0
 public static string GetUploadDirectoryPath(SiteInfo siteInfo, EUploadType uploadType)
 {
     return(GetUploadDirectoryPath(siteInfo, DateTime.Now, uploadType));
 }
Пример #19
0
 public static string GetUploadDirectoryPath(PublishmentSystemInfo publishmentSystemInfo, EUploadType uploadType)
 {
     return(GetUploadDirectoryPath(publishmentSystemInfo, DateTime.Now, uploadType));
 }
Пример #20
0
        /// <summary>
        /// 图片保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tsm_save_Click(object sender, EventArgs e)
        {
            string str_ImageData    = this.ImageData01.GetXML();
            string str_ImageAddData = "";

            if (this.Sl_par.Count > 0)
            {
                str_ImageAddData = "<ImageAddData>";
                for (int i = 0; i < Sl_par.Count; i++)
                {
                    ImageAddData ImageAddDatatmp = (ImageAddData)Sl_par.GetByIndex(i);
                    str_ImageAddData = str_ImageAddData + ImageAddDatatmp.GetXML();
                }
                str_ImageAddData = str_ImageAddData + "</ImageAddData>";
            }
            string strxmltmp = "<Data>" + str_ImageData + str_ImageAddData + "</Data>";
            //UserXmlUpdate(sender, e, strxmltmp);


            //上传到FTP文件夹的名称
            string folderName = "";

            int upType = Convert.ToInt32(Sl_Parameter["type"]);
            //包图片名称
            string dataUrl = ImageData01.Name + ".jpg";

            // 确定上传图片的类型
            // 1-包  2-器械
            EUploadType eUpType = (EUploadType)upType;

            folderName = CnasUtilityTools.GetFolderName(eUpType);


            #region 保存对应条码包的照片
            //ftp: test.cnasis.cn:cnasftp:ftp123
            tsm_view_Click(null, null);
            Bitmap _NewBitmap = new Bitmap(this.PrictureView.Width, PrictureView.Height);
            //_NewBitmap.SetResolution(203, 203);
            prictureDesign.DrawToBitmap(_NewBitmap, new Rectangle(0, 0, _NewBitmap.Width, _NewBitmap.Height));
            MemoryStream memStream = new MemoryStream();
            _NewBitmap.Save(memStream, ImageFormat.Jpeg);


            ImageCache imageCache = new ImageCache();

            //保存图片
            bool result = imageCache.SaveImageCache(folderName, ImageData01.Name + ".jpg", memStream);
            if (!result)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("errorimage", EnumPromptMessage.error, new string[] { "系统错误" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            #endregion

            //获取图片
            Image picViewImage = imageCache.GetImageByFolderNameFileName(folderName, ImageData01.Name + ".jpg");
            //返回不等于""说明有错误信息返回,弹出提示
            if (picViewImage == null)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("errorseeim", EnumPromptMessage.error, new string[] { "" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else
            {
                this.PrictureView.Image = picViewImage;
            }

            //rexxie通过条形码更新数据库:关联文件名
            CnasRemotCall reCnasRemotCall = new CnasRemotCall();
            SortedList    sltmp           = new SortedList();
            SortedList    sltmp01         = new SortedList();

            //图片存储类型
            sltmp.Add(1, upType);
            //包ID
            sltmp.Add(2, Sl_Parameter["pack_id"]);
            //包条码
            sltmp.Add(3, Sl_Parameter["pack_barcode"]);
            //图片名称
            sltmp.Add(4, dataUrl);
            //状态默认可用
            sltmp.Add(5, 1);
            sltmp01.Add(1, sltmp);
            //string gg = reCnasRemotCall.RemotInterface.CheckUPData(1, "HCS_image-data-add001", sltmp01, null);
            int recint = reCnasRemotCall.RemotInterface.UPData(1, "HCS_image-data-add001", sltmp01, null);

            if (recint > -1)
            {
                MessageBox.Show(PromptMessageXmlHelper.Instance.GetPromptMessage("addsuccessful", EnumPromptMessage.warning, new string[] { "照片" }), "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
Пример #21
0
 public UEditorUploader(SiteInfo siteInfo, EUploadType uploadType)
 {
     this.siteInfo   = siteInfo;
     this.uploadType = uploadType;
 }
Пример #22
0
 public static bool Equals(string typeStr, EUploadType type)
 {
     return(Equals(type, typeStr));
 }
Пример #23
0
 public ListFileManager(HttpContext context, string pathToList, string[] searchExtensions, int siteId, EUploadType uploadType)
     : base(context)
 {
     SearchExtensions = searchExtensions.Select(x => x.ToLower()).ToArray();
     PathToList       = pathToList;
     SiteId           = siteId;
     UploadType       = uploadType;
 }
Пример #24
0
 public ListFileManager(HttpContext context, string pathToList, string[] searchExtensions, int publishmentSystemID, EUploadType uploadType)
     : base(context)
 {
     SearchExtensions    = searchExtensions.Select(x => x.ToLower()).ToArray();
     PathToList          = pathToList;
     PublishmentSystemID = publishmentSystemID;
     UploadType          = uploadType;
 }
Пример #25
0
 public UEditorUploader(PublishmentSystemInfo publishmentSystemInfo, EUploadType uploadType)
 {
     this.publishmentSystemInfo = publishmentSystemInfo;
     this.uploadType            = uploadType;
 }