Exemplo n.º 1
0
 //点击复制发布规则按钮
 private void btnCopyPubConfig_Click(object sender, EventArgs e)
 {
     try
     {
         ListViewItem checkedItem = listViewPublish.CheckedItems[0];
         long         pubID       = long.Parse(checkedItem.SubItems[0].Text);
         string       pubName     = checkedItem.SubItems[1].Text;
         mySqlDB      myDB        = new mySqlDB(_coConnString);
         string       sResult     = "";
         int          count       = 0;
         long         LastInsertedId;
         string       sql = "insert into pub_config(pub_name,co_typeid,co_typename,pub_typeid,pub_typename,pub_nums,random_date_start,random_date_stop)";
         sql   = sql + " select pub_name,co_typeid,co_typename,pub_typeid,pub_typename,pub_nums,random_date_start,random_date_stop";
         sql   = sql + " from pub_config where id = '" + pubID.ToString() + "'";
         count = myDB.executeDMLSQL(sql, ref sResult);
         if (sResult == mySqlDB.SUCCESS && count == 1)
         {
             LastInsertedId = myDB.LastInsertedId;
             MessageBox.Show(string.Format("复制成功!复制的发布规则ID为:{0}", LastInsertedId));
             string sqlRename = "update pub_config set pub_name = '" + pubName + "复件'" + " where id ='" + LastInsertedId.ToString() + "'";
             count = myDB.executeDMLSQL(sqlRename, ref sResult);
             loadPubConfig();
         }
         else
         {
             MessageBox.Show(string.Format("复制失败:{0}", sResult));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("请选择需要复制的发布规则项!");
     }
 }
Exemplo n.º 2
0
 //复制采集规则
 private void btnCopyCoconfig_Click(object sender, EventArgs e)
 {
     try
     {
         ListViewItem checkedItem = listViewCollect.CheckedItems[0];
         long         cid         = long.Parse(checkedItem.SubItems[0].Text);
         string       coName      = checkedItem.SubItems[1].Text;
         mySqlDB      myDB        = new mySqlDB(_coConnString);
         string       sResult     = "";
         int          count       = 0;
         long         LastInsertedId;
         string       sql = "insert into co_config(co_name,type_name,source_lang,source_site,co_offline,list_path,more_list_pages,xpath_arcurl_node,";
         sql   = sql + " xpath_title_node,xpath_content_node,arc_subpage_symbol,arc_subpage_startnum,sub_node_params,regex_params) ";
         sql   = sql + " select co_name,type_name,source_lang,source_site,co_offline,list_path,more_list_pages,xpath_arcurl_node,";
         sql   = sql + "xpath_title_node,xpath_content_node,arc_subpage_symbol,arc_subpage_startnum,sub_node_params,regex_params";
         sql   = sql + " from co_config where cid = '" + cid.ToString() + "'";
         count = myDB.executeDMLSQL(sql, ref sResult);
         if (sResult == mySqlDB.SUCCESS && count == 1)
         {
             LastInsertedId = myDB.LastInsertedId;
             MessageBox.Show(string.Format("复制成功!复制的采集规则ID为:{0}", LastInsertedId));
             string sqlRename = "update co_config set co_name = '" + coName + "复件'" + " where cid ='" + LastInsertedId.ToString() + "'";
             count = myDB.executeDMLSQL(sqlRename, ref sResult);
             loadCoConfig();
         }
         else
         {
             MessageBox.Show(string.Format("复制失败:{0}", sResult));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("请选择需要复制的采集规则项!");
     }
 }