Exemplo n.º 1
0
        /// <summary>
        /// 将当前"网址设置表"数据插入新表
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int InsertWebsiteConfig2NewAndwho(DataTable data)
        {
            int result = 0;

            try
            {
                string         sql = "delete from t_website_config";
                UpdateDBHelper db  = new UpdateDBHelper(dbPath);
                db.ExecuteNonQuery(sql, null);

                sql = "INSERT INTO t_website_config(WebOrder,Name,URL)values(@WebOrder,@Name,@URL)";
                SQLiteParameter[] parameters = null;
                foreach (DataRow dr in data.Rows)
                {
                    parameters = new SQLiteParameter[] {
                        new SQLiteParameter("@WebOrder", dr["WebOrder"]),
                        new SQLiteParameter("@Name", dr["Name"]),
                        new SQLiteParameter("@URL", dr["URL"])
                    };
                    result += db.ExecuteNonQuery(sql, parameters);
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 将当前"提醒表"数据插入新表
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int InsertTixing2NewTixing(DataTable data)
        {
            int result = 0;

            try
            {
                string         sql = "delete from t_tixing";
                UpdateDBHelper db  = new UpdateDBHelper(dbPath);
                db.ExecuteNonQuery(sql, null);

                sql = "INSERT INTO t_tixing(Id,Time,Info)values(@Id,@Time,@Info)";
                SQLiteParameter[] parameters = null;
                foreach (DataRow dr in data.Rows)
                {
                    parameters = new SQLiteParameter[] {
                        new SQLiteParameter("@Id", dr["Id"]),
                        new SQLiteParameter("@Time", dr["Time"]),
                        new SQLiteParameter("@Info", dr["Info"])
                    };
                    result += db.ExecuteNonQuery(sql, parameters);
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 将当前"定时表"数据插入新表
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int InsertDingshi2NewDingshi(DataTable data)
        {
            int result = 0;

            try
            {
                string         sql = "delete from t_dingshi";
                UpdateDBHelper db  = new UpdateDBHelper(dbPath);
                db.ExecuteNonQuery(sql, null);

                sql = "INSERT INTO t_dingshi(Id,Frequency,Time,ExecEvents,FilePath)values(@Id,@Frequency,@Time,@ExecEvents,@FilePath)";
                SQLiteParameter[] parameters = null;
                foreach (DataRow dr in data.Rows)
                {
                    parameters = new SQLiteParameter[] {
                        new SQLiteParameter("@Id", dr["Id"]),
                        new SQLiteParameter("@Frequency", dr["Frequency"]),
                        new SQLiteParameter("@Time", dr["Time"]),
                        new SQLiteParameter("@ExecEvents", dr["ExecEvents"]),
                        new SQLiteParameter("@FilePath", dr["FilePath"])
                    };
                    result += db.ExecuteNonQuery(sql, parameters);
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 将当前"设置表"数据插入新表
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        public int InsertConfig2NewConfig(DataTable data)
        {
            int result = 0;

            try
            {
                string         sql = "delete from t_config";
                UpdateDBHelper db  = new UpdateDBHelper(dbPath);
                db.ExecuteNonQuery(sql, null);

                sql = "INSERT INTO t_config(Name,Value)values(@Name,@Value)";
                SQLiteParameter[] parameters = null;
                foreach (DataRow dr in data.Rows)
                {
                    parameters = new SQLiteParameter[] {
                        new SQLiteParameter("@Name", dr["Name"]),
                        new SQLiteParameter("@Value", dr["Value"])
                    };
                    result += db.ExecuteNonQuery(sql, parameters);
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return(result);
        }