Exemplo n.º 1
0
 /// <summary>
 /// 获取计划 (默认获取所有计划)
 /// </summary>
 /// <returns></returns>
 public static List <string[]> SearchPlan(string sele = "SELECT * FROM PlanTB")
 {
     SQLiteDB.Open();
     return(SQLiteDB.Run(sele, (list) => {
         return SQLiteDB.SaveData(SQLiteDB.sdr, list);
     }, new List <string[]>()));
 }
Exemplo n.º 2
0
        /// <summary>
        /// 搜索今日计划
        /// </summary>
        public static void SearchForTodayPlan(List <string[]> PlanDatas, List <p_Plan> Plans, FlowLayoutPanel flp_Plan)
        {
            Tools.PlanDataLock = true;
            SQLiteDB.Open();
            //2019-09-20 12:28:18.000
            string   DoW  = DateTime.Now.DayOfWeek.ToString("d") == "0" ? "7" : DateTime.Now.DayOfWeek.ToString("d"); //判断是否为周日
            DateTime dt1  = DateTime.Now.Date;
            DateTime dt2  = dt1.AddDays(1);                                                                           // 查询重复的
            string   sele = $"SELECT * FROM PlanTB WHERE datetime(PlanDateTime) >= datetime('{dt1.ToString("yyyy-MM-dd HH:mm")}') and datetime(PlanDateTime) <= datetime('{dt2.ToString("yyyy-MM-dd HH:mm")}') and  RepetitionPeriod = -1 or RepetitionPeriod = 0 or RepetitionPeriod = 1 and RepetitionDays like '%,{DoW},%' or RepetitionPeriod = 2 and RepetitionDays like '%,{DateTime.Now.Day},%';";

            //sele = "SELECT * FROM PlanTB";--
            PlanDatas = SQLiteDB.Run(sele, (list) => {
                return(SQLiteDB.SaveData(SQLiteDB.sdr, list));
            }, PlanDatas);
            SQLiteDB.Close();

            //PlanDatas.AddRange(Tools.SearchRepetitionDays());
            SQLiteDB.Close();

            Tools.PlanDataLock = false;

            Tools.ShowPlans(PlanDatas, Plans, flp_Plan);
        }