static void Main() { try { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //判断是否有权限使用该程序,“ select * from [dbo].[ip_agency_data] where [ip_sourcename] ='登陆权限验证' ” var entityList = new List <ip_agency_data>(); using (var dbConnection = BaseConfig.GetSqlConnection()) { entityList = dbConnection.Query <ip_agency_data>(c => c.ip_sourcename == "登陆权限验证").ToList(); } if (entityList.Count() > 0) { Application.Run(new TaobaoCrawlerSmallTools()); } else { MessageBox.Show("您已无权使用该插件。", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { throw; } }
/// <summary> /// 插入到数据库 /// </summary> /// <param name="info">info</param> public static void Add_IPAddress(ip_agency_data info) { using (var dbConnection = BaseConfig.GetSqlConnection()) { var result = dbConnection.Insert <ip_agency_data>(info); System.Console.WriteLine($"{info.ip_address}:{info.ip_port} , 已加入到数据库。"); } }