public string GetNextId(Db.ConnDb db) { if (ProcessMode == "download" || ProcessMode == "text-pagelist" || ProcessMode == "text-content" || ProcessMode == "text-GetNetfile" || ProcessMode == "text-PostNetfile") { if (maxid == null) { maxid = SrcBeginID; } if (Rows == null || activeindex == Rows.Count) { string sql = Sqltemp.Replace("[maxid]", maxid); DataSet ds = db.query(sql); Rows = ds.Tables[0].Rows; if (Rows.Count == 0) { return(null); } maxid = Rows[Rows.Count - 1][SrcID].ToString(); activeindex = 0; } if (activeindex < 0) { activeindex = 0; } if (activeindex < Rows.Count) { activeindex++; ActiveDatarow = Rows[activeindex - 1]; return(ActiveDatarow[SrcID].ToString()); } } else if (ProcessMode == "text-BeginEndIDNet" || ProcessMode == "BeginEndIDToDb") { if (activeindex < Bid) { activeindex = Bid; } if (activeindex > Eid) { return(null); } activeindex++; return((activeindex - 1).ToString()); } return(null); }
public bool InitData(string Mode = "") { //Src //string SrcID = xesrc.GetAttribute("SrcID"); //string SrcExp = xesrc.GetAttribute("SrcExp"); //string SrcBeginID = xesrc.GetAttribute("SrcStartID"); //string SrcEndID = xesrc.GetAttribute("SrcEndID"); //string ProcessMode = xesrc.GetAttribute("ProcessMode"); //string SavePath = xesrc.GetAttribute("SavePath"); //string nextpageBegin = xesrc.GetAttribute("PageListNextBegin"); //string nextpageEnd = xesrc.GetAttribute("NextPageEnd"); SrcID = xesrc.GetAttribute("SrcID"); SrcExp = xesrc.GetAttribute("SrcExp"); SrcBeginID = xesrc.GetAttribute("SrcStartID"); SrcEndID = xesrc.GetAttribute("SrcEndID"); ProcessMode = xesrc.GetAttribute("ProcessMode"); SavePath = xesrc.GetAttribute("SavePath"); NextpageBegin = xesrc.GetAttribute("PageListNextBegin"); NextpageEnd = xesrc.GetAttribute("NextPageEnd"); SrcDbTableName = xesrc.GetAttribute("SrcDbTableT"); CustomDown = xesrc.GetAttribute("CustomDown"); ///Dst //string ///DbSet //string Itembegin = GetItemBegin(xedbroot); //string Itemend = GetItemEnd(xedbroot); if (ProcessMode != "download" && Mode == "") { Itembegin = GetItemBegin(xedbroot); Itemend = GetItemEnd(xedbroot); } if (Mode == "ZD") { } //////DetailSet if (SrcExp.Contains("as")) { SrcExp = SrcExp.Substring(SrcExp.LastIndexOf("as") + 2).Trim(); } Inserttemple = ConstructInsertSqlTemple(xedbroot); Inserttemple = ReplaceInsertSqlTemple(xedst, Inserttemple); SrcBeginID = FormatBeginEndID(SrcBeginID); SrcEndID = FormatBeginEndID(SrcEndID); Sqltemp = "select top 1000 [SrcID],[SrcExp] from [SrcDbTableT] where [SrcID] > [maxid] order by [SrcID]"; Sqltemp = Sqltemp.Replace("[SrcID]", "[" + xesrc.GetAttribute("SrcID") + "]") .Replace("[SrcExp]", xesrc.GetAttribute("SrcExp")) .Replace("[SrcDbTableT]", "[" + xesrc.GetAttribute("SrcDbTableT") + "]"); if (SrcEndID != "0") { Sqltemp = Sqltemp.Replace("[maxid]", "[maxid] and [" + SrcID + "]<=" + SrcEndID + " "); } //逻辑判断 if ((NextpageBegin == "" || NextpageEnd == "") && ProcessMode == "text-pagelist") { return(false); } if (ProcessMode == "text-BeginEndIDNet" || ProcessMode == "BeginEndIDToDb" || Mode == "ZD") { Bid = Convert.ToInt32(SrcBeginID); Eid = Convert.ToInt32(SrcEndID); if (Bid < 0 || Bid > Eid || Eid == 0) { return(false); } } return(true); }