프로젝트

일반

사용자정보

개정판 fab4f207

IDfab4f20744c8bd1486f82ee6ad93955ede75cbf4
상위 04efe532
하위 571c44b8, d14a5e76

gaqhf 이(가) 5년 이상 전에 추가함

dev issue #000 : minor

Change-Id: Iac715292affae9b604f4003f1075bb0fa7505a14

차이점 보기:

DTI_PID/BaseModel/App.config
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<configuration>
3
  <configSections>
4
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6
  </configSections>
7
  <entityFramework>
8
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
9
      <parameters>
10
        <parameter value="mssqllocaldb" />
11
      </parameters>
12
    </defaultConnectionFactory>
13
    <providers>
14
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
15
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
16
    </providers>
17
  </entityFramework>
18
  <system.data>
19
    <DbProviderFactories>
20
      <remove invariant="System.Data.SQLite.EF6" />
21
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
22
    <remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
23
  </system.data>
3 24
</configuration>
DTI_PID/BaseModel/BaseModel.csproj
12 12
    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
13 13
    <FileAlignment>512</FileAlignment>
14 14
    <Deterministic>true</Deterministic>
15
    <NuGetPackageImportStamp>
16
    </NuGetPackageImportStamp>
15 17
  </PropertyGroup>
16 18
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17 19
    <DebugSymbols>true</DebugSymbols>
......
32 34
  </PropertyGroup>
33 35
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
34 36
    <DebugSymbols>true</DebugSymbols>
35
    <OutputPath>bin\x86\Debug\</OutputPath>
37
    <OutputPath>..\SPPIDConverterDll\</OutputPath>
36 38
    <DefineConstants>DEBUG;TRACE</DefineConstants>
37 39
    <DebugType>full</DebugType>
38 40
    <PlatformTarget>x86</PlatformTarget>
......
49 51
    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
50 52
  </PropertyGroup>
51 53
  <ItemGroup>
54
    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
55
      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
56
    </Reference>
57
    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
58
      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
59
    </Reference>
52 60
    <Reference Include="System" />
61
    <Reference Include="System.ComponentModel.DataAnnotations" />
53 62
    <Reference Include="System.Core" />
63
    <Reference Include="System.Data.SQLite, Version=1.0.110.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
64
      <HintPath>..\packages\System.Data.SQLite.Core.1.0.110.0\lib\net46\System.Data.SQLite.dll</HintPath>
65
    </Reference>
66
    <Reference Include="System.Data.SQLite.EF6, Version=1.0.110.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
67
      <HintPath>..\packages\System.Data.SQLite.EF6.1.0.110.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
68
    </Reference>
69
    <Reference Include="System.Data.SQLite.Linq, Version=1.0.110.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
70
      <HintPath>..\packages\System.Data.SQLite.Linq.1.0.110.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
71
    </Reference>
54 72
    <Reference Include="System.Windows.Forms" />
55 73
    <Reference Include="System.Xml.Linq" />
56 74
    <Reference Include="System.Data.DataSetExtensions" />
......
72 90
  </ItemGroup>
73 91
  <ItemGroup>
74 92
    <None Include="App.config" />
93
    <None Include="packages.config" />
75 94
  </ItemGroup>
76 95
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
96
  <Import Project="..\packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets')" />
97
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
98
    <PropertyGroup>
99
      <ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
100
    </PropertyGroup>
101
    <Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets'))" />
102
  </Target>
77 103
</Project>
DTI_PID/BaseModel/Project_DB.cs
3 3
using System.Linq;
4 4
using System.Text;
5 5
using System.Threading.Tasks;
6
using System.Globalization;
7
using System.Data.SQLite;
8
using System.Data;
6 9

  
7 10
namespace Converter.BaseModel
8 11
{
9 12
    public class Project_DB
10 13
    {
11
        Project_Info projectInfo = Project_Info.GetInstance();
14
        const string SPPID_DB_INFO_TABLE = "SPPID_CONNECTION_INFO";
12 15

  
16
        public static void Conn()
17
        {
18
            Project_Info projectInfo = Project_Info.GetInstance();
19
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
20
            {
21
                connection.Open();
22
            }
23
        }
13 24

  
25
        public static bool ConnTestAndCreateTable()
26
        {
27
            bool result = false;
28
            Project_Info projectInfo = Project_Info.GetInstance();
29
            SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, @"Data Source = {0}", projectInfo.DBFilePath));
30
            try
31
            {
32
                connection.Open();
33
                if (connection.State == ConnectionState.Open)
34
                {
35
                    CreateTable(connection);
36
                    result = true;
37
                }
38
                connection.Close();
39
            }
40
            catch (Exception ex)
41
            {
42

  
43
            }
44
            finally
45
            {
46
                connection.Dispose();
47
            }
48

  
49
            return result;
50
        }
51

  
52
        public static bool SaveSPPID_DB_INFO(string jsonString)
53
        {
54
            Project_Info projectInfo = Project_Info.GetInstance();
55
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
56
            {
57
                
58
                try
59
                {
60
                    connection.Open();
61
                    using (SQLiteCommand cmd = connection.CreateCommand())
62
                    {
63
                        cmd.CommandText = string.Format("DELETE FROM {0}", SPPID_DB_INFO_TABLE);
64
                        cmd.ExecuteNonQuery();
65

  
66
                        cmd.CommandText = string.Format("INSERT INTO {0} VALUES (@jsonString)", SPPID_DB_INFO_TABLE);
67
                        cmd.Parameters.AddWithValue("@jsonString", jsonString);
68
                        cmd.ExecuteNonQuery();
69
                    }
70
                    connection.Close();
71
                }
72
                catch (Exception ex)
73
                {
74
                    return false;
75
                }
76
                finally
77
                {
78
                    connection.Dispose();
79
                }
80
            }
81

  
82
            return true;
83
        }
84

  
85
        public static DataTable SelectSPPID_DB_INFO()
86
        {
87
            DataTable dt = new DataTable();
88
            Project_Info projectInfo = Project_Info.GetInstance();
89
            using (SQLiteConnection connection = new SQLiteConnection(string.Format(CultureInfo.CurrentCulture, "Data Source = {0}", projectInfo.DBFilePath)))
90
            {
91

  
92
                try
93
                {
94
                    connection.Open();
95
                    using (SQLiteCommand cmd = connection.CreateCommand())
96
                    {
97
                        cmd.CommandText = string.Format("SELECT * FROM {0}", SPPID_DB_INFO_TABLE);
98
                        using (SQLiteDataReader dr = cmd.ExecuteReader())
99
                            dt.Load(dr);
100
                    }
101
                    connection.Close();
102
                }
103
                catch (Exception ex)
104
                {
105

  
106
                }
107
                finally
108
                {
109
                    connection.Dispose();
110
                }
111
            }
112

  
113
            return dt;
114
        }
115

  
116
        private static void CreateTable(SQLiteConnection connection)
117
        {
118
            using (SQLiteCommand cmd = connection.CreateCommand())
119
            {
120
                cmd.CommandText = "SELECT NAME FROM sqlite_master WHERE type='table'";
121
                using (SQLiteDataReader dr = cmd.ExecuteReader())
122
                using (DataTable dt = new DataTable())
123
                {
124
                    dt.Load(dr);
125

  
126
                    if (dt.Select(string.Format("NAME = '{0}'", SPPID_DB_INFO_TABLE)).Length == 0)
127
                    {
128
                        cmd.CommandText = string.Format("CREATE TABLE {0} (JsonString TEXT)", SPPID_DB_INFO_TABLE);
129
                        cmd.ExecuteNonQuery();
130
                    }
131
                }
132
            }
133
        }
14 134
    }
15 135
}
DTI_PID/BaseModel/packages.config
1
<?xml version="1.0" encoding="utf-8"?>
2
<packages>
3
  <package id="EntityFramework" version="6.2.0" targetFramework="net46" />
4
  <package id="System.Data.SQLite" version="1.0.110.0" targetFramework="net46" />
5
  <package id="System.Data.SQLite.Core" version="1.0.110.0" targetFramework="net46" />
6
  <package id="System.Data.SQLite.EF6" version="1.0.110.0" targetFramework="net46" />
7
  <package id="System.Data.SQLite.Linq" version="1.0.110.0" targetFramework="net46" />
8
</packages>
DTI_PID/SPPIDConverter_AutoModeling/App.config
3 3
  <configSections>
4 4
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5 5
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
7
      <section name="Converter.AutoModeling.SPPID.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
8
    </sectionGroup>
6 9
  </configSections>
7 10
  <entityFramework>
8 11
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
......
15 18
      <provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
16 19
    </providers>
17 20
  </entityFramework>
18
  <system.data>
19
    <DbProviderFactories>
20
      <remove invariant="System.Data.SQLite.EF6" />
21
      <add name="SQLite Data Provider (Entity Framework 6)" invariant="System.Data.SQLite.EF6" description=".NET Framework Data Provider for SQLite (Entity Framework 6)" type="System.Data.SQLite.EF6.SQLiteProviderFactory, System.Data.SQLite.EF6" />
22
    <remove invariant="System.Data.SQLite" /><add name="SQLite Data Provider" invariant="System.Data.SQLite" description=".NET Framework Data Provider for SQLite" type="System.Data.SQLite.SQLiteFactory, System.Data.SQLite" /></DbProviderFactories>
23
  </system.data>
21
  
22
  <userSettings>
23
    <Converter.AutoModeling.SPPID.Properties.Settings>
24
      <setting name="LatestProjectPath" serializeAs="String">
25
        <value />
26
      </setting>
27
    </Converter.AutoModeling.SPPID.Properties.Settings>
28
  </userSettings>
24 29
</configuration>
DTI_PID/SPPIDConverter_AutoModeling/ConverterForm.cs
34 34
        {
35 35
            InitializeComponent();
36 36

  
37
            CultureInfo culture = CultureInfo.GetCultureInfo("en");
37
            CultureInfo culture = CultureInfo.GetCultureInfo("ko");
38 38
            Msg.Culture = culture;
39 39

  
40
            //Color color = Color.FromArgb(67, 117, 219);
41
            //layoutControlGroupAutoConverter.AppearanceGroup.BorderColor = color;
42
            //layoutControlGroupAutoConverter.AllowBorderColorBlending = true;
43
            //layoutControlGroupSPPIDDB.AppearanceGroup.BorderColor = color;
44
            //layoutControlGroupSPPIDDB.AllowBorderColorBlending = true;
45
            //layoutControlGroupID2Project.AppearanceGroup.BorderColor = color;
46
            //layoutControlGroupID2Project.AllowBorderColorBlending = true;
47
            //layoutControlGroupItemMapping.AppearanceGroup.BorderColor = color;
48
            //layoutControlGroupItemMapping.AllowBorderColorBlending = true;
49

  
50
            SPPIDUtil.ReadSPPIDInfo();
51
            SPPIDUtil.ReadID2ProjectInfo();
52

  
53 40
            InitGridControl();
54
            SetID2ProjectUI();
55
            SetSPPIDDBUI();
41
            InitID2Project();
56 42
        }
57 43

  
58 44
        private void InitGridControl()
......
98 84

  
99 85
        private void btnID2Project_ButtonClick(object sender, ButtonPressedEventArgs e)
100 86
        {
87
            xtraFolderBrowserDialog.SelectedPath = btnID2Project.Text;
88

  
101 89
            if (xtraFolderBrowserDialog.ShowDialog() == DialogResult.OK)
102 90
            {
103
                bool result = false;
104
                string dirPath = xtraFolderBrowserDialog.SelectedPath;
105
                if (IsID2Project(dirPath))
106
                {
107
                    _ProjectInfo.DefaultPath = dirPath;
108
                    _ProjectInfo.Enable = true;
109
                    if (SPPIDUtil.SaveID2ProjectInfo())
110
                    {
111
                        result = true;
112
                        SetID2ProjectUI();
113
                        MessageBox.Show(Msg.SuccessProjectSelect, Msg.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
114
                    }
115
                }
116

  
117
                if (!result)
118
                {
119
                    _ProjectInfo.Enable = false;
120
                    SetID2ProjectUI();
91
                if (xtraFolderBrowserDialog.SelectedPath[xtraFolderBrowserDialog.SelectedPath.Length - 1] == '\\')
92
                    xtraFolderBrowserDialog.SelectedPath = xtraFolderBrowserDialog.SelectedPath.Remove(xtraFolderBrowserDialog.SelectedPath.Length - 1);
93
                Settings.Default.LatestProjectPath = xtraFolderBrowserDialog.SelectedPath;
94
                Settings.Default.Save();
95
                if (InitID2Project())
96
                    MessageBox.Show(Msg.SuccessProjectSelect, Msg.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
97
                else
121 98
                    MessageBox.Show(Msg.FailProjectSelect, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
122
                }
123 99
            }
124 100
        }
125 101

  
126
        private void SetID2ProjectUI()
102
        private bool InitID2Project()
127 103
        {
128
            if (_ProjectInfo.Enable)
104
            _ProjectInfo.DefaultPath = Settings.Default.LatestProjectPath;
105
            if (Project_DB.ConnTestAndCreateTable())
129 106
            {
107
                _ProjectInfo.Enable = true;
130 108
                btnID2Project.Text = _ProjectInfo.DefaultPath;
131 109
                labelID2ProjectName.Text = _ProjectInfo.Name;
132 110
                labelID2ProjectName.AppearanceItemCaption.ForeColor = Color.Blue;
133 111
                labelID2ProjectStatus.Text = Msg.ConnectionSuccessful;
134 112
                labelID2ProjectStatus.AppearanceItemCaption.ForeColor = Color.Blue;
113
                layoutControlGroupSPPIDDB.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
114
                layoutControlGroupItemMapping.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
115

  
116
                InitSPPIDDB();
117
                return true;
135 118
            }
136 119
            else
137 120
            {
121
                _ProjectInfo.Enable = false;
138 122
                btnID2Project.Text = "";
139 123
                labelID2ProjectName.Text = " ";
140 124
                labelID2ProjectName.AppearanceItemCaption.ForeColor = Color.Red;
141 125
                labelID2ProjectStatus.Text = Msg.ConnectionFail;
142 126
                labelID2ProjectStatus.AppearanceItemCaption.ForeColor = Color.Red;
127
                layoutControlGroupSPPIDDB.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
128
                layoutControlGroupItemMapping.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
129

  
130
                InitSPPIDDB();
131
                return false;
143 132
            }
144 133
        }
145 134

  
146
        private void SetSPPIDDBUI()
135
        private void InitSPPIDDB()
147 136
        {
137
            if (_ProjectInfo.Enable)
138
            {
139
                DataTable dt = Project_DB.SelectSPPID_DB_INFO();
140
                SPPIDUtil.ConvertToSPPIDInfo(dt.Rows[0][0].ToString());
141
            }
142
            
148 143
            if (_SPPIDInfo.Enable)
149 144
            {
150 145
                labelSPPIDPlantName.Text = _SPPIDInfo.SelectedPlant;
......
219 214
        {
220 215
            SPPID_DB_SettingForm form = new SPPID_DB_SettingForm();
221 216
            if (form.ShowDialog() == DialogResult.OK)
222
                SetSPPIDDBUI();
217
                InitSPPIDDB();
223 218
        }
224 219

  
225 220
        private void btnItemMapping_Click(object sender, EventArgs e)
DTI_PID/SPPIDConverter_AutoModeling/DB/SPPID_DB.cs
14 14
    {
15 15
        private const string oConnString = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST ={0}" + @")(PORT = {1}))(CONNECT_DATA = (SERVICE_NAME = {2})))";
16 16

  
17
        public static bool CheckAndSetSPPIDInfo()
17
        public static bool CheckAndSetSPPIDInfo(SPPID_DBInfo dbInfo)
18 18
        {
19 19
            bool bResult = false;
20
            SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance();
21 20
            try
22 21
            {
23 22
                if (dbInfo.DBType == "ORACLE")
......
96 95
            return bResult;
97 96
        }
98 97

  
99
        public static bool SetPlantDBSetting()
98
        public static bool SetPlantDBSetting(SPPID_DBInfo dbInfo)
100 99
        {
101 100
            bool bResult = false;
102
            SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance();
103 101
            try
104 102
            {
105 103
                if (dbInfo.DBType == "ORACLE")
......
165 163
            return bResult;
166 164
        }
167 165

  
168
        public static List<string> GetPlantList()
166
        public static List<string> GetPlantList(SPPID_DBInfo dbInfo)
169 167
        {
170
            SPPID_DBInfo dbInfo = SPPID_DBInfo.GetInstance();
171 168
            List<string> plantList = new List<string>();
172 169
            try
173 170
            {
DTI_PID/SPPIDConverter_AutoModeling/Form/SPPID_DB_SettingForm.Designer.cs
30 30
        {
31 31
            this.ribbonControl = new DevExpress.XtraBars.Ribbon.RibbonControl();
32 32
            this.layoutControl1 = new DevExpress.XtraLayout.LayoutControl();
33
            this.simpleButton2 = new DevExpress.XtraEditors.SimpleButton();
33
            this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
34 34
            this.btnSave = new DevExpress.XtraEditors.SimpleButton();
35 35
            this.comboPlant = new DevExpress.XtraEditors.ComboBoxEdit();
36 36
            this.textBoxDBPassword = new DevExpress.XtraEditors.TextEdit();
......
105 105
            // 
106 106
            // layoutControl1
107 107
            // 
108
            this.layoutControl1.Controls.Add(this.simpleButton2);
108
            this.layoutControl1.Controls.Add(this.btnCancel);
109 109
            this.layoutControl1.Controls.Add(this.btnSave);
110 110
            this.layoutControl1.Controls.Add(this.comboPlant);
111 111
            this.layoutControl1.Controls.Add(this.textBoxDBPassword);
......
125 125
            this.layoutControl1.TabIndex = 1;
126 126
            this.layoutControl1.Text = "layoutControl1";
127 127
            // 
128
            // simpleButton2
128
            // btnCancel
129 129
            // 
130
            this.simpleButton2.ImageOptions.SvgImage = global::Converter.AutoModeling.SPPID.Properties.Resources.close;
131
            this.simpleButton2.Location = new System.Drawing.Point(202, 392);
132
            this.simpleButton2.Name = "simpleButton2";
133
            this.simpleButton2.Size = new System.Drawing.Size(203, 36);
134
            this.simpleButton2.StyleController = this.layoutControl1;
135
            this.simpleButton2.TabIndex = 14;
136
            this.simpleButton2.Text = "Cancel";
130
            this.btnCancel.ImageOptions.SvgImage = global::Converter.AutoModeling.SPPID.Properties.Resources.close;
131
            this.btnCancel.Location = new System.Drawing.Point(202, 392);
132
            this.btnCancel.Name = "btnCancel";
133
            this.btnCancel.Size = new System.Drawing.Size(203, 36);
134
            this.btnCancel.StyleController = this.layoutControl1;
135
            this.btnCancel.TabIndex = 14;
136
            this.btnCancel.Text = "Cancel";
137
            this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
137 138
            // 
138 139
            // btnSave
139 140
            // 
......
397 398
            // 
398 399
            // layoutControlItem11
399 400
            // 
400
            this.layoutControlItem11.Control = this.simpleButton2;
401
            this.layoutControlItem11.Control = this.btnCancel;
401 402
            this.layoutControlItem11.Location = new System.Drawing.Point(190, 380);
402 403
            this.layoutControlItem11.Name = "layoutControlItem11";
403 404
            this.layoutControlItem11.Size = new System.Drawing.Size(207, 40);
......
478 479
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem8;
479 480
        private DevExpress.XtraEditors.ComboBoxEdit comboPlant;
480 481
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem9;
481
        private DevExpress.XtraEditors.SimpleButton simpleButton2;
482
        private DevExpress.XtraEditors.SimpleButton btnCancel;
482 483
        private DevExpress.XtraEditors.SimpleButton btnSave;
483 484
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem10;
484 485
        private DevExpress.XtraLayout.LayoutControlItem layoutControlItem11;
DTI_PID/SPPIDConverter_AutoModeling/Form/SPPID_DB_SettingForm.cs
12 12
using Converter.AutoModeling.SPPID.Properties;
13 13
using Converter.AutoModeling.SPPID.DB;
14 14
using Converter.AutoModeling.SPPID.Util;
15
using Converter.BaseModel;
15 16
using Newtonsoft.Json;
16 17

  
17 18
namespace Converter.AutoModeling.SPPID.Form
18 19
{
19 20
    public partial class SPPID_DB_SettingForm : DevExpress.XtraBars.Ribbon.RibbonForm
20 21
    {
21
        SPPID_DBInfo info = SPPID_DBInfo.GetInstance();
22

  
22
        SPPID_DBInfo formDBInfo = new SPPID_DBInfo();
23 23
        public SPPID_DB_SettingForm()
24 24
        {
25 25
            InitializeComponent();
......
28 28

  
29 29
        private void Init()
30 30
        {
31
            SPPID_DBInfo info = SPPID_DBInfo.GetInstance();
31 32
            textBoxDBType.Text = info.DBType;
32 33
            textBoxServiceName.Text = info.Service;
33 34
            textBoxSiteName.Text = info.Site;
......
106 107
            if (comboPlant.SelectedIndex == -1)
107 108
                return;
108 109

  
109
            if (SetPlantList() && info.PlantList.Contains(comboPlant.SelectedItem.ToString()))
110
            if (SetPlantList() && formDBInfo.PlantList.Contains(comboPlant.SelectedItem.ToString()))
110 111
            {
111
                info.SelectedPlant = comboPlant.SelectedItem.ToString();
112
                if (SPPID_DB.SetPlantDBSetting())
112
                formDBInfo.SelectedPlant = comboPlant.SelectedItem.ToString();
113
                if (SPPID_DB.SetPlantDBSetting(formDBInfo))
113 114
                {
114
                    info.Enable = true;
115
                    if (SPPIDUtil.SaveSPPIDInfo())
115
                    formDBInfo.Enable = true;
116
                    string jsonString = JsonConvert.SerializeObject(formDBInfo);
117
                    if (Project_DB.SaveSPPID_DB_INFO(jsonString))
118
                    {
119
                        SPPIDUtil.ConvertToSPPIDInfo(jsonString);
116 120
                        DialogResult = DialogResult.OK;
121
                    }
122
                    else
123
                    {
124

  
125
                    }
117 126
                }
118 127
                else
119 128
                {
......
127 136
            if (SetPlantList())
128 137
            {
129 138
                comboPlant.Properties.Items.Clear();
130
                comboPlant.Properties.Items.AddRange(info.PlantList);
139
                comboPlant.Properties.Items.AddRange(formDBInfo.PlantList);
131 140
                comboPlant.SelectedIndex = 0;
132 141
                MessageBox.Show(Msg.SuccessGetPlantList, Msg.Information, MessageBoxButtons.OK, MessageBoxIcon.Information);
133 142
            }
134 143
            else
135 144
            {
136
                info.Enable = false;
145
                formDBInfo.Enable = false;
137 146
                MessageBox.Show(Msg.FailGetPlantList, Msg.Warning, MessageBoxButtons.OK, MessageBoxIcon.Warning);
138 147
            }
139 148
        }
......
142 151
        {
143 152
            try
144 153
            {
145
                info.DBType = textBoxDBType.Text;
146
                info.Service = textBoxServiceName.Text;
147
                info.Site = textBoxSiteName.Text;
148
                info.ServerIP = textBoxServerIP.Text;
149
                info.Port = textBoxPort.Text;
150
                info.DBUser = textBoxDBUser.Text;
151
                info.DBPassword = textBoxDBPassword.Text;
152
                info.PlantList = SPPID_DB.GetPlantList();
153
                if (info.PlantList.Count > 0)
154
                formDBInfo.DBType = textBoxDBType.Text;
155
                formDBInfo.Service = textBoxServiceName.Text;
156
                formDBInfo.Site = textBoxSiteName.Text;
157
                formDBInfo.ServerIP = textBoxServerIP.Text;
158
                formDBInfo.Port = textBoxPort.Text;
159
                formDBInfo.DBUser = textBoxDBUser.Text;
160
                formDBInfo.DBPassword = textBoxDBPassword.Text;
161
                formDBInfo.PlantList = SPPID_DB.GetPlantList(formDBInfo);
162
                if (formDBInfo.PlantList.Count > 0)
154 163
                    return true;
155 164
                else
156 165
                    return false;
......
160 169
                return false;
161 170
            }
162 171
        }
172

  
173
        private void btnCancel_Click(object sender, EventArgs e)
174
        {
175
            DialogResult = DialogResult.Cancel;
176
        }
163 177
    }
164 178
}
DTI_PID/SPPIDConverter_AutoModeling/Properties/Settings.Designer.cs
1
//------------------------------------------------------------------------------
2
// <auto-generated>
3
//     이 코드는 도구를 사용하여 생성되었습니다.
4
//     런타임 버전:4.0.30319.42000
5
//
6
//     파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
7
//     이러한 변경 내용이 손실됩니다.
8
// </auto-generated>
9
//------------------------------------------------------------------------------
10

  
11
namespace Converter.AutoModeling.SPPID.Properties {
12
    
13
    
14
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
16
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17
        
18
        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19
        
20
        public static Settings Default {
21
            get {
22
                return defaultInstance;
23
            }
24
        }
25
        
26
        [global::System.Configuration.UserScopedSettingAttribute()]
27
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28
        [global::System.Configuration.DefaultSettingValueAttribute("")]
29
        public string LatestProjectPath {
30
            get {
31
                return ((string)(this["LatestProjectPath"]));
32
            }
33
            set {
34
                this["LatestProjectPath"] = value;
35
            }
36
        }
37
    }
38
}
DTI_PID/SPPIDConverter_AutoModeling/Properties/Settings.settings
1
<?xml version='1.0' encoding='utf-8'?>
2
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Converter.AutoModeling.SPPID.Properties" GeneratedClassName="Settings">
3
  <Profiles />
4
  <Settings>
5
    <Setting Name="LatestProjectPath" Type="System.String" Scope="User">
6
      <Value Profile="(Default)" />
7
    </Setting>
8
  </Settings>
9
</SettingsFile>
DTI_PID/SPPIDConverter_AutoModeling/SPPIDConverter_AutoModeling.csproj
38 38
  </PropertyGroup>
39 39
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
40 40
    <DebugSymbols>true</DebugSymbols>
41
    <OutputPath>bin\x86\Debug\</OutputPath>
41
    <OutputPath>..\SPPIDConverterDll\</OutputPath>
42 42
    <DefineConstants>DEBUG;TRACE</DefineConstants>
43 43
    <DebugType>full</DebugType>
44 44
    <PlatformTarget>x86</PlatformTarget>
......
86 86
    <Reference Include="System" />
87 87
    <Reference Include="System.ComponentModel.DataAnnotations" />
88 88
    <Reference Include="System.Core" />
89
    <Reference Include="System.Data.SQLite, Version=1.0.110.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
90
      <HintPath>..\packages\System.Data.SQLite.Core.1.0.110.0\lib\net46\System.Data.SQLite.dll</HintPath>
91
    </Reference>
92
    <Reference Include="System.Data.SQLite.EF6, Version=1.0.110.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
93
      <HintPath>..\packages\System.Data.SQLite.EF6.1.0.110.0\lib\net46\System.Data.SQLite.EF6.dll</HintPath>
94
    </Reference>
95
    <Reference Include="System.Data.SQLite.Linq, Version=1.0.110.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
96
      <HintPath>..\packages\System.Data.SQLite.Linq.1.0.110.0\lib\net46\System.Data.SQLite.Linq.dll</HintPath>
97
    </Reference>
98 89
    <Reference Include="System.Drawing" />
99 90
    <Reference Include="System.Windows.Forms" />
100 91
    <Reference Include="System.Xml.Linq" />
......
148 139
      <DesignTime>True</DesignTime>
149 140
      <DependentUpon>Resources.resx</DependentUpon>
150 141
    </Compile>
142
    <Compile Include="Properties\Settings.Designer.cs">
143
      <AutoGen>True</AutoGen>
144
      <DesignTimeSharedInput>True</DesignTimeSharedInput>
145
      <DependentUpon>Settings.settings</DependentUpon>
146
    </Compile>
147
    <Compile Include="Settings.cs" />
151 148
    <Compile Include="Util\SPPIDUtil.cs" />
152 149
  </ItemGroup>
153 150
  <ItemGroup>
......
223 220
  </ItemGroup>
224 221
  <ItemGroup>
225 222
    <None Include="packages.config" />
223
    <None Include="Properties\Settings.settings">
224
      <Generator>SettingsSingleFileGenerator</Generator>
225
      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
226
    </None>
226 227
    <None Include="Resources\convertto.svg" />
227 228
  </ItemGroup>
228 229
  <ItemGroup>
......
259 260
    <None Include="Resources\saveandclose.svg" />
260 261
  </ItemGroup>
261 262
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
262
  <Import Project="..\packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets')" />
263
  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
264
    <PropertyGroup>
265
      <ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
266
    </PropertyGroup>
267
    <Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.110.0\build\net46\System.Data.SQLite.Core.targets'))" />
268
  </Target>
269 263
</Project>
DTI_PID/SPPIDConverter_AutoModeling/Settings.cs
1
namespace Converter.AutoModeling.SPPID.Properties {
2
    
3
    
4
    // 이 클래스를 사용하여 설정 클래스에 대한 특정 이벤트를 처리할 수 있습니다.
5
    //  SettingChanging 이벤트는 설정 값이 변경되기 전에 발생합니다.
6
    //  PropertyChanged 이벤트는 설정 값이 변경된 후에 발생합니다.
7
    //  SettingsLoaded 이벤트는 설정 값이 로드된 후에 발생합니다.
8
    //  SettingsSaving 이벤트는 설정 값이 저장되기 전에 발생합니다.
9
    internal sealed partial class Settings {
10
        
11
        public Settings() {
12
            // // 설정을 저장 및 변경하기 위한 이벤트 처리기를 추가하려면 아래 줄에서 주석 처리를 제거하세요.
13
            //
14
            // this.SettingChanging += this.SettingChangingEventHandler;
15
            //
16
            // this.SettingsSaving += this.SettingsSavingEventHandler;
17
            //
18
        }
19
        
20
        private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) {
21
            // SettingChangingEvent 이벤트를 처리하는 코드를 여기에 추가하세요.
22
        }
23
        
24
        private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) {
25
            // SettingsSaving 이벤트를 처리하는 코드를 여기에 추가하세요.
26
        }
27
    }
28
}
DTI_PID/SPPIDConverter_AutoModeling/Util/SPPIDUtil.cs
13 13
{
14 14
    public class SPPIDUtil
15 15
    {
16
        public static bool SaveID2ProjectInfo()
17
        {
18
            Project_Info projectInfo = Project_Info.GetInstance();
19
            try
20
            {
21
                StreamWriter sw = new StreamWriter(Application.StartupPath + @"\ProjectInfo.info");
22
                sw.Write(JsonConvert.SerializeObject(projectInfo));
23
                sw.Dispose();
24
            }
25
            catch (Exception ex)
26
            {
27
                return false;
28
            }
29
            return true;
30
        }
31

  
32
        public static bool ReadID2ProjectInfo()
33
        {
34
            Project_Info projectInfo = Project_Info.GetInstance();
35
            try
36
            {
37
                StreamReader sr = new StreamReader(Application.StartupPath + @"\ProjectInfo.info");
38
                Project_Info jsonProjectInfo = JsonConvert.DeserializeObject<Project_Info>(sr.ReadToEnd());
39
                sr.Dispose();
40

  
41
                projectInfo.DefaultPath = jsonProjectInfo.DefaultPath;
42
                projectInfo.Enable = jsonProjectInfo.Enable;
43
            }
44
            catch (Exception ex)
45
            {
46
                return false;
47
            }
48
            return true;
49
        }
50

  
51
        public static bool SaveSPPIDInfo()
52
        {
53
            SPPID_DBInfo info = SPPID_DBInfo.GetInstance();
54
            try
55
            {
56
                StreamWriter sw = new StreamWriter(Application.StartupPath + @"\SPPIDInfo.info");
57
                sw.Write(JsonConvert.SerializeObject(info));
58
                sw.Dispose();
59
            }
60
            catch (Exception ex)
61
            {
62
                return false;
63
            }
64
            return true;
65
        }
66

  
67
        public static bool ReadSPPIDInfo()
16
        public static bool ConvertToSPPIDInfo(string jsonString)
68 17
        {
69 18
            SPPID_DBInfo _SPPIDInfo = SPPID_DBInfo.GetInstance();
70 19
            try
71 20
            {
72
                StreamReader sr = new StreamReader(Application.StartupPath + @"\SPPIDInfo.info");
73
                SPPID_DBInfo jsonSPPIDInfo = JsonConvert.DeserializeObject<SPPID_DBInfo>(sr.ReadToEnd());
74
                sr.Dispose();
21
                SPPID_DBInfo jsonSPPIDInfo = JsonConvert.DeserializeObject<SPPID_DBInfo>(jsonString);
75 22

  
76 23
                _SPPIDInfo.DBType = jsonSPPIDInfo.DBType;
77 24
                _SPPIDInfo.Service = jsonSPPIDInfo.Service;
......
92 39
            }
93 40
            catch (Exception ex)
94 41
            {
42
                _SPPIDInfo.Enable = false;
95 43
                return false;
96 44
            }
97 45
            return true;
DTI_PID/SPPIDConverter_AutoModeling/packages.config
3 3
  <package id="EntityFramework" version="6.2.0" targetFramework="net46" />
4 4
  <package id="Newtonsoft.Json" version="12.0.2" targetFramework="net46" />
5 5
  <package id="Oracle.ManagedDataAccess" version="18.3.0" targetFramework="net46" />
6
  <package id="System.Data.SQLite" version="1.0.110.0" targetFramework="net46" />
7
  <package id="System.Data.SQLite.Core" version="1.0.110.0" targetFramework="net46" />
8
  <package id="System.Data.SQLite.EF6" version="1.0.110.0" targetFramework="net46" />
9
  <package id="System.Data.SQLite.Linq" version="1.0.110.0" targetFramework="net46" />
10 6
</packages>
DTI_PID/SPPIDConverter_DialogBarWrapper/SPPIDConverter_Wrapper.csproj
31 31
  </PropertyGroup>
32 32
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
33 33
    <DebugSymbols>true</DebugSymbols>
34
    <OutputPath>bin\x86\Debug\</OutputPath>
34
    <OutputPath>..\SPPIDConverterDll\</OutputPath>
35 35
    <DefineConstants>DEBUG;TRACE</DefineConstants>
36 36
    <DebugType>full</DebugType>
37 37
    <PlatformTarget>x86</PlatformTarget>

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)