public static string Login(string UserName, string PassWord) { try { IList <UserEntity> users = DtToList <UserEntity> .ConvertToModel(SqlHelp.SelectAllQQ()); var user = users.FirstOrDefault(x => x.QQ == UserName); if (user == null) { return("此QQ非暗影岛轰炸机成员!"); } if (user.State == 1) { return("登录成功!"); } else { return("此QQ没有开放查看权限!!!"); } } catch (Exception ex) { return(ex.ToString()); } }
static void DeleteBind() { System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start();//开始计时 DataTable dt = MySQLHelper.Query("SELECT z.id,z.zone,z.userid,CASE when d.maxfensheng<1 then 0 else 1 end as level,z.nsstate,z.active,z.forcestop,z.rzone from zones as z left join domainlevel as d on z.DomainLevel=d.levelvalue where z.zone<>z.rzone").Tables[0]; List <zones> zonesList = DtToList <zones> .ConvertToModel(dt); Console.WriteLine("GetDataTabel from mysql count={1} Use Time={0};", watch.ElapsedMilliseconds, dt.Rows.Count); List <ZonesSimple>[] ala = new List <ZonesSimple>[16] { new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>(), new List <ZonesSimple>() }; var client = DriverConfiguration.Client; var db = client.GetDatabase(DriverConfiguration.DatabaseNamespace.DatabaseName); foreach (zones z in zonesList) { ZonesSimple zs = Zones2ZonesSimple(z); ala[Int32.Parse(zs.rrcol, System.Globalization.NumberStyles.HexNumber)].Add(zs); } string del = ""; try { for (int i = 0; i < 16; i++) { string rrcol = i.ToString("x"); IMongoCollection <AuthoritiesSimple> collection = db.GetCollection <AuthoritiesSimple>(rrcol); Console.WriteLine(rrcol + " " + ala[i].Count); List <string> domainList = new List <string>(); int count = 0; foreach (ZonesSimple zs in ala[i]) { domainList.Add(zs.domain); count++; if (domainList.Count == 100 || count == ala[i].Count) { DeleteResult result = collection.DeleteMany(Builders <AuthoritiesSimple> .Filter.In("domain", domainList)); domainList.Clear(); Console.WriteLine(count); } } Console.WriteLine("deal " + rrcol); } } catch (Exception ex) { string messget = ex.Message; } Console.WriteLine("end deal "); }
protected void btnLogin_Click(object sender, EventArgs e) { IList <UserEntity> users = DtToList <UserEntity> .ConvertToModel(SqlHelp.SelectAllQQ()); var user = users.FirstOrDefault(x => x.QQ == txtLogin.Text); if (user == null) { lbl0.Text = "此QQ非暗影岛轰炸机成员!"; return; } if (user.State == 1) { panel_hd.Visible = false; Panel4.Visible = true; LoginStatus = true; GridView1.Visible = true; lbl0.Visible = false; Panel1.Visible = false; this.Title = "欢迎回来!"; } else { lbl0.Text = "此QQ没有开放查看权限!!!"; } //if (Login(txtLogin.Text)) //{ // GridView1.Visible = true; // Panel1.Visible = false; // lbl0.Visible = false; //} //else //{ // lbl0.Text = "You dont have 权限!"; //} }
static void CheckZonesCount() { DataTable dtid = MySQLHelper.Query("select min(id),max(id) from zones").Tables[0]; long min = Convert.ToInt32(dtid.Rows[0][0]); long max = Convert.ToInt32(dtid.Rows[0][1]); System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start();//开始计时 long index = 3282504; do { DataTable dt = MySQLHelper.Query("SELECT z.id,z.zone,z.userid,0 as level,z.nsstate from zones as z where z.id between " + (index - 1000) + " and " + index + "").Tables[0]; List <zones> zl = DtToList <zones> .ConvertToModel(dt); var client = DriverConfiguration.Client; var db = client.GetDatabase(DriverConfiguration.DatabaseNamespace.DatabaseName); IMongoCollection <ZonesSimple> collection = db.GetCollection <ZonesSimple>("zones"); foreach (zones z in zl) { ZonesSimple zs = Row2ZoneSimple(z); var builder = Builders <ZonesSimple> .Filter; long c = collection.Find <ZonesSimple>(builder.And(builder.Eq("domain", zs.domain))).Count(); if (c > 1) { Console.WriteLine(zs.domain + " count=" + c); } } index = index - 1001; Console.WriteLine("min={0};max={1};index={2}; Use time={3};", min, max, index, watch.ElapsedMilliseconds); Console.WriteLine("=============================================="); } while (index < max); Console.WriteLine("End min={0};max={1};index={2};use time {3}", min, max, index, watch.ElapsedMilliseconds); watch.Stop();//停止计时 }
static void Main(string[] args) { try { System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start();//开始计时 DataTable dtz = MySQLHelper.Query("SELECT * from zones where id=3118661").Tables[0]; DataTable dta = MySQLHelper.Query("SELECT * from authorities where zoneid=3118661").Tables[0]; DataTable dtd = MySQLHelper.Query("SELECT * from dnsrecords where zoneid=3118661").Tables[0]; List <Zones> zonesList = DtToList <Zones> .ConvertToModel(dtz); Zones zone = zonesList[0]; ZonesEntity ze = new ZonesEntity(); ze.id = Utility.StringHelper.CalculateMD5Hash(zone.Zone + ".").ToLower(); ze.userid = Convert.ToInt32(zone.UserID); ze.domain = zone.Zone; ze.level = zone.DomainLevel > 0 ? 1 : 0; ze.nsstate = zone.NSState; ze.is_stop = zone.Active == "Y" ? "N" : "Y"; ze.force_stop = zone.ForceStop; ze.rdomain = zone.RZone; List <AuthEntity> alist = new List <AuthEntity>(); foreach (DataRow dr in dta.Rows) { AuthEntity ae = new AuthEntity(); ae.rid = Convert.ToInt32(dr["id"]); ae.domain = ze.domain; ae.name = dr["host"].ToString(); ae.type = dr["type"].ToString(); if (ae.type == "SOA") { //Mbox,Serial,Refresh,Retry,Expire,Minimum ae.rdata = dr["data"].ToString() + " " + dr["mbox"].ToString() + " " + dr["serial"].ToString() + " " + dr["refresh"].ToString() + " " + dr["retry"].ToString() + " " + dr["expire"].ToString() + " " + dr["minimum"].ToString(); } else { ae.rdata = dr["data"].ToString(); } ae.ttl = Convert.ToInt32(dr["ttl"]); ae.view = "Def"; ae.view = "Y"; alist.Add(ae); } List <RecordEntity> rlist = new List <RecordEntity>(); foreach (DataRow dr in dtd.Rows) { RecordEntity re = new RecordEntity(); re.rid = Convert.ToInt32(dr["id"]); re.domain = ze.domain; re.name = dr["host"].ToString(); re.type = dr["type"].ToString(); if (re.type == "MX") { //Mbox,Serial,Refresh,Retry,Expire,Minimum re.rdata = dr["mx_priority"].ToString() + " " + dr["data"].ToString(); } else if (re.type == "TXT") { re.rdata = dr["data"].ToString().Replace("\"", string.Empty); } else { re.rdata = dr["data"].ToString(); } re.ttl = Convert.ToInt32(dr["ttl"]); re.view = dr["view"].ToString(); re.view = dr["active"].ToString() == "Y" ? "N" : "Y"; rlist.Add(re); } ze.authorities = alist; ze.records = rlist; var client = DriverConfiguration.Client; var db = client.GetDatabase(DriverConfiguration.DatabaseNamespace.DatabaseName); IMongoCollection <ZonesEntity> categories = db.GetCollection <ZonesEntity>("ZonesEntiy"); categories.InsertOne(ze); Console.WriteLine("MongoDB Inserted; Use time={0};", watch.ElapsedMilliseconds); watch.Stop();//停止计时 } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void ReMoMain() { List <TempZoneID> temp4 = DtToList <TempZoneID> .ConvertToModel(MySQLHelper.Query("select id as zoneid from Temp where type=4").Tables[0]); DataTable dtid = MySQLHelper.Query("select min(id),max(id) from zones").Tables[0]; long min = Convert.ToInt32(dtid.Rows[0][0]); long max = Convert.ToInt32(dtid.Rows[0][1]); System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); watch.Start();//开始计时 long index = max; do { DataTable dt = MySQLHelper.Query("SELECT z.id,z.zone,z.userid,CASE when d.maxfensheng<1 then 0 else 1 end as level,z.nsstate from zones as z left join domainlevel as d on z.DomainLevel=d.levelvalue where z.userid<>348672 and z.Active='Y' and z.ForceStop='N' and z.id between " + (index - 1000) + " and " + index + "").Tables[0]; List <zones> zonesList = DtToList <zones> .ConvertToModel(dt); List <zones> zl = new List <zones>(); foreach (zones z in zonesList) { if (temp4.FindAll(tz => tz.zoneid == z.id).Count == 0) { zl.Add(z); } } Console.WriteLine("Data Filter;Use time={0};", watch.ElapsedMilliseconds); List <ZonesSimple> zslist = new List <ZonesSimple>(); List <AuthoritiesSimple>[] ala = new List <AuthoritiesSimple>[16] { new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>(), new List <AuthoritiesSimple>() }; List <DnsRecordsSimple>[] dla = new List <DnsRecordsSimple>[16] { new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>(), new List <DnsRecordsSimple>() }; foreach (zones z in zl) { ZonesSimple zs = Row2ZoneSimple(z); zslist.Add(zs); string rrcol = StringHelper.CalculateMD5Hash(zs.domain).ToLower().Substring(0, 1); // DataSet ds = MySQLHelper.Query("select id,zone,host,data,type,ttl,mbox,serial,refresh,retry,expire,minimum ," + z.userid + " as userid from authorities where zoneid=" + z.id + " order by type;" + "select id,zoneid,zone,host,type,data,ttl,view,mx_priority,userid from dnsrecords where active='Y'and type<>'PTR' and zoneid= " + z.id + ";"); DataTable adt = ds.Tables[0]; DataTable rdt = ds.Tables[1]; // List <authorities> alist = new List <authorities>(); List <AuthoritiesSimple> aslist = new List <AuthoritiesSimple>(); if (adt.Rows.Count > 0) { aslist = Row2Authorities(DtToList <authorities> .ConvertToModel(adt)); } else { break; } // List <dnsrecords> dlist = DtToList <dnsrecords> .ConvertToModel(rdt); List <DnsRecordsSimple> dslist = new List <DnsRecordsSimple>(); List <dnsrecords> wrongList = new List <dnsrecords>(); foreach (dnsrecords d in dlist) { if (CheckRecordData(d.data, d.type, d.view, d.host) && CheckRecordHost(d.host, d.type)) { dslist.Add(Row2DnsRecords(d)); } else { //记录违法的records wrongList.Add(d); } } } index = index - 1001; Console.WriteLine("Mongo Insert Success; Use time={0};", watch.ElapsedMilliseconds); DnsUpdateInsert(zl); Console.WriteLine("UpdateQueue Insert Success; Use time={0};", watch.ElapsedMilliseconds); Console.WriteLine("min={0};max={1};index={2};", min, max, index); Console.WriteLine("=============================================="); } while (index < max); Console.WriteLine("End min={0};max={1};index={2};use time {3}", min, max, index, watch.ElapsedMilliseconds); watch.Stop();//停止计时 }