프로젝트

일반

사용자정보

통계
| 개정판:

hytos / DTI_PID / SPPIDConverter / Util / SPPIDUtil.cs @ 4314b3f3

이력 | 보기 | 이력해설 | 다운로드 (2.27 KB)

1 23eb98bf gaqhf
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Text;
5
using System.Threading.Tasks;
6
using Newtonsoft.Json;
7
using System.IO;
8 b8e2644e gaqhf
using Converter.SPPID.DB;
9 23eb98bf gaqhf
using Converter.BaseModel;
10
using System.Windows.Forms;
11
12 b8e2644e gaqhf
namespace Converter.SPPID.Util
13 23eb98bf gaqhf
{
14
    public class SPPIDUtil
15
    {
16 fab4f207 gaqhf
        public static bool ConvertToSPPIDInfo(string jsonString)
17 23eb98bf gaqhf
        {
18 2e1e3c12 gaqhf
            SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
19 23eb98bf gaqhf
            try
20
            {
21 fab4f207 gaqhf
                SPPID_DBInfo jsonSPPIDInfo = JsonConvert.DeserializeObject<SPPID_DBInfo>(jsonString);
22 23eb98bf gaqhf
23
                _SPPIDInfo.DBType = jsonSPPIDInfo.DBType;
24
                _SPPIDInfo.Service = jsonSPPIDInfo.Service;
25
                _SPPIDInfo.Site = jsonSPPIDInfo.Site;
26
                _SPPIDInfo.ServerIP = jsonSPPIDInfo.ServerIP;
27
                _SPPIDInfo.Port = jsonSPPIDInfo.Port;
28
                _SPPIDInfo.DBUser = jsonSPPIDInfo.DBUser;
29
                _SPPIDInfo.DBPassword = jsonSPPIDInfo.DBPassword;
30
                _SPPIDInfo.PlantPath = jsonSPPIDInfo.PlantPath;
31
                _SPPIDInfo.PlantDic = jsonSPPIDInfo.PlantDic;
32
                _SPPIDInfo.PlantPID = jsonSPPIDInfo.PlantPID;
33
                _SPPIDInfo.PlantPIDDic = jsonSPPIDInfo.PlantPIDDic;
34
                _SPPIDInfo.Plant = jsonSPPIDInfo.Plant;
35
                _SPPIDInfo.Enable = jsonSPPIDInfo.Enable;
36
                _SPPIDInfo.SelectedPlant = jsonSPPIDInfo.SelectedPlant;
37
                _SPPIDInfo.PlantList = jsonSPPIDInfo.PlantList;
38
39
            }
40
            catch (Exception ex)
41
            {
42 fab4f207 gaqhf
                _SPPIDInfo.Enable = false;
43 23eb98bf gaqhf
                return false;
44
            }
45
            return true;
46
        }
47 e00e891d gaqhf
        public static bool ConvertToETCSetting(string jsonString)
48
        {
49
            ETCSetting _ETCSetting = ETCSetting.GetInstance();
50
            try
51
            {
52
                ETCSetting jsonETCSetting = JsonConvert.DeserializeObject<ETCSetting>(jsonString);
53
54
                _ETCSetting.NoteSymbolPath = jsonETCSetting.NoteSymbolPath;
55
                _ETCSetting.TextSymbolPath = jsonETCSetting.TextSymbolPath;
56
                _ETCSetting.DrainValveSize = jsonETCSetting.DrainValveSize;
57
58
            }
59
            catch (Exception ex)
60
            {
61
                return false;
62
            }
63
            return true;
64
        }
65 23eb98bf gaqhf
    }
66
}
클립보드 이미지 추가 (최대 크기: 500 MB)