public int DeleteTimedEvent(int id)
        {
            int result = 0;

            try
            {
                string            sql        = string.Empty;
                SQLiteParameter[] parameters = null;

                if (-1 == id)
                {
                    sql        = "delete from t_dingshi where Frequency='仅一次' and Time < @Time";
                    parameters = new SQLiteParameter[] {
                        new SQLiteParameter("@Time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                    };
                }
                else
                {
                    sql        = "delete from t_dingshi where Id = @Id";
                    parameters = new SQLiteParameter[] {
                        new SQLiteParameter("@Id", id)
                    };
                }
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return(result);
        }
Exemple #2
0
        public int AddRili(Rili rili)
        {
            int result = 0;

            try
            {
                string sql = "INSERT INTO t_rili(Yangli,Nongli,Zhigan,Xingzuo,Xingqi,Yi,Ji)values(@Yangli,@Nongli,@Zhigan,@Xingzuo,@Xingqi,@Yi,@Ji)";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Yangli", rili.Yangli),
                    new SQLiteParameter("@Nongli", rili.Nongli),
                    new SQLiteParameter("@Zhigan", rili.Zhigan),
                    new SQLiteParameter("@Xingzuo", rili.Xingzuo),
                    new SQLiteParameter("@Xingqi", rili.Xingqi),
                    new SQLiteParameter("@Yi", rili.Yi),
                    new SQLiteParameter("@Ji", rili.Ji)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception ex)
            {
                Log.Error("插入日历数据出错:" + ex.ToString());
            }
            return(result);
        }
        public int ClearConfigWebsite()
        {
            int result = 0;

            try
            {
                string    sqlString = @"delete from t_website_config";
                SqlAction action    = new SqlAction();
                result = action.IntQuery(sqlString, null);
            }
            catch
            {
            }
            return(result);
        }
        public int ClearCityData()
        {
            int result = 0;

            try
            {
                string    sql    = "delete from t_city";
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, null);
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return(result);
        }
        public int DeleteNotepad(string createTime)
        {
            int result = 0;

            try
            {
                string            sql        = "delete from t_notepad where CreateTime=@CreateTime";
                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@CreateTime", createTime)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
        public int DeleteReminderById(int id)
        {
            int result = 0;

            try
            {
                string sql = "delete from t_tixing where Id = @Id";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Id", id)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return(result);
        }
        public int DeleteReminderExpired(DateTime now)
        {
            int result = 0;

            try
            {
                string sql = "delete from t_tixing where Time < @Time";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Time", now.ToString("yyyy-MM-dd HH:mm:ss"))
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return(result);
        }
        public int UpdateConfig(string name, string value)
        {
            int result = 0;

            try
            {
                string sql = "update t_config set Value=@Value where  Name=@Name";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Name", name),
                    new SQLiteParameter("@Value", value)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return(result);
        }
        public int AddConfigWebsite(string webOrder, string name, string url)
        {
            int result = 0;

            try
            {
                string sql = "INSERT INTO t_website_config(WebOrder,Name,URL)values(@WebOrder,@Name,@URL)";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@WebOrder", webOrder),
                    new SQLiteParameter("@Name", name),
                    new SQLiteParameter("@URL", url)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return(result);
        }
        public int AddReminder(Reminder reminder)
        {
            int result = 0;

            try
            {
                string sql = "INSERT INTO t_tixing(Id,Time,Info)values(@Id,@Time,@Info)";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Id", reminder.ReminderId),
                    new SQLiteParameter("@Time", reminder.ReminderTime.ToString("yyyy-MM-dd HH:mm:ss")),
                    new SQLiteParameter("@Info", reminder.ReminderInfo)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return(result);
        }
        public int InsertCityData(City city)
        {
            int result = 0;

            try
            {
                string sql = "INSERT INTO t_city(Name,ShengParent,ShiParent,Code)values(@Name,@ShengParent,@ShiParent,@Code)";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Name", city.Name),
                    new SQLiteParameter("@ShengParent", city.ShengParent),
                    new SQLiteParameter("@ShiParent", city.ShiParent),
                    new SQLiteParameter("@Code", city.Code)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return(result);
        }
        public int InsertWebsiteData(Website website)
        {
            int result = 0;

            try
            {
                string sql = "INSERT INTO t_website(WebOrder,Type,Name,URL)values(@WebOrder,@Type,@Name,@URL)";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@WebOrder", website.Index),
                    new SQLiteParameter("@Type", website.Type),
                    new SQLiteParameter("@Name", website.Name),
                    new SQLiteParameter("@URL", website.Url)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
            return(result);
        }
        public int UpdateNotepad(string createTime, string title, string content)
        {
            int result = 0;

            try
            {
                string sql = "update t_notepad set Title=@Title,UpdateTime=@UpdateTime,Content=@Content where CreateTime=@CreateTime";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Title", title),
                    new SQLiteParameter("@CreateTime", createTime),
                    new SQLiteParameter("@UpdateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                    new SQLiteParameter("@Content", content)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
        public int AddNotepad(string title, string content)
        {
            int result = 0;

            try
            {
                string sql = "INSERT INTO t_notepad(Title,CreateTime,UpdateTime,Content)values(@Title,@CreateTime,@UpdateTime,@Content)";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Title", title),
                    new SQLiteParameter("@CreateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                    new SQLiteParameter("@UpdateTime", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                    new SQLiteParameter("@Content", content)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
        public int AddTimedEvent(TimedEvent timerEvent)
        {
            int result = 0;

            try
            {
                string sql = "INSERT INTO t_dingshi(Id,Frequency,Time,ExecEvents,FilePath)values(@Id,@Frequency,@Time,@ExecEvents,@FilePath)";

                SQLiteParameter[] parameters = new SQLiteParameter[] {
                    new SQLiteParameter("@Id", timerEvent.Id),
                    new SQLiteParameter("@Frequency", timerEvent.Frequency),
                    new SQLiteParameter("@Time", timerEvent.Time.ToString("yyyy-MM-dd HH:mm:ss")),
                    new SQLiteParameter("@ExecEvents", timerEvent.ExecEvents),
                    new SQLiteParameter("@FilePath", timerEvent.FilePath)
                };
                SqlAction action = new SqlAction();
                result = action.IntQuery(sql, parameters);
            }
            catch
            {
            }
            return(result);
        }