admin
2020-06-22 924bdf1c9fb74babf2438d5545db3594756625d1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.Data.SQLite;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WindowsFormsApp1.entity;
 
namespace WindowsFormsApp1.utils
{
    //采集设置
    class CollectSettingUtil
    {
        //获取采集时间
        public static CollectSettings GetCollectTime() {
            Config config =  SQLiteDataBaseUtil.getInstance().GetConfig("collect_settings_time_own");
            if (config == null)//设置默认值
            {
                return new CollectSettings(10, "00:00", "23:59", false, true);
            }
            else { //解析
                return  Newtonsoft.Json.JsonConvert.DeserializeObject<CollectSettings>(  config.Value);
            }
        }
 
        //设置采集时间
        public static void setCollectTime(CollectSettings setting)
        {
            Config config = new Config();
            config.Key = "collect_settings_time_own";
            config.Value = Newtonsoft.Json.JsonConvert.SerializeObject(setting) ;
            SQLiteDataBaseUtil.getInstance().AddConfig(config);
        }
    }
 
 
    class CollectSettings {
        private int timeSpan;
        private String startTime;
        private String endTime;
        private bool timeValid;
        private bool open;
 
        public CollectSettings(int timeSpan, string startTime, string endTime, bool timeValid, bool open)
        {
            this.timeSpan = timeSpan;
            this.startTime = startTime;
            this.endTime = endTime;
            this.timeValid = timeValid;
            this.open = open;
        }
 
 
        public CollectSettings()
        {
           
        }
 
        public int TimeSpan {
            get { return timeSpan; }
            set { this.timeSpan = value; }
        }
 
        public String StartTime
        {
            get { return startTime; }
            set { this.startTime = value; }
        }
 
        public String EndTime
        {
            get { return endTime; }
            set { this.endTime = value; }
        }
 
        public bool TimeValid
        {
            get { return timeValid; }
            set { this.timeValid = value; }
        }
 
        public bool Open
        {
            get { return open; }
            set { this.open = value; }
        }
 
 
 
    }
}