Example #1
0
 public DocDBIndexExtract(XmlParser p)
 {
     this.xmlParser = p;
 }
Example #2
0
        // add by zhangqiuyi 获取世界专利指定类型引证文献信息
        public string GetEnCitedWithSrepPhase(string strPubX, string srepPhase, string type)
        {
            string strRefDoc = "";
            string PubNo = UrlParameterCode_DE.DecryptionAll(strPubX);
            try
            {
                ResultDataManagerDataContext db = new ResultDataManagerDataContext();
                Table<DocdbDocInfo> tbDocDocInfo = db.DocdbDocInfo;

                var result = from item in tbDocDocInfo
                             where item.PubID == PubNo
                             orderby item.ID descending
                             select new xmlDataInfo
                             {
                                 StrTitle = item.Title,
                                 StrApNo = item.AppNo,
                                 StrApDate = item.AppDate,
                                 StrANX = strPubX,
                                 StrIpc = item.IPC.Substring(0, 50),
                                 StrPubNo = item.PubID,
                                 CPIC = item.CPIC.ToString(),
                                 StrSerialNo = item.ID.ToString(),
                             };

                xmlDataInfo resXmlInfo = result.First();

                XmlParser xmlParser = new XmlParser("", "UTF-8");
                DocDBIndexExtract docDBIndexExtract = new DocDBIndexExtract(xmlParser);
                String xmlContent = getEnMainXmlContent(resXmlInfo.StrPubNo);
                if (!xmlContent.Contains("exch:"))
                {
                    docDBIndexExtract.exch = "";
                }

                using (StringReader xmlString = new StringReader(xmlContent))
                {
                    using (XmlReader reader = XmlReader.Create(xmlString, xmlParser.Settings, xmlParser.Context))
                    {
                        XDocument xRoot = XDocument.Load(reader, LoadOptions.None);

                        if (type.Equals("not"))
                            strRefDoc = docDBIndexExtract.getCitedNotContain(xRoot, srepPhase);
                        else
                            strRefDoc = docDBIndexExtract.getCited(xRoot, srepPhase);
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
            }

            if (strRefDoc.Equals(""))
            {
                return "暂无数据";
            }
            return strRefDoc;
        }
Example #3
0
        /// <summary>
        /// 填充中文数据
        /// </summary>
        /// <param name="_item"></param>
        /// <param name="strType"></param>
        /// <returns></returns>
        private bool UpdateByCnXmlFile(xmlDataInfo _item, bool _isMegPubAnn)
        {
            bool bRs = false;

            xmlDataInfo xmlInfoitem = _item;
            try
            {
                XmlParser xmlParser = new XmlParser("", "GB2312");
                CnIndexExtract cnIndexExtract = new CnIndexExtract();

                String xmlContent = getCnMainXmlContent(xmlInfoitem.StrApNo);
                xmlContent = Util.StringUtil.ReplaceLowOrderASCIICharacters(xmlContent);
                using (StringReader xmlString = new StringReader(xmlContent))
                {
                    using (XmlReader reader = XmlReader.Create(xmlString, xmlParser.Settings, xmlParser.Context))
                    {
                        XDocument xRoot = XDocument.Load(reader, LoadOptions.None);

                        xmlInfoitem.StrAgency = Cpic.Cprs2010.Cfg.DmManager.getAG_Display(cnIndexExtract.getAgency(xRoot));
                        xmlInfoitem.StrAgency_Addres = Cpic.Cprs2010.Cfg.DmManager.getAG_Addres(cnIndexExtract.getAgency(xRoot));
                        xmlInfoitem.StrDaiLiRen = cnIndexExtract.getAgents(xRoot);
                        xmlInfoitem.StrAnnDate = XmPatentComm.FormatDateVlue(cnIndexExtract.getAnnouncementDate(xRoot));
                        xmlInfoitem.StrAnnNo = cnIndexExtract.getAnnouncementNo(xRoot);
                        xmlInfoitem.StrApply = cnIndexExtract.getApply(xRoot);
                        xmlInfoitem.StrCountryCode = Cpic.Cprs2010.Cfg.DmManager.getCC_Display(cnIndexExtract.getProvinceCode(xRoot));
                        xmlInfoitem.StrFiled = cnIndexExtract.getField(xRoot);
                        xmlInfoitem.StrInventor = cnIndexExtract.getInventor(xRoot);
                        xmlInfoitem.StrPri = cnIndexExtract.getPriorNo(xRoot);

                        xmlInfoitem.StrPubDate = XmPatentComm.FormatDateVlue(cnIndexExtract.getPublicDate(xRoot));
                        xmlInfoitem.StrPubNo = cnIndexExtract.getPublicNo(xRoot);
                        if (_isMegPubAnn)
                        {
                            //xmlInfoitem.StrPubDate = getPubApdDate(xmlInfoitem.StrPubDate, xmlInfoitem.StrAnnDate);
                            //xmlInfoitem.StrPubNo = getPubApdNo(xmlInfoitem.StrPubNo, xmlInfoitem.StrAnnNo);
                        }
                        else
                        {
                            xmlInfoitem.StrTitle = cnIndexExtract.getTitle(xRoot);
                            //xmlInfoitem.StrApNo = cnIndexExtract.getApplyNo(xRoot);
                            xmlInfoitem.StrApDate = XmPatentComm.FormatDateVlue(cnIndexExtract.getApplyDate(xRoot));
                            //xmlInfoitem.StrANX = UrlParameterCode_DE.encrypt(xmlInfoitem.StrApNo.Trim());  //add by xiwl
                        }
                        xmlInfoitem.StrPdOrGd = getPubApdDate(xmlInfoitem.StrPubDate, xmlInfoitem.StrAnnDate);
                        xmlInfoitem.StrPnOrGn = getPubApdNo(xmlInfoitem.StrPubNo, xmlInfoitem.StrAnnNo);

                        xmlInfoitem.StrIpc = cnIndexExtract.getIPC(xRoot);
                        xmlInfoitem.StrFtUrl = string.Format("http://211.160.117.105/bns/comm/getimg.aspx?idx={0}&Ty=CNG", xmlInfoitem.StrANX);
                        //item.StrAbstr = cnIndexExtract.getAbstract(xRoot);//.Length >= 140 ? cnIndexExtract.getAbstract(xRoot).Substring(0, 140) : string.IsNullOrEmpty(cnIndexExtract.getAbstract(xRoot)) ? "无" : cnIndexExtract.getAbstract(xRoot);
                        xmlInfoitem.StrAbstr = cnIndexExtract.getAbstract(xRoot);
                        xmlInfoitem.StrAbstr = string.IsNullOrEmpty(xmlInfoitem.StrAbstr) ? "无" : xmlInfoitem.StrAbstr;

                        xmlInfoitem.StrClaim = cnIndexExtract.getMainClaim(xRoot);
                        xmlInfoitem.Brief = GetBriefInfo(xmlInfoitem.StrApNo);
                        xmlInfoitem.TongZu = "";   // GetTongZu(xmlInfoitem.StrPubNo, xmlInfoitem.CPIC);
                        xmlInfoitem.ZhuanLiLeiXing = getZhuanLiLeiXing(xmlInfoitem.StrApNo);

                        xmlInfoitem.StrMainIPC = cnIndexExtract.getMainIPC(xRoot);

                        if (xmlInfoitem.ZhuanLiLeiXing.Equals("3"))
                        {
                            string pubDate = System.Web.HttpUtility.UrlEncode(cnIndexExtract.getAnnouncementDate(xRoot));
                            xmlInfoitem.StrFtUrl = string.Format("http://211.160.117.105/bns/comm/getimg.aspx?idx={0}&Ty=CNG&ImgTp=wg&pd={1}", xmlInfoitem.StrANX, pubDate);

                            xmlInfoitem.StrMainIPC = XmPatentComm.RevertDegIpc(xmlInfoitem.StrMainIPC);
                            string strIpcTmp = "";
                            foreach (string strItem in xmlInfoitem.StrIpc.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries))
                            {
                                strIpcTmp += XmPatentComm.RevertDegIpc(strItem) + ";";
                            }
                            xmlInfoitem.StrIpc = strIpcTmp.TrimEnd(';');
                        }
                        xmlInfoitem.StrApNo = string.Format("{0}.{1}", xmlInfoitem.StrApNo.Trim(), CnAppLicationNo.getValidCode(xmlInfoitem.StrApNo)); //add by xiwl;
                        xmlInfoitem.FaLvZhuangTai = "../my/frmFLZT.aspx?AppNo=" + xmlInfoitem.StrANX;

                        xmlInfoitem.StrShenQingRenDiZhi = cnIndexExtract.getAddress(xRoot);

                        _item.StrApDate = XmPatentComm.FormatDateVlue(_item.StrApDate);

                        xmlInfoitem.StrFtUrl += _isMegPubAnn ? "" : "&bg=";
                    }
                }
                bRs = true;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                bRs = false;
            }
            return bRs;
        }
Example #4
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="_item"></param>
        /// <param name="strType"></param>
        /// <returns></returns>
        private bool UpdateByEnXmlFile(xmlDataInfo _item, bool _isDetails)
        {
            bool bRs = false;
            xmlDataInfo item = _item;
            try
            {

                XmlParser xmlParser = new XmlParser("", "UTF-8");
                DocDBIndexExtract docDBIndexExtract = new DocDBIndexExtract(xmlParser);
                String xmlContent = getEnMainXmlContent(item.StrPubNo);
                if (!xmlContent.Contains("exch:"))
                {
                    docDBIndexExtract.exch = "";
                }
                //logger.Debug(xmlContent);
                //xmlContent = Util.StringUtil.ReplaceLowOrderASCIICharacters(xmlContent);
                using (StringReader xmlString = new StringReader(xmlContent))
                {
                    using (XmlReader reader = XmlReader.Create(xmlString, xmlParser.Settings, xmlParser.Context))
                    {
                        XDocument xRoot = XDocument.Load(reader, LoadOptions.None);

                        //item.StrCountryCode = Cpic.Cprs2010.Cfg.DmManager.getCC_Display(docDBIndexExtract.getAppliesCountry(xRoot));

                        if (_isDetails)
                        {
                            item.StrApply = docDBIndexExtract.getAppliesAndCC(xRoot);
                            item.StrInventor = docDBIndexExtract.getInventorsAndCC(xRoot);
                            //item.TongZu = GetTongZu(item.StrPubNo, item.CPIC,1);
                        }
                        else
                        {
                            item.StrApply = docDBIndexExtract.getApplies(xRoot);
                            item.StrInventor = docDBIndexExtract.getInventors(xRoot);
                        }

                        item.StrPubDate = docDBIndexExtract.getPublicDate(xRoot);
                        item.StrFtUrl = getEnFtUrl(item.StrPubDate, item.StrPubNo);

                        /////------------
                        item.StrEpoApNo = docDBIndexExtract.getEpoApplyNo(xRoot);
                        item.StrOriginalApNo = docDBIndexExtract.getOriginalApplyNo(xRoot);
                        item.StrDocdbApNo = docDBIndexExtract.getDocdbApplyNo(xRoot);

                        item.StrDocdbPubNo = docDBIndexExtract.getDocdbPublicDocNo(xRoot);
                        item.StrEpoPubNo = docDBIndexExtract.getEpoPublicDocNo(xRoot);
                        item.StrOriginalPubNo = docDBIndexExtract.getOriginalPublicDocNo(xRoot);
                        //item.StrPubNo = docDBIndexExtract.getPublicDocNo(xRoot);
                        item.StrAbstr = docDBIndexExtract.getAbstract(xRoot);
                        item.StrAbsFmy = docDBIndexExtract.getFmyAbstract(xRoot);
                        item.StrRefDoc = docDBIndexExtract.getCited(xRoot);
                        item.StrPri = docDBIndexExtract.getEpoPriorAndPrd(xRoot);

                        item.StrEcla = docDBIndexExtract.getECLA(xRoot);

                        if (string.IsNullOrEmpty(item.StrTitle.Trim()))
                        {
                            item.StrTitle = docDBIndexExtract.getInventionTitle(xRoot);
                        }
                        if (string.IsNullOrEmpty(item.StrApDate))
                        {
                            item.StrApDate = docDBIndexExtract.getApplyDate(xRoot);
                        }
                    }
                }

                item.StrApDate = XmPatentComm.FormatDateVlue(item.StrApDate);
                item.StrPubDate = item.StrPdOrGd = XmPatentComm.FormatDateVlue(item.StrPubDate);
                item.StrPnOrGn = item.StrPubNo;
                item.StrMainIPC = item.StrIpc.Split(';')[0];
                bRs = true;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                bRs = false;
            }
            return bRs;
        }
Example #5
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="lstNo"></param>
        /// <returns></returns>
        private IEnumerable GetResult(List<int> lstNo)
        {
            try
            {
                ResultDataManagerDataContext db = new ResultDataManagerDataContext();
                Table<CnGeneral_Info> tbCnDocInfo = db.CnGeneral_Info;

                var result = from item in tbCnDocInfo
                             where lstNo.Contains(Convert.ToInt32(item.SerialNo))
                             orderby item.SerialNo descending
                             select new xmlDataInfo
                             {
                                 StrTitle = item.Title,
                                 StrApNo = item.ApNo,
                                 StrApDate = item.ApDate,
                                 StrANX = UrlParameterCode_DE.encrypt(item.ApNo.Trim()),  //add by xiwl
                                 StrIpc = item.Ipc1,
                                 StrSerialNo = item.SerialNo.ToString(),
                                 StrFtUrl = string.Format("http://search.patentstar.com.cn/bns/comm/getimg.aspx?idx={0}&Ty=CNG", UrlParameterCode_DE.encrypt(item.ApNo)),
                                 CPIC = item.SerialNo.ToString(),
                             };

                XmlParser xmlParser = new XmlParser("", "GB2312");
                CnIndexExtract cnIndexExtract = new CnIndexExtract();
                List<xmlDataInfo> lstxml = new List<xmlDataInfo>();
                //循环读取对应的XML补充其它字段数据信息
                foreach (var item in result)
                {
                    item.StrApNo = "198710002005";
                    String xmlpath = cnDataService.getAbsXmlFile(item.StrApNo);
                    // String xmlContent = FileChoose.EncryptString(System.IO.File.ReadAllText(xmlpath, System.Text.Encoding.GetEncoding("gb2312")), FileChoose.key);
                    using (StreamReader xmlreader = new StreamReader(xmlpath, Encoding.GetEncoding("gb2312")))
                    {
                        String xmlContent = xmlreader.ReadToEnd();
                        xmlContent = Util.StringUtil.ReplaceLowOrderASCIICharacters(xmlContent);
                        using (StringReader xmlString = new StringReader(xmlContent))
                        {
                            using (XmlReader reader = XmlReader.Create(xmlString, xmlParser.Settings, xmlParser.Context))
                            {
                                XDocument xRoot = XDocument.Load(reader, LoadOptions.None);
                                item.StrApNo = string.Format("{0}.{1}", item.StrApNo.Trim(), CnAppLicationNo.getValidCode(item.StrApNo)); //add by xiwl;
                                item.StrAgency = cnIndexExtract.getAgency(xRoot);
                                item.StrAnnDate = cnIndexExtract.getAnnouncementDate(xRoot);
                                item.StrAnnNo = cnIndexExtract.getAnnouncementNo(xRoot);
                                item.StrApply = cnIndexExtract.getApply(xRoot);
                                item.StrCountryCode = cnIndexExtract.getProvinceCode(xRoot);
                                item.StrFiled = cnIndexExtract.getField(xRoot);
                                item.StrInventor = cnIndexExtract.getInventor(xRoot);
                                item.StrPri = cnIndexExtract.getPriorNo(xRoot);
                                item.StrPubDate = getPubApdDate(cnIndexExtract.getPublicDate(xRoot), cnIndexExtract.getAnnouncementDate(xRoot));
                                item.StrPubNo = getPubApdNo(cnIndexExtract.getPublicNo(xRoot), cnIndexExtract.getAnnouncementNo(xRoot));
                                item.StrAbstr = cnIndexExtract.getAbstract(xRoot).Length >= 140 ? cnIndexExtract.getAbstract(xRoot).Substring(0, 140) : string.IsNullOrEmpty(cnIndexExtract.getAbstract(xRoot)) ? "无" : cnIndexExtract.getAbstract(xRoot);
                                item.StrClaim = cnIndexExtract.getMainClaim(xRoot);
                                item.Brief = GetBriefInfo(item.StrApNo);
                            }
                        }
                    }
                    lstxml.Add(item);
                }

                //paging... (LINQ)
                //IEnumerable ien = result.Skip((PageNumber - 1) * PageSize).Take(PageSize);
                IEnumerable ien = lstxml.DefaultIfEmpty();
                return ien;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                return null;
            }
        }