public ResultMsg_PmSpecFileUPload doUploadFile(ResultMsg_PmSpecFileUPload result, HttpPostedFile file)
        {
            //判断文件是否为空
            if (file != null)
            {
                string fileName = file.FileName;
                string fileType = Path.GetExtension(fileName).ToLower();

                //由于不同浏览器取出的FileName不同(有的是文件绝对路径,有的是只有文件名),故要进行处理
                if (fileName.IndexOf(' ') > -1)
                {
                    fileName = fileName.Substring(fileName.LastIndexOf(' ') + 1);
                }
                else if (fileName.IndexOf('/') > -1)
                {
                    fileName = fileName.Substring(fileName.LastIndexOf('/') + 1);
                }

                if (!Directory.Exists(uploadFilePath))
                {
                    Directory.CreateDirectory(uploadFilePath);
                }
                result.sourceFileName = fileName;
                result.targetFileName = getTemporaryFileName(fileType);

                file.SaveAs(uploadFilePath + result.targetFileName);
                //读取doc文档
                //Document doc = new Document(uploadFilePath + result.targetFileName);
                ////保存为PDF文件,此处的SaveFormat支持很多种格式,如图片,epub,rtf 等等
                //doc.Save(uploadFilePath + result.targetFileName, SaveFormat.Pdf);
                result.result = "success";
                result.msg    = "上传成功";
            }
            else
            {
                result.result         = "failed";
                result.msg            = "上传失败";
                result.sourceFileName = "";
                result.targetFileName = "";
            }
            return(result);
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            if (context.Session["UserName"] != null)
            {
                UserName = context.Session["UserName"].ToString().ToUpper().Trim();
            }
            else
            {
                UserName = "";
            }

            Action = RequstString("Action");

            if (Action.Length == 0)
            {
                Action = "";
            }

            if (Action == "EquMaintenceStandrad_Detail")
            {
                Equ_PmSpecInfo equinfo = new Equ_PmSpecInfo();
                equinfo.ID = RequstString("EquID");
                Equ_PmSpecInfo result = new Equ_PmSpecInfo();
                result = GetEquDetailObj(equinfo, result);
                context.Response.Write(jsc.Serialize(result));
            }
            else if (Action == "PmSpecFileUploadify")
            {
                HttpPostedFile             file   = System.Web.HttpContext.Current.Request.Files["Filedata"];
                ResultMsg_PmSpecFileUPload result = new ResultMsg_PmSpecFileUPload();
                result = doUploadFile(result, file);
                context.Response.Write(jsc.Serialize(result));
            }
            else if (Action == "EquMaintenceStandrad_Add")
            {
                Equ_PmSpecInfo dataEntity = new Equ_PmSpecInfo();
                //dataEntity.ID = RequstString("ProcId");
                dataEntity.ProcessCode   = RequstString("ProcessName");
                dataEntity.DeviceName    = RequstString("DeviceName");
                dataEntity.PmSpecCode    = RequstString("PmSpecCode");
                dataEntity.PmSpecName    = RequstString("PmSpecName");
                dataEntity.PmLevel       = RequstString("PmLevel");
                dataEntity.PmSpecFile    = RequstString("PmSpecFile");
                dataEntity.UploadedFile  = RequstString("UploadedPmSpecFile");
                dataEntity.PmSpecComment = RequstString("PmSpecComment");
                ResultMsg_Equ_PmSpec result = new ResultMsg_Equ_PmSpec();
                result = addEquMaintenceStandradDataInDB(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }
            else if (Action == "EquMaintenceStandrad_Edit")
            {
                Equ_PmSpecInfo dataEntity = new Equ_PmSpecInfo();
                dataEntity.ID           = RequstString("EquID");
                dataEntity.ProcessCode  = RequstString("ProcessName");
                dataEntity.DeviceName   = RequstString("DeviceName");
                dataEntity.PmSpecCode   = RequstString("PmSpecCode");
                dataEntity.PmSpecName   = RequstString("PmSpecName");
                dataEntity.PmLevel      = RequstString("PmLevel");
                dataEntity.PmSpecFile   = RequstString("PmSpecFile");
                dataEntity.UploadedFile = RequstString("UploadedPmSpecFile");

                ResultMsg_Equ_PmSpec result = new ResultMsg_Equ_PmSpec();
                result = editEquMaintenceStandradDataInDB(dataEntity, result);
                context.Response.Write(jsc.Serialize(result));
            }
            else if (Action == "StandardFileCHECK" || Action == "StandardFileDOWNLOAD" || Action == "PmStandardFileCHECK")
            {
                string objID    = RequstString("objID");
                string fileName = string.Empty;
                if (Action == "StandardFileCHECK" || Action == "StandardFileDOWNLOAD")
                {
                    fileName = GetEquStandardFileNameFromDB(objID);
                }
                else
                {
                    fileName = GetEquPmStandardFileNameFromDB(objID);
                }
                string   fileType        = Path.GetExtension(fileName).ToLower();
                FileInfo fileInfo        = new FileInfo(browsePmSpecFilePath + fileName);
                string   fileWithoutType = Path.GetFileNameWithoutExtension(fileName);
                if (!Directory.Exists(browsePmSpecFilePath))
                {
                    Directory.CreateDirectory(browsePmSpecFilePath);
                }
                context.Response.ClearContent();
                context.Response.ClearHeaders();
                if (Action == "StandardFileCHECK" || Action == "PmStandardFileCHECK")
                {
                    if (fileType == ".docx" || fileType == ".doc")
                    {
                        string path = browsePmSpecFilePath + Common.StringFilter.FilterSpecial(fileName);
                        try
                        {
                            //读取doc文档
                            Document doc = new Document(path);
                            ////保存为PDF文件,此处的SaveFormat支持很多种格式,如图片,epub,rtf 等等
                            doc.Save(browsePmSpecFilePath + fileWithoutType + ".pdf", Aspose.Words.SaveFormat.Pdf);
                            //Workbook wb = new Workbook(path);
                            //wb.Save(browseManualFilePath + fileWithoutType + ".pdf", SaveFormat.Pdf);
                            context.Response.Write("./PmSpecFile/" + fileWithoutType + ".pdf");
                        }
                        catch (Exception ex)
                        {
                            context.Response.Write("false");
                        }
                    }
                    else
                    {
                        context.Response.Write("./PmSpecFile/" + fileWithoutType + ".pdf");
                    }
                }
                else
                {
                    if (fileType == ".docx" || fileType == ".doc")
                    {
                        context.Response.AppendHeader("content-type", "application/msword");
                    }
                    else if (fileType == ".xlsx" || fileType == ".xls")
                    {
                        context.Response.AppendHeader("content-type", "application/x-msexcel");
                    }
                    else if (fileType == ".pdf")
                    {
                        context.Response.AppendHeader("content-type", "application/pdf");
                    }

                    try
                    {
                        FileInfo fileInfo1 = new FileInfo(browsePmSpecFilePath + Common.StringFilter.FilterSpecial(fileName));
                        context.Response.AddHeader("content-length", fileInfo1.Length.ToString());//文件大小
                        context.Response.WriteFile(browsePmSpecFilePath + Common.StringFilter.FilterSpecial(fileName));
                    }
                    catch (Exception ex)
                    {
                        context.Response.Write(ex.Message);
                    }
                    context.Response.Flush();
                    context.Response.Close();
                }
            }
        }