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){} }
/* * 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); } }