Esempio n. 1
0
        public void getqry()
        {
            //try{
            string s = "select * from getallprocesses()";

            helper.hlpDbConnect1 db  = new helper.hlpDbConnect1(clsglobal.cn);
            coreprocess          txt = new coreprocess();
            var allrows = db.getmylist(s);

            if (allrows.Count > 0)
            {
                foreach (shlpMyDictionary a in allrows)
                {
                    if (a.getint("coreid") != txt.coreid)
                    {
                        txt.setcoreid(a.getint("coreid"));
                        getwebfile.rooturl = a.getvalue("rootlnk");
                    }
                    txt.queryid = a.getint("qryprocessid");
                    string strtbl = a.getvalue("storetable");
                    txt.processtxt(strtbl);
                }
                // running post download
                s = "exec [dbo].[spCleantblStore]";
                int res = db.getfirstint(s);
            }
            //}
            //catch (Exception e){}
        }
Esempio n. 2
0
 public bool loadallfinds()
 {
     if (clusterid > 0)
     {
         helper.hlpDbConnect1 db = new helper.hlpDbConnect1(clsglobal.cn);
         string s = "select * from dbo.fncGetAllFndsFromClusterId('" + clusterid + "') order by seq asc";
         try
         {
             var allfldrec = db.getmylist(s);
             if (allfldrec.Count > 0)
             {
                 foreach (shlpMyDictionary b in allfldrec)
                 {
                     onefind t = new onefind(b.getint("findid"));
                     allfnds.Add(b.getint("seq"), t);
                 }
             }
         }
         catch (Exception e)
         {
             return(false);
         }
     }
     return(true);
 }
Esempio n. 3
0
        public bool setfindid(int findid)
        {
            try{
                string s = "select * from fncGetFindTxtArray('" + (id = findid) + "') order by id asc, seq asc";
                helper.hlpDbConnect1 db = new helper.hlpDbConnect1(clsglobal.cn);
                var allrows             = db.getmylist(s);
                if (allrows.Count > 0)
                {
                    foreach (shlpMyDictionary a in allrows)
                    {
                        if (a.getint("id") == 1)
                        {
                            frs.Add(a.getvalue("txt"), a.getint("delid"));
                        }
                        else if (a.getint("id") == 2)
                        {
                            lst.Add(a.getvalue("txt"), a.getint("delid"));
                        }
                        else if (a.getint("id") == 3)
                        {
                            string txt = a.getvalue("txt");
                            toremove.Add(txt, a.getint("delid"));

                            /*
                             * int i = 0;
                             * string txt = a.getvalue("txt");
                             * if (int.TryParse(txt, out i))
                             *  {
                             *      if (i < 0) removekind = i;
                             *  }
                             * else
                             *  {
                             *      toremove.Add(txt);
                             *  }
                             */
                        }
                        else if (a.getint("id") == 4)
                        {
                            removekind = a.getint("seq");
                        }
                    }
                }
                return(true);
            }
            catch (Exception e)
            {
                msg = "Text Find error: " + e.Message;
                return(false);
            }
        }
Esempio n. 4
0
        public bool processtxt(string tbl)
        {
            // going through all query groups
            //string s = "select * from fncSelectAllSearchSkills()";

            string s = "select * from dbo.fcnGetQueryGyId('" + queryid + "')";

            helper.hlpDbConnect1 db = new helper.hlpDbConnect1(clsglobal.cn);
            var allrows             = db.getmylist(s);

            if (allrows.Count > 0)
            {
                foreach (shlpMyDictionary b in allrows)
                {
                    string lnk = "";
                    //int groupid = b.getint("groupid");
                    //setquerygroup(groupid);


                    setqueryvalues(b.getvalue("one"), b.getvalue("two"));
                    string pagelink = makelnk();
                    pagetxt = getwebfile.getonepage(pagelink);
                    string tmpmxlim = checkfnd.retrievedata(pagetxt, 0);
                    int    tstint   = 0;
                    if (int.TryParse(tmpmxlim, out tstint))
                    {
                        maxlimid = tstint;
                    }
                    else
                    {
                        maxlimid = 0;
                    }

                    int pageid = 0;
                    while (((curitemscnt == 0) && (maxlimid > 0)) || (curitemscnt < maxlimid))
                    {
                        processonetext(pagetxt, tbl, pageid, 1);
                        curitemscnt += itemsperpage;
                        pageid++;
                        pagetxt = getwebfile.getonepage(makelnk());
                    }
                }
            }
            return(true);
        }
Esempio n. 5
0
        public void setquerygroup(int qrygroupid)
        {
            // going through all query groups
            string s = "select * from fncQueryListByGroupId('" + qrygroupid + "')";

            helper.hlpDbConnect1 db = new helper.hlpDbConnect1(clsglobal.cn);
            var allrows             = db.getmylist(s);

            if (allrows.Count > 0)
            {
                foreach (shlpMyDictionary b in allrows)
                {
                    int    seq = b.getint("seqid");
                    string txt = b.getvalue("txt");
                    qrylst.Add(seq, txt);
                }
            }
        }
Esempio n. 6
0
        // kind 1 for checkbad, 2 - for checkgood
        public bool getcheckvalues(int groupid, int kind)
        {
            string s = "select * from [dbo].[fncGetAllfndText]('" + groupid + "') order by seq asc";

            helper.hlpDbConnect1 db = new helper.hlpDbConnect1(clsglobal.cn);
            var allrows             = db.getmylist(s);

            if (allrows.Count > 0)
            {
                foreach (shlpMyDictionary a in allrows)
                {
                    if (kind == 1)
                    {
                        checkbad.Add(a.getvalue("txt"));
                    }
                    else if (kind == 2)
                    {
                        checkgood.Add(a.getvalue("txt"));
                    }
                }
            }
            return(true);
        }
Esempio n. 7
0
        /*
         * public bool processtxt(string tbl)
         * {
         *  // going through all query groups
         *  //string s = "select * from fncSelectAllSearchSkills()";
         *
         *  string s = "select * from dbo.fcnGetQueryGyId('" + queryid + "')";
         *  helper.hlpDbConnect1 db = new helper.hlpDbConnect1(clsglobal.cn);
         *  var allrows = db.getmylist(s);
         *  if (allrows.Count > 0)
         *  {
         *      foreach (shlpMyDictionary b in allrows)
         *      {
         *          string lnk = "";
         *          //int groupid = b.getint("groupid");
         *          //setquerygroup(groupid);
         *
         *
         *          setqueryvalues(b.getvalue("one"), b.getvalue("two"));
         *          string pagelink = makelnk();
         *          pagetxt = getwebfile.getonepage(pagelink);
         *          string tmpmxlim = checkfnd.retrievedata(pagetxt);
         *          int tstint = 0;
         *          if (int.TryParse(tmpmxlim, out tstint))
         *          {
         *              maxlimid = tstint;
         *          }
         *          else
         *          {
         *              maxlimid = 0;
         *          }
         *          int recid = 0;
         *          int pageid = 0;
         *          while (((curitemscnt == 0) && (maxlimid > 0)) || (curitemscnt < maxlimid))
         *          {
         *              string tpage = pgfind.retrievedata(pagetxt);
         *              string seg = segfind.retrievedata(tpage);
         *              int cutfrom = segfind.greatestcut;
         *              while (!String.IsNullOrEmpty(seg))
         *              {
         *                  string storestr = "";
         *                  //int mxprocessed = 0;
         *                  foreach (onefindcluster a in allflds)
         *                  {
         *                      // if this is a link then replace the seg
         *                      if (a.clustkind == 1)
         *                      {
         *                          lnk = a.retrievedata(seg);
         *                          lnk = getwebfile.makelnk(lnk);
         *                          seg = getwebfile.getonepage(lnk);
         *                      }
         *                      else
         *                      {
         *                          a.retrievedata(seg);
         *                          if (a.valueisbad())
         *                          {
         *                              storestr = "";
         *                              break;
         *                          }
         *                          else
         *                          {
         *                          string vl = a.vl.Replace("'", "");
         *                              if (vl.Length > 7500)
         *                              {
         *                              vl = vl.Substring(0, 7500);
         *                              }
         *                              storestr += a.fldname + "flddel" + vl + "keydel" + a.iskey + "rowdel";
         *                          }
         *
         *                      }
         *                      // mxprocessed = a.lastindex;
         *                  }
         *                  if (!String.IsNullOrEmpty(storestr))
         *                  {
         *                      storetodb(storestr, tbl, coreid, lnk, queryid, pageid, recid);
         *                  }
         *                  int t = tpage.Length;
         *                  tpage = tpage.Substring(cutfrom);
         *                  seg = segfind.retrievedata(tpage);
         *                  cutfrom = segfind.greatestcut;
         *                  recid++;
         *                  if (recid > 22)
         *                  {
         *                      recid = recid;
         *                  }
         *              }
         *              curitemscnt += itemsperpage;
         *              pageid++;
         *              pagetxt = getwebfile.getonepage(makelnk());
         *          }
         *      }
         *  }
         *  return true;
         * }
         */
        public bool storetodb(string st, string tbl, int coreid, string lnk, int queryid, int pageid, int recid)
        {
            lnk = lnk.Replace("'", "");
            string s = "exec dbo.spstoreresult '" + tbl + "', '" + coreid + "', '" + lnk + "', '" + queryid + "', '" + pageid + "', '" + recid + "', '" + st + "'";

            try
            {
                helper.hlpDbConnect1 db = new helper.hlpDbConnect1(clsglobal.cn);
                int i = db.getfirstint(s);
                if (i == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                return(false);
            }
        }
Esempio n. 8
0
        public bool setcoreid(int idin)
        {
            if (idin > 0)
            {
                try{
                    string s = "select * from fctGetOneCore('" + (coreid = idin) + "')";
                    helper.hlpDbConnect1 db = new helper.hlpDbConnect1(clsglobal.cn);
                    var allrows             = db.getmylist(s);
                    if (allrows.Count > 0)
                    {
                        corestructid = allrows[0].getint("corestructid");
                        if (corestructid > 0)
                        {
                            s = "select * from fncGetCoreStruct('" + corestructid + "')";
                            var allfldrec = db.getmylist(s);
                            if (allfldrec.Count > 0)
                            {
                                foreach (shlpMyDictionary b in allfldrec)
                                {
                                    string txt = b.getvalue("text");
                                    int    seq = b.getint("seq");
                                    int    tp  = b.getint("type");
                                    KeyValuePair <string, int> ktmp = new KeyValuePair <string, int>(txt, tp);
                                    corestruct.Add(seq, ktmp);
                                }
                            }
                        }

                        navtype      = allrows[0].getint("navtype");
                        itemsperpage = allrows[0].getint("itemsperpage");
                        // getting all the finds
                        desc     = allrows[0].getvalue("descript");
                        pgfind   = new onefindcluster(allrows[0].getint("pagefindclustid"), "Page find");
                        segfind  = new onefindcluster(allrows[0].getint("segfindclustid"), "Segment find");
                        checkfnd = new onefindcluster(allrows[0].getint("checkfindclustid"), "Check find");
                        navfind  = new onefindcluster(allrows[0].getint("navfindclustid"), "Nav find");
                        allflds  = new List <onefindcluster>();
                        // loading fields
                        int fldgroupid = allrows[0].getint("fieldgroupid");
                        if (fldgroupid > 0)
                        {
                            s = "select * from fncFieldGetAllFieldInGroup('" + fldgroupid + "') order by seq asc";
                            var allfldrec = db.getmylist(s);
                            if (allfldrec.Count > 0)
                            {
                                foreach (shlpMyDictionary b in allfldrec)
                                {
                                    onefindcluster t = new onefindcluster(b.getint("findclusterid"),
                                                                          b.getvalue("fldname"), b.getint("fldkind"), b.getint("iskey"),
                                                                          b.getint("checkbadgroupid"), b.getint("goodgroupid")
                                                                          );
                                    allflds.Add(t);
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
            return(true);
        }