Exemplo n.º 1
0
        /// <summary>
        /// 得到某一结果文件的全部数据
        /// </summary>
        /// <param name="sp">检索式</param>
        /// <param name="SortExpression">排序</param>
        /// <returns>list int</returns>
        public IEnumerable GetResultList(SearchPattern sp, string SortExpression)
        {
            ResultServices res = new ResultServices();
            List<int> lstNo = res.GetResultList(sp, SortExpression);

            IEnumerable ien = GetResult(lstNo);

            return ien;
        }
Exemplo n.º 2
0
        /// <summary>
        /// 得到某一结果文件的某一页数据 并按某一字段排序
        /// </summary>
        /// <param name="sp">检索式</param>
        /// <param name="PageIndex">要取的页数</param>
        /// <param name="PageSize">页数大小</param>
        /// <param name="SortExpression">排序字段</param>
        /// <returns>list(int)</int></returns>
        public IEnumerable GetResultList(SearchPattern sp, int PageSize, int PageIndex, string SortExpression)
        {
            try
            {

                ResultServices res = new ResultServices();
                List<int> lstNo = res.GetResultListByEnd(sp, PageSize, PageIndex, SortExpression);
                IEnumerable ien = GetResult(lstNo);
                return ien;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                return null;
            }
        }
Exemplo n.º 3
0
        public ResultInfoWebService Search(string strPattern, int UserID, int nSNo, SearchDbType _SDbType)
        {
            SearchPattern schPatItem = new Cpic.Cprs2010.Search.SearchPattern();

            schPatItem.SearchNo = nSNo.ToString().PadLeft(3, '0');  //检索编号
            schPatItem.Pattern = strPattern;      //检索式:F XX 2010/AD
            schPatItem.UserId = UserID;   //用户ID
            schPatItem.DbType = _SDbType;

            SearchInterface.ClsSearch search = new SearchInterface.ClsSearch();
            ResultInfo res = search.DoSearch(SearchInterface.XmPatentComm.strWebSearchGroupName, strPattern, Convert.ToInt32(UserID), schPatItem.SearchNo, _SDbType);

            // Cpic.Cprs2010.Search.ResultInfo res = Cpic.Cprs2010.Search.SearchManager.SearchFactory.CreatDoSearch(schPatItem);

            ResultInfoWebService resultInfoWebService = new ResultInfoWebService();
            resultInfoWebService.ResultInfo = res;

            ResultServices result = new ResultServices();
            string resultFilePath = result.getResultFilePath(schPatItem);
            resultInfoWebService.ResultSearchFilePath = resultFilePath;

            return resultInfoWebService;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到某一结果文件的全部数据
        /// </summary>
        /// <param name="sp">检索式</param>
        /// <param name="SortExpression">排序</param>
        /// <returns>list int</returns>
        public IEnumerable GetResultList(SearchPattern sp, string SortExpression)
        {
            ResultDataManagerDataContext db = new ResultDataManagerDataContext();
            Table<DocdbFamilyInfo> tbCnDocInfo = db.DocdbFamilyInfo;

            ResultServices res = new ResultServices();
            List<int> lstNo = res.GetResultList(sp, SortExpression);

            var result = from item in tbCnDocInfo
                         where lstNo.Contains(Convert.ToInt32(item.CPIC))
                         select new
                         {
                             TI = item.Title,
                             AN = item.AppNo,
                             AD = item.AppDate,
                             IPC = item.IPC,
                         };

            //paging... (LINQ)
            //IEnumerable ien = result.Skip((PageNumber - 1) * PageSize).Take(PageSize);
            IEnumerable ien = result.DefaultIfEmpty();

            return ien;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 得到给定号单(成员)的结果数据 并按某一字段排序
        /// </summary>
        /// <param name="lstNo"></param>
        /// <returns></returns>
        public List<GeneralDataInfo> GetResulDoctListDataInfo(List<int> _lstNo, int PageSize, int PageIndex, string SortExpression)
        {
            try
            {
                ResultDataManagerDataContext db = new ResultDataManagerDataContext();
                Table<DocdbDocInfo> tbDocdbDocInfo = db.DocdbDocInfo;

                ResultServices res = new ResultServices();
                List<int> lstNo = (_lstNo.Skip((PageIndex - 1) * PageSize).Take(PageSize)).ToList();

                var result = from item in tbDocdbDocInfo
                             where lstNo.Contains(Convert.ToInt32(item.ID))
                             orderby item.ID descending
                             select new GeneralDataInfo
                             {
                                 StrTI = item.Title,
                                 StrPubID=item.PubID.Trim(),
                                 StrPtCode = UrlParameterCode_DE.encrypt(item.PubID.Trim()),  //add by xiwl
                                 StrAD = item.AppDate,
                                 StrIPC = item.IPC,
                                 NCPIC =Convert.ToInt64(item.CPIC), //add by wsx-->up by xiwl on 20120315 id>CPIC
                                 NID=item.ID,
                                 StrAN = item.AppNo,
                             };

                //paging... (LINQ)
                //IEnumerable ien = result.Skip((PageNumber - 1) * PageSize).Take(PageSize);
                List<GeneralDataInfo> ien = result.ToList<GeneralDataInfo>();
                return ien;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                return null;
            }
        }
Exemplo n.º 6
0
    private static string Merge(SearchPattern sp, string NodeId, string type, string stype)
    {
        ResultServices res = new ResultServices();
        List<int> fResult = res.GetResultList(sp, "");
        List<int> dbResult = ztHelper.GetResultList(NodeId,type);
        List<int> sresult ;
        if (stype == "1")
        {
            sresult = dbResult.Intersect(fResult).ToList<int>();
        }
        else
        {
            sresult = dbResult.Except(fResult).ToList<int>();
        }
        //结果文件绝对目录
        string file = res.getResultFilePath(sp).Replace(sp.SearchNo+ ".cnp","998.cnp");
        if (File.Exists(file)) File.Delete(file);

        using (FileStream fs = new System.IO.FileStream(file, FileMode.CreateNew))
        {
            foreach (var id in sresult)
            {
                byte[] fmlNo = BitConverter.GetBytes(id);
                fs.Write(fmlNo, 0, fmlNo.Length);
            }
        }
        return sresult.Count().ToString();
    }
Exemplo n.º 7
0
        /// <summary>
        /// 得到某一结果文件的某一页数据 并按某一字段排序
        /// </summary>
        /// <param name="sp">检索式</param>
        /// <param name="PageIndex">要取的页数</param>
        /// <param name="PageSize">页数大小</param>
        /// <param name="SortExpression">排序字段</param>
        /// <returns>list(int)</int></returns>
        public IEnumerable GetResultList(SearchPattern sp, int PageSize, int PageIndex, string SortExpression)
        {
            try
            {
                ResultDataManagerDataContext db = new ResultDataManagerDataContext();
                Table<DwpiAccessionNoSerialNo> tbCnDocInfo = db.DwpiAccessionNoSerialNo;

                ResultServices res = new ResultServices();
                List<int> lstNo = res.GetResultListByEnd(sp, PageSize, PageIndex, SortExpression);

                var result = from item in tbCnDocInfo
                             where lstNo.Contains(Convert.ToInt32(item.SerialNo))
                             orderby item.SerialNo descending
                             select new
                             {
                                 //TI = item.Title.Substring(0,100)+"......",//标题
                                 //AN = GetString(item.AppNo,";",1), //申请号
                                 //AD = GetString(item.PublicNo,";",3),//公开号
                                 //IPC = GetString(item.IPC,";",4),    //IPC
                                 //CPIC=item.AccessionNo, //入藏号
                                 TI = item.Title,//标题
                                 AN = item.AppNo, //申请号
                                 AD = item.PublicNo,//公开号
                                 IPC = item.IPC,    //IPC
                                 CPIC = item.AccessionNo, //入藏号
                             };

                //paging... (LINQ)
                //IEnumerable ien = result.Skip((PageNumber - 1) * PageSize).Take(PageSize);
                IEnumerable ien = result.DefaultIfEmpty();
                return ien;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                return null;
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string webPath = "W";  //外网
            string strTjUrl = getTjRul();

            if (strTjUrl.Contains("192.168"))
            {
                webPath = "N";
            }

            string url = strTjUrl + "PatentAnalyze/pages/reportQuery.page?fileName={0}&fileRowNum={1}&userId={2}&userCheckCode={3}&webPath=" + webPath;

            int CreateUserId = Convert.ToInt32(Session["Userid"].ToString());
            string db = (Request["db"] == null ? string.Empty : Request["db"]);
            string type = (Request["type"] == null ? string.Empty : Request["type"]);
            string Nm = (Request["Nm"] == null ? string.Empty : Request["Nm"]);
            type = type.ToUpper();
            string filename = "";
            string SearchNo = string.Empty;
            string id = (Request["id"] == null ? "0" : Request["id"].ToString());

            //判断检索类型 1:检索   2:专题库   3:收藏
            ResultServices s = new Cpic.Cprs2010.Search.ResultServices();
            SearchDbType t;
            List<int> lstid = new List<int>();
            switch (type)
            {
                case "CN":
                    type = "Cn";
                    SearchNo = id.ToString().PadLeft(3, '0');
                    break;
                case "EN":
                    type = "DocDB";
                    SearchNo = id.ToString().PadLeft(3, '0');
                    break;
                case "ZT":
                case "QY":
                    lstid = ztHelper.GetResultList(id, db);
                    SearchNo = id.ToString();
                    break;
                case "CO":
                    lstid = UserCollectsHelper.GetResultList(db, Convert.ToInt32(id));
                    SearchNo = id.ToString();
                    break;
                case "YJ0":
                    lstid = ProYJDLL.YJDB.getYJItemByWID(Convert.ToInt32(id), 0);
                    SearchNo = id.ToString();
                    type = type.Substring(0, 2);
                    break;
                case "YJ1":
                    lstid = ProYJDLL.YJDB.getYJItemByWID(Convert.ToInt32(id), 1);
                    SearchNo = id.ToString();
                    type = type.Substring(0, 2);
                    return;
            }
            t = (SearchDbType)Enum.Parse(typeof(SearchDbType), type);
            filename = s.getResultFilePathOnly(new SearchPattern() { DbType = t, UserId = CreateUserId, SearchNo = SearchNo });
            if (!Directory.Exists(Path.GetDirectoryName(filename)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(filename));
            }
            if (db.ToUpper() == "EN")
            {
                url = getTjRul() + "PatentAnalyze/pages/reportWorldQuery.page?fileName={0}&fileRowNum={1}&userId={2}&userCheckCode={3}&webPath=" + webPath;
            }
            switch (type)
            {
                case "ZT":
                case "QY":
                case "CO":
                case "YJ":
                    try
                    {
                        if (File.Exists(filename)) File.Delete(filename);
                        using (FileStream fsw = new FileStream(filename, FileMode.CreateNew, FileAccess.Write))
                        {
                            foreach (var x in lstid)
                            {
                                byte[] by = BitConverter.GetBytes(x);
                                fsw.Write(by, 0, by.Length);
                            }
                        }
                        Nm = lstid.Count.ToString();
                    }
                    catch (Exception)
                    {

                    }
                    break;
            }

            string strurl = string.Format(url, filename.Replace(CprsConfig.CPRS2010UserPath, ""), Nm, CreateUserId, "");
            ///Response.Redirect(strurl);
            ifst.Attributes["src"] = strurl;
        }
Exemplo n.º 9
0
        /// <summary>
        /// 得到某一结果文件的某一页数据 并按某一字段排序
        /// </summary>
        /// <param name="sp">检索式</param>
        /// <param name="PageIndex">要取的页数</param>
        /// <param name="PageSize">页数大小</param>
        /// <param name="SortExpression">排序字段</param>
        /// <returns>list(int)</int></returns>
        public List<xmlDataInfo> GetResultList(Cpic.Cprs2010.Search.SearchPattern sp, int PageSize, int PageIndex, string SortExpression)
        {
            List<xmlDataInfo> ien = new List<xmlDataInfo>();
            try
            {
                ResultServices res = new ResultServices();

                List<int> lstNo = res.GetResultListByEnd(sp, PageSize, PageIndex, SortExpression);
                if (sp.DbType == Cpic.Cprs2010.Search.SearchDbType.Cn)
                {
                    ien = GetResult(lstNo, "CN");
                }
                else if (sp.DbType == Cpic.Cprs2010.Search.SearchDbType.DocDB)
                {
                    ien = GetResult(lstNo, "DocDB");
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                //return null;
            }
            return ien;
        }
Exemplo n.º 10
0
    /// <summary>
    /// 对专题库节点添加检索式&并对检索式进行检索入库。
    /// 注:大于5000条的检索式 不允许插入。
    /// </summary>
    /// <param name="NodeId">节点id</param>
    /// <param name="SearchPattern">检索式</param>
    /// <param name="Hit">命中篇数</param>
    /// <param name="type">数据类型 cn en</param>
    /// <returns></returns>
    public static string addSearchPattern1(string NodeId, string SearchPattern, string Hit, string type, string zid)
    {
        string result = "succ";

        try
        {
            //检索
            int intCount = 0;
            //int userid = Convert.ToInt32(System.Web.HttpContext.Current.Session["Userid"].ToString());
            int userid = 1;
            SearchInterface.ClsSearch search = new SearchInterface.ClsSearch();
            string strHits = search.GetSearchDataHits("", SearchPattern, userid, type.ToUpper());
            if (strHits == "ERROR") return "ERROR";
            string strNo = string.Empty;
            if (strHits.IndexOf("(") >= 0 && strHits.IndexOf(")") > 0)
            {
                strNo = strHits.Substring(strHits.IndexOf("(") + 1, strHits.IndexOf(")") - strHits.IndexOf("(") - 1);
            }
            if (strHits.IndexOf("<hits:") >= 0 && strHits.IndexOf(">") > 0)
            {
                intCount = Convert.ToInt32(strHits.Substring(strHits.IndexOf("<hits:") + 6).Trim('>').Trim());
            }
            //判断结果是否太大
            if (intCount > 50000)
            {
                result = "对不起,检索式检索结果大于50000,请缩小修改检索式,缩小检索结果范围";
                return result;
            }
            //获取检索结果
            SearchPattern schPatItem = new SearchPattern();
            schPatItem.SearchNo = strNo; ;  //检索编号[001-999]
            //检索式:F XX 2010/AD
            schPatItem.UserId = userid;   //用户ID
            if (type.ToUpper() == "CN")
            {
                schPatItem.DbType = SearchDbType.Cn;
            }
            else
            {
                schPatItem.DbType = SearchDbType.DocDB;
            }
            ResultServices res = new ResultServices();
            List<int> lst = res.GetResultList(schPatItem, "");
            List<string> nodids = new List<string>();
            nodids.Add(NodeId);
            //添加到ztdb中
            using (SqlConnection conn = DBA.SqlDbAccess.GetSqlConnection())
            {
                conn.Open();
                SqlTransaction tran = conn.BeginTransaction();
                if (intCount > 0)
                {
                    //AddToTH(tran, lst, nodids, "检索式", userid.ToString(), type);
                    WriteZTCNP(NodeId, type, "0", lst);
                }
                string SQL = string.Format("insert into ztsp (Nid,sp,Hit,Type,isdel,zid) values ('{0}','{1}',{2},'{3}',0,'{4}')", NodeId, SearchPattern, intCount, type, zid);
                DBA.SqlDbAccess.ExecNoQuery(tran, CommandType.Text, SQL);
                tran.Commit();
            }

        }
        catch (Exception ex)
        {
            result = "失败:" + ex.Message;
        }
        return result;
    }
Exemplo n.º 11
0
    /// <summary>
    /// 更新专题库节点绑定的检索式
    /// </summary>
    /// <param name="id">检索式id</param>
    /// <param name="SearchPattern">检索式</param>
    /// <param name="Hit">命中篇数</param>
    /// <param name="nodeid">节点id</param>
    /// <param name="type">数据类型 cn en</param>
    /// <returns></returns>
    public static string UpdateSearchPattern(string id, string SearchPattern, int Hit, string nodeid, string type)
    {
        string result = "succ";
        try
        {
            //检索
            int intCount = 0;
            //int userid = Convert.ToInt32(System.Web.HttpContext.Current.Session["Userid"].ToString());
            int userid = 1;
            SearchInterface.ClsSearch search = new SearchInterface.ClsSearch();
            string strHits = search.GetSearchDataHits("", SearchPattern, userid, type.ToUpper());
            if (strHits == "ERROR") return "ERROR";
            string strNo = string.Empty;
            if (strHits.IndexOf("(") >= 0 && strHits.IndexOf(")") > 0)
            {
                strNo = strHits.Substring(strHits.IndexOf("(") + 1, strHits.IndexOf(")") - strHits.IndexOf("(") - 1);
            }
            if (strHits.IndexOf("<hits:") >= 0 && strHits.IndexOf(">") > 0)
            {
                intCount = Convert.ToInt32(strHits.Substring(strHits.IndexOf("<hits:") + 6, strHits.IndexOf(">") - strHits.IndexOf("<hits:") - 6).Trim());
            }
            //判断结果是否太大
            if (intCount > 5000)
            {
                result = "对不起,检索式检索结果大于5000,请修改检索式,缩小检索结果范围";
                return result;
            }
            //获取检索结果
            SearchPattern schPatItem = new SearchPattern();
            schPatItem.SearchNo = strNo; ;  //检索编号[001-999]
            //检索式:F XX 2010/AD
            schPatItem.UserId = userid;   //用户ID
            if (type.ToUpper() == "CN")
            {
                schPatItem.DbType = SearchDbType.Cn;
            }
            else
            {
                schPatItem.DbType = SearchDbType.DocDB;
            }
            ResultServices res = new ResultServices();
            List<int> lst = res.GetResultList(schPatItem, "");
            List<string> nodids = new List<string>();
            nodids.Add(nodeid);
            //
            // 更新 除了核心专利+来源是 “检索式” 的删除标记
            //
            using (SqlConnection conn = DBA.SqlDbAccess.GetSqlConnection())
            {
                conn.Open();
                ////删除旧的数据
                SqlTransaction trans = conn.BeginTransaction();
                //string delztdb = string.Format("update ztdb set isdel=1 where (iscore =0 and [Form] ='检索式') and Nid='{0}' and type='{1}'", nodeid, type);
                //DBA.SqlDbAccess.ExecNoQuery(trans, CommandType.Text, delztdb);

                ////添加新的数据
                //AddToTH(trans, lst, nodids, "检索式", userid.ToString(), type);
                WriteZTCNP(nodeid, type, "0", lst);

                //更新检索式
                string SQL = string.Format("update ztsp set sp ='{0}',Hit={1} where id={2}", SearchPattern.Replace("'", "''"), intCount, id.Replace("'", "''"));
                DBA.SqlDbAccess.ExecNoQuery(trans, CommandType.Text, SQL);

                trans.Commit();
            }

        }
        catch (Exception ex)
        {
            result = "failed";
        }
        return result;
    }
Exemplo n.º 12
0
        /// <summary>
        /// 得到某一结果文件的某一页数据 并按某一字段排序
        /// </summary>
        /// <param name="sp">检索式</param>
        /// <param name="PageIndex">要取的页数</param>
        /// <param name="PageSize">页数大小</param>
        /// <param name="SortExpression">排序字段</param>
        /// <returns>list(int)</int></returns>
        public List<GeneralDataInfo> GetResultListDocInfo(SearchPattern sp, int PageSize, int PageIndex, string SortExpression)
        {
            try
            {
                ResultServices res = new ResultServices();
                List<int> lstNo = res.GetResultList(sp, PageSize, PageIndex, SortExpression);

                List<GeneralDataInfo> ien = GetResulDoctListDataInfo(lstNo, lstNo.Count, 1, SortExpression);
                return ien;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                return null;
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 得到给定家族号单的结果数据 并按某一字段排序
        /// </summary>
        /// <param name="sp">检索式</param>
        /// <param name="PageIndex">要取的页数</param>
        /// <param name="PageSize">页数大小</param>
        /// <param name="SortExpression">排序字段</param>
        /// <returns>list(int)</int></returns>
        public List<GeneralDataInfo> GetResultFmlListDataInfo(List<int> _lstNo, int PageSize, int PageIndex, string SortExpression)
        {
            try
            {
                ResultDataManagerDataContext db = new ResultDataManagerDataContext();
                Table<DocdbFamilyInfo> tbCnDocInfo = db.DocdbFamilyInfo;

                ResultServices res = new ResultServices();
                List<int> lstNo = (_lstNo.Skip((PageIndex - 1) * PageSize).Take(PageSize)).ToList();

                var result = from item in tbCnDocInfo
                             where lstNo.Contains(Convert.ToInt32(item.CPIC))
                             select new GeneralDataInfo
                             {
                                 NCPIC = item.CPIC,
                                 StrTI = item.Title,
                                 StrAN = item.AppNo,
                                 StrAD = item.AppDate,
                                 StrIPC = item.IPC,
                                 NMembers = item.PubIDs.Length - (item.PubIDs.Replace(",", "").Length) + 1,//PIDNum = item.PubIDNum,
                                 //PubIds=item.PubIDs,
                                 //PubID = item.PubIDs.Contains(",") ? item.PubIDs.Substring(0, item.PubIDs.IndexOf(",")) : item.PubIDs,
                             };

                //paging... (LINQ)
                //IEnumerable ien = result.Skip((PageIndex - 1) * PageSize).Take(PageSize);
                List<GeneralDataInfo> ien = result.ToList<GeneralDataInfo>();
                return ien;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                return null;
            }
        }
Exemplo n.º 14
0
        public static string ExportData2(string type, string db, string id, string ColNames, string beginNum, string endNum, string strSort, string FileType)
        {
            try
            {
                int userid = Convert.ToInt32(System.Web.HttpContext.Current.Session["UserID"]);
                int bnum = Convert.ToInt32(beginNum) - 1;
                if (bnum < 0) bnum = 0;
                int endnum = Convert.ToInt32(endNum);
                int length = endnum - bnum;
                SearchInterface.ClsSearch search = new SearchInterface.ClsSearch();
                List<string> strcolnames = ColNames.Split('|').ToList<string>();
                List<int> listNo;
                List<int> fResult = new List<int>();
                switch (type.ToUpper())
                {
                    case "FI":
                    case "CN":
                    case "EN":
                        SearchPattern sp = new SearchPattern();
                        sp.SearchNo = id;
                        sp.Pattern = "";
                        if (db.ToUpper() == "CN")
                        {
                            sp.DbType = SearchDbType.Cn;
                        }
                        else
                        {
                            sp.DbType = SearchDbType.DocDB;
                        }
                        sp.UserId = userid;
                        ResultServices res = new ResultServices();
                        fResult = res.GetResultList(sp, "");
                        break;
                    case "ZT":
                    case "QY":
                        fResult = ztHelper.GetResultList(id, db);
                        break;
                    case "CO":
                        fResult = UserCollectsHelper.GetResultList(db, Convert.ToInt32(id));
                        break;
                    case "YJ0":
                    case "YJ1":
                        fResult = ProYJDLL.YJDB.getYJItemByWID(Convert.ToInt32(id), Convert.ToInt16(type.Substring(2).ToString()));
                        break;
                }

                listNo = fResult.Skip(bnum).Take(length).ToList<int>();
                List<xmlDataInfo> listXml = search.GetResult(listNo, db.ToUpper());
                string name = GlobalUtility.TimeRandomName() + "." + FileType;
                string strFileName = "/Images/Export/Patent" + name;
                string fullpath = System.Web.HttpContext.Current.Server.MapPath(strFileName);
                if (!Directory.Exists(Path.GetDirectoryName(fullpath)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(fullpath));
                }
                ExcelLib.NPOIHelper eh = new ExcelLib.NPOIHelper();

                fullpath = eh.DataTable2File(List2DataTable(listXml, ColNames, type, ""), fullpath, FileType);

                return name;
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToString());
                return "";
            }
        }