using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Project
{
    public static class DB
    {
        public static int ChangeRegExName(string oldname, string newname)
        {
            var sql = DBHelper.UpdateWhere("K4EE_Component_Reel_RegExRule",
                new Dictionary<string, object>(){
                    { "CustCode",newname }
                }, new Dictionary<string, object>()
                {
                    { "CustCode",oldname }
                });
            return sql;
        }
        public static int CopyRegEx(string oldname, string newname)
        {
            var sql = "insert into K4EE_Component_Reel_RegExRule(custcode,seq,description,symbol,pattern,groups,isenable,istrust,isamkstd,isignore)" +
                $" select '{newname}',seq,description,symbol,pattern,groups,isenable,istrust,isamkstd,isignore " +
                $" from K4EE_Component_Reel_RegExRule" +
               $" where custcode = '{oldname}'";
            return DBHelper.ExecuteNonQuery(sql);
        }
    }
}
