/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.SpiderInfo model) { string startUrl = model.start_urls; string loginUrl = model.login_url; string customData = model.customdata; string ruleData = model.ruledatas; if (startUrl != "") { startUrl = model.start_urls.Replace(@"'", @"\'"); } if (loginUrl != null) { loginUrl = model.login_url.Replace(@"'", @"\'"); } if (customData != "") { customData = model.customdata.Replace(@"'", @"\'"); } if (ruleData != "") { ruleData = model.ruledatas.Replace(@"'", @"\'"); } StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SpiderInfo("); strSql.Append("spiderName,website,files_store,start_urls,allowed_domains,rules,class,loader,away,login_url,_account,customdata,cls,ruledatas,cookies)"); strSql.Append(" values ("); string values = "'" + model.spidername + "','" + model.website + "','" + model.file_store + "',\"" + startUrl + "\",'" + model.allowed_domains + "','" + model.rules + "','" + model._class + "','" + model.loader + "','" + model.away + "',\"" + loginUrl + "\",'" + model.account + "','" + customData + "','" + model.cls + "','" + ruleData + "','" + model.cookies + "')"; strSql.Append(values); int rows = mshelper.InsertSQl(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.Mission model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into Mission("); strSql.Append("spidername,status,userid,PRI)"); strSql.Append(" values ("); string values = "'" + model.spidername + "','" + model.status + "','" + model.userid + "','" + model.pri + "')"; strSql.Append(values); int rows = mshelper.InsertSQl(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.ExceptionInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into exceptionInfo("); strSql.Append("spiderName,exceptionContent)"); strSql.Append(" values ("); string values = "'" + model.spidername + "','" + model.exceptioncontent + "')"; strSql.Append(values); int rows = mshelper.InsertSQl(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.HoneyInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into HoneyInfo("); strSql.Append("spidername,server,port,user,password,DBname,sqltype)"); strSql.Append(" values ("); string values = "'" + model.spidername + "','" + model.server + "','" + model.port + "','" + model.user + "','" + model.password + "','" + model.dbname + "','" + model.sqltype + "')"; strSql.Append(values); int rows = mshelper.InsertSQl(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.User model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into User("); strSql.Append("UserID,UserStatus)"); strSql.Append(" values ("); string values = "'" + model.userid + "','" + model.userstatus + "')"; strSql.Append(values); int rows = mshelper.InsertSQl(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public bool Add(Model.MissionInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into missioninfo("); strSql.Append("spiderName,failPages,endTime,startTime,completePages,threadCounts,failCount_getdata,failCount_savedata,failCount_linkre)"); strSql.Append(" values ("); string values = "'" + model.spidername + "'," + model.failpages + "," + model.endtime + "," + model.starttime + "," + model.completepages + "," + model.threadcounts + "," + model.failcount_getdata + "," + model.failcount_savedata + "," + model.failcount_linkre + ")"; strSql.Append(values); int rows = mshelper.InsertSQl(strSql.ToString()); if (rows > 0) { return(true); } else { return(false); } }