示例#1
0
文件: UserOb.cs 项目: shenshunan/EFS
        public static string addNew(string strXml)
        {
            DataDoc doc = new DataDoc(strXml);
            // 创建执行对象
            DataStorage storage = new DataStorage();
            int         size    = doc.getDataNum(Table.USERLIST);

            // 解析sql语句
            for (int i = 0; i < size; i++)
            {
                XmlElement ele = (XmlElement)doc.getDataNode(Table.USERLIST, i);
                string     a   = ele.InnerXml;

                XmlNode node  = XmlFun.getNode(ele, Field.USERID);
                string  strId = NumAssign.assignID_A("000002");
                XmlFun.setNodeValue(node, strId);

                storage.addSQL(SQLAnalyse.analyseXMLSQL(ele));
            }
            // 执行
            string    strReturn = storage.runSQL();
            ReturnDoc returndoc = new ReturnDoc();

            if (!General.empty(strReturn))
            {
                returndoc.addErrorResult(Common.RT_FUNCERROR);
                returndoc.setFuncErrorInfo(strReturn);
            }
            else
            {
                returndoc.addErrorResult(Common.RT_SUCCESS);
            }

            return(returndoc.getXml());
        }
示例#2
0
        private DataDoc FillESModel(Doc doc)
        {
            var dataDoc = new DataDoc();

            dataDoc.Id         = doc.DocId;
            dataDoc.CaseId     = doc.Case.Caseid;
            dataDoc.CourtId    = doc.Court.CourtId;
            dataDoc.DateDoc    = doc.DocDate;
            dataDoc.DateOp     = doc.DateOp;
            dataDoc.InstanceId = doc.Instance.InstanceId;
            dataDoc.TypeDocId  = doc.TypeDoc.DocTypeId;
            dataDoc.SearchText = ReadPDFDocToText(HTTPHelper.Instance.HTTPGetFile(doc.OriginalDocURL, Encoding.GetEncoding(Court.Encoding)));
            dataDoc.HTML       = TextToHTML(dataDoc.SearchText);
            return(dataDoc);
        }
示例#3
0
 /// <summary>
 /// Сохраняет модель в ES
 /// </summary>
 /// <param name="data"></param>
 internal void SaveInES(DataDoc data)
 {
     DataProvider.Instance.ESProvider.IndexData <DataDoc>(data, Index);
 }
示例#4
0
        public string GetSubjectPdf(string docName, string subjectId)
        {
            doc = new DataDoc(docName);
            List <Font> sbjFonts = new List <Font>()
            {
                h1_Font, h2_Font, h3_Font, h4_Font, h5_Font
            };


            string fileName = Guid.NewGuid().ToString() + ".pdf";
            string retFile  = tempDir + fileName;

            if (!Directory.Exists(tempDir))
            {
                Directory.CreateDirectory(tempDir);
            }

            pdfDoc = new Document(PageSize.A4, 72, 72, 72, 72);//默认值为36磅
            try
            {
                writer = PdfWriter.GetInstance(this.pdfDoc, new FileStream(retFile, FileMode.Create));

                Image headerLogo = Image.GetInstance(XSite.BinServerPath + @"\HeaderLogo.wmf");

                HeaderFooter header = new HeaderFooter(new Phrase(new Chunk(headerLogo, 0, 0)), false);
                header.Alignment   = Rectangle.ALIGN_LEFT;
                header.Border      = Rectangle.BOTTOM_BORDER;
                header.BorderWidth = 0.1f;
                HeaderFooter footer = new HeaderFooter(new Phrase("第 ", fontFooterCN), new Phrase(" 页", fontFooterCN));
                footer.Alignment   = Rectangle.ALIGN_RIGHT;
                footer.Border      = Rectangle.TOP_BORDER;
                footer.BorderWidth = 0.1f;
                pdfDoc.Header      = header;
                pdfDoc.Footer      = footer;

                pdfDoc.Open();
                pdfDoc.AddTitle(doc.Title);
                pdfDoc.AddAuthor("云晨期货有限责任公司");
                pdfDoc.AddCreator("云晨期货有限责任公司");

                Chapter chapter1 = null;

                List <Subject> subjects = doc.DrillDown(subjectId);

                for (int i = 0; i < subjects.Count; i++)
                {
                    Subject sbj       = subjects[i];
                    Font    sbjFont   = p_Font;
                    int     fontLevel = sbj.Level - 1;

                    if (fontLevel > -1 && fontLevel < sbjFonts.Count)
                    {
                        sbjFont = sbjFonts[sbj.Level];
                    }

                    Paragraph title = new Paragraph(sbj.Title, sbjFont);
                    string    stext = sbj.Text;
                    if (!string.IsNullOrEmpty(stext))
                    {
                        stext = stext.Trim().Replace(" ", "");
                    }
                    Paragraph text = new Paragraph(stext, p_Font);
                    text.FirstLineIndent = 24;
                    text.Leading         = 18;
                    text.SpacingAfter    = 12;
                    text.Alignment       = 3;

                    pdfDoc.Add(title);
                    pdfDoc.Add(text);


                    if (!string.IsNullOrEmpty(sbj.ChartId))
                    {
                        DataChart chart = new DataChart(sbj.ChartId);
//                        chart.Render();
                        System.Drawing.Bitmap bmp = chart.GetBitmap();
//                        bmp.Save(tempDir+sbj.ChartId+ ".bmp");
                        iTextSharp.text.Image itImage = iTextSharp.text.Image.GetInstance(bmp, System.Drawing.Imaging.ImageFormat.Bmp);
                        itImage.ScalePercent(60);
                        pdfDoc.Add(itImage);
                    }

                    //   Image img=Image.GetInstance(


                    //if (sbj.Level == 1)
                    //{
                    //    chapter1 = new Chapter(title, 1);
                    //    chapter1.SetChapterNumber(0);
                    //    pdfDoc.Add(chapter1);
                    //}

                    //if (chapter1 != null)
                    //{
                    //    Section section1 = chapter1.AddSection(title);
                    //    section1.Add(text);
                    //}
                    //else
                    //{
                    //    pdfDoc.Add(title);
                    //    pdfDoc.Add(text);
                    //}
                }
            }
            finally
            {
                pdfDoc.Close();
            }
            return(tempUrlPath + fileName);
        }