Example #1
0
        public static void AddUrlList(UrlList urlList)
        {
            try
            {
                string           sql       = "INSERT INTO urllist (URL,ImgName,Type,Status,DownLoad,TaskID) SELECT @URL, @ImgName,@Type,@Status,@DownLoad,@TaskID FROM DUAL WHERE NOT EXISTS (SELECT URL FROM urllist WHERE Type=@Type And TaskID=@TaskID And ImgName=@ImgName)";
                MySqlParameter[] Parameter = new MySqlParameter[6];
                Parameter[0] = new MySqlParameter("@URL", urlList.URL);
                Parameter[1] = new MySqlParameter("@ImgName", urlList.ImgName);
                Parameter[2] = new MySqlParameter("@Type", urlList.Type);
                Parameter[3] = new MySqlParameter("@Status", urlList.Status);
                Parameter[4] = new MySqlParameter("@DownLoad", urlList.DownLoad);
                Parameter[5] = new MySqlParameter("@TaskID", urlList.TaskID);

                bool res = Insert(sql, Parameter);
                if (res)
                {
                    Console.WriteLine("成功添加到urllist表:" + urlList.TaskID);
                }
            }
            catch (Exception ex)
            {
                File.AppendAllText("false.txt", ex.ToString() + "\r\n");
                Console.WriteLine(ex);
            }
        }
Example #2
0
        private static void ToUrlList(int Type, int DownLoad, int Status, Img item)
        {
            UrlList urlList = new UrlList();

            urlList.Type     = Type;
            urlList.TaskID   = item.ID;
            urlList.URL      = item.URL;
            urlList.ImgName  = item.ImgName;
            urlList.DownLoad = DownLoad;
            urlList.Status   = Status;
            TaskList.AddUrlList(urlList);
        }