schangxiang@126.com
2025-05-06 71a29934b04038b983772819e129d7c63202e565
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
using Newtonsoft.Json;
using System.Windows.Forms.VisualStyles;
using GenerateCode_WeiBen_WMS.DataBaseFactory;
using GenerateCode_WeiBen_WMS.Const;
using GenerateCode_WeiBen_WMS.Model;
 
namespace GenerateCode_GEBrilliantFactory
{
    public partial class MainForm : Form
    {
        public static string projectNamePrefix = "";
        public static string dataBaseName = "";
        public static DataBaseEnum dataBaseEnum = DataBaseEnum.MySql;
        public MainForm()
        {
            InitializeComponent();
 
            this.tbPath.Text = "D:\\C#AutoCreateCodeFile";
 
            this.tb_Primary.Text = "id";//主键名
            this.tb_PrimaryDesc.Text = "主键";
            this.tb_OrderBy.Text = "ModifyTime";//排序字段
 
            this.tb_ProjectNamePrefix.Text = "Test";
            this.tb_TableName.Text = "scms_wmsmaterials";//表名
            this.tb_WCF_NameSpacePath.Text = "HIAWms";//WCF项目命名空间 
            this.tb_FileName.Text = "Xiangzi";//文件前缀名
            this.tb_ChinaComment.Text = "物料基础信息表";//中文注释
            this.tb_MenuName.Text = "物料信息";//中文注释
            this.tb_PageMenuInstanceName.Text = "wmsMaterial";
            this.tb_CreatePerson.Text = "shaocx";//创建人
            this.tb_EntityName.Text = "WmsMaterial";//实体类名
            //this.tb_EntityProName.Text = "wmsMaterial";//实体类对象名
            this.tb_EnumList.Text = "PurchaseType|PurchaseTypeEnum|PurchaseTypeDesc,MaterialType|MaterialTypeEnum|MaterialTypeDesc,IsMainBranch|YesNoEnum|IsMainBranchDesc";
 
            this.cmb_DataSource.DropDownStyle = ComboBoxStyle.DropDownList;
            List<ListItem> itemList = CommonHelper.GetDataSources();
            foreach (var item in itemList)
            {
                this.cmb_DataSource.Items.Add(item);
            }
            this.cmb_DataSource.SelectedIndex = 0;
 
            this.cmb_DataBase.DropDownStyle = ComboBoxStyle.DropDownList;
            List<ListItem> itemList_Db = CommonHelper.GetDataBase();
            foreach (var item in itemList_Db)
            {
                this.cmb_DataBase.Items.Add(item);
            }
            this.cmb_DataBase.SelectedIndex = 0;
        }
 
        /// <summary>
        /// 保存路径对话框
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void button1_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();
            if (DialogResult.OK == fbd.ShowDialog())
            {
                tbPath.Text = fbd.SelectedPath;
            }
        }
 
        private void btnExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
 
        //一键生成所有文件
        private void btn_CreateFile_Click(object sender, EventArgs e)
        {
            try
            {
                projectNamePrefix = this.tb_ProjectNamePrefix.Text;
                if (projectNamePrefix == "")
                {
                    MessageBox.Show("请输入项目名前缀!");
                    this.tb_ProjectNamePrefix.Focus();
                    return;
                }
 
                if (dataBaseName == "")
                {
                    MessageBox.Show("请选择数据库!");
                    return;
                }
 
                string primaryKey = this.tb_Primary.Text.Trim();//主键名
                string primaryKeyDesc = this.tb_PrimaryDesc.Text.Trim();//主键描述
                string tableName = this.tb_TableName.Text.Trim();//表名
                string wcf_NameSpacePath = this.tb_WCF_NameSpacePath.Text.Trim();//WCF项目命名空间 
                string filePrefixName = this.tb_FileName.Text.Trim();//文件前缀名
                string modulelogo = this.tb_Modulelogo.Text.Trim();//模块简写
                string chinaComment = this.tb_ChinaComment.Text.Trim();//中文注释
                if (chinaComment == "")
                {
                    MessageBox.Show("请输入 表的中文注解!");
                    this.tb_ChinaComment.Focus();
                    return;
                }
                string menuName = this.tb_MenuName.Text.Trim();//中文注释
                if (menuName == "")
                {
                    MessageBox.Show("请输入 页面菜单名!");
                    this.tb_MenuName.Focus();
                    return;
                }
                string _tb_PageMenuInstanceName = this.tb_PageMenuInstanceName.Text.Trim();//中文注释
                if (_tb_PageMenuInstanceName == "")
                {
                    MessageBox.Show("请输入 页面菜单对象缩写!");
                    this.tb_PageMenuInstanceName.Focus();
                    return;
                }
                string createPerson = this.tb_CreatePerson.Text.Trim();//创建人
                string entityName = this.tb_EntityName.Text.Trim();//实体类名
                string tableAlias = this.tb_EntityProName.Text.Trim();//实体类对象名/表别名
                string orderByName = this.tb_OrderBy.Text.Trim();//排序字段名称
                string routePrefix = this.tb_RoutePrefix.Text.Trim();//WCF路由前缀
                string connStr = this.lbl_DataSource.Text.Trim();//数据库连接字符串
                if (connStr == "")
                {
                    MessageBox.Show("请选择数据库源!");
                    this.cmb_DataSource.Focus();
                    return;
                }
                if (tableName == "")
                {
                    MessageBox.Show("请输入表名!");
                    this.tb_TableName.Focus();
                    return;
                }
                if (primaryKey == "")
                {
                    MessageBox.Show("请输入主键名!");
                    this.tb_Primary.Focus();
                    return;
                }
                if (routePrefix == "")
                {
                    MessageBox.Show("请输入WCF路由前缀!");
                    this.tb_RoutePrefix.Focus();
                    return;
                }
                if (wcf_NameSpacePath == "")
                {
                    MessageBox.Show("请输入命名空间!");
                    this.tb_WCF_NameSpacePath.Focus();
                    return;
                }
 
                //读取Mysql
                var handler = DataBaseServiceFactory.GetHandle(dataBaseEnum);
                List<ColumnModel> columnList = handler.GetColumnList(tableName, connStr);
                if (columnList.Count == 0)
                {
                    MessageBox.Show("没有获取到表下面的列集合!");
                    return;
                }
 
                string groupName = this.tb_GroupName.Text.Trim();
                //if (groupName == "")
                //{
                //    MessageBox.Show("请输入分组名!");
                //    this.tb_GroupName.Focus();
                //    return;
                //}
 
                string addEntityParam = "Add" + modulelogo + "Param";//新增参数类名
                string str_generate = "";
                bool tf;
 
                GenerateCodeParam param = new GenerateCodeParam()
                {
                    Modulelogo = modulelogo,
                    ChinaComment = chinaComment,
                    PageMenuName = menuName,
                    PageMenuInstanceName = _tb_PageMenuInstanceName,
                    NameSpacePath = wcf_NameSpacePath,
                    ColumnNameList = columnList,
                    EntityName = entityName,
                    EntityInstanceName = tableAlias
                };
                //处理枚举类型
                List<EnumModel> enumList = new List<EnumModel>();
                var str_enumList = this.tb_EnumList.Text.Trim();
                if (str_enumList.IndexOf(',') > -1)
                {
                    var arr_enumList = str_enumList.Split(',');
                    foreach (var item in arr_enumList)
                    {
                        var arr_single = item.Split('|');
                        enumList.Add(new EnumModel()
                        {
                            EnumAttrName = arr_single[0],
                            EnumType = arr_single[1],
                            EnumTypeDesc = arr_single[2]
                        });
                    }
                }
                param.EnumList = enumList;
 
                //生成Model
                //CreateModelFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo);
                //CreateModelParamFile(columnList, tableName, filePrefixName, wcf_NameSpacePath, createPerson, chinaComment, entityName, modulelogo);
 
                #region 实体类
                var entityFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Dtos\" + tb_EntityName.Text.Trim();
                //1、生成 分页查询实体 文件
                str_generate = InputQueryModel_Generate.CreateQueryModelLText(param);
                tf = TextHelper.Export2File_V2(entityFilePath, $"Get{param.EntityName}Input.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //2、生成 CreateDto 文件
                str_generate = CreateDto_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(entityFilePath, $"{param.EntityName}CreateDto.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //3、生成 UpdateDto 文件
                str_generate = UpdateDto_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(entityFilePath, $"{param.EntityName}UpdateDto.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //4、生成 CreateOrUpdateDtoBase 文件
                str_generate = CreateOrUpdateDtoBase_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(entityFilePath, $"{param.EntityName}CreateOrUpdateDtoBase.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //5、生成 Dto 文件
                str_generate = Dto_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(entityFilePath, $"{param.EntityName}Dto.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //6、生成 Export 文件
                str_generate = ExportModel_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(entityFilePath, $"{param.EntityName}ExportModel.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //7、生成 Import 文件
                str_generate = ImportModel_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(entityFilePath, $"{param.EntityName}sImportModel.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                #endregion
 
                #region AppSerivice
 
                //8、生成 IAppService 文件
                var appServiceFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application.Contracts\Services";
                str_generate = IAppService_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(appServiceFilePath, $"I{param.EntityName}AppService.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //9、生成 AppService 文件
                appServiceFilePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Application\Implements";
                str_generate = AppService_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(appServiceFilePath, $"{param.EntityName}AppService.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
 
                #endregion
 
                #region Contorller
 
                //10、生成 Contorller 文件
                var continerlllePath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @"\Controller";
                str_generate = Controller_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(continerlllePath, $"{param.EntityName}Controller.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
 
                #endregion
 
                #region Domain
 
                //11、生成 IRepository 文件
                var iRepositoryPath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".Domain\" + tb_EntityName.Text.Trim(); ;
                str_generate = IRepository_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(iRepositoryPath, $"I{param.EntityName}Repository.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
 
                #endregion
 
                #region EntityFrameworkCore
 
                //12、生成 EfCoreRepository 文件
                var efCoreRepositoryPath = tbPath.Text + @"\server\src\CMS.Plugin." + tb_WCF_NameSpacePath.Text.Trim() + @".EntityFrameworkCore\Repositories";
                str_generate = EfCoreRepository_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(efCoreRepositoryPath, $"EfCore{param.EntityName}Repository.cs", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
 
                #endregion
 
                #region Web
                var webRootPath = tbPath.Text + @"\web\src\widgets\" + tb_EntityName.Text.Trim();
 
                //13、生成 Index 文件
                str_generate = Index_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(webRootPath, $"index.ts", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //14、生成 enum 文件
                str_generate = enum_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(webRootPath, $"enum.ts", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
 
                //15、生成 Controllers\File 文件
                str_generate = File_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(webRootPath+ @"\Controllers", $"File.ts", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                //16、生成 Controllers\EntityMode 文件
                str_generate = EntityMode_Generate.CreateText(param);
                tf = TextHelper.Export2File_V2(webRootPath + @"\Controllers", $"{tb_EntityName.Text.Trim()}.ts", tableName, str_generate, FileType.InputModel, filePrefixName, entityName, modulelogo);
 
                #endregion
 
 
 
                ////生成 OutputModel 文件
                //str_generate = OutputModel_Generate.CreateQueryModelLText(modulelogo, chinaComment, columnList, entityName);
                //tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.OutputModel, filePrefixName, entityName, modulelogo);
 
                ////生成Controller文件
                ////str_generate = Controller_Generate.CreateText(modulelogo, chinaComment, columnList, entityName, orderByName);
                ////tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.Controller, filePrefixName, entityName, modulelogo);
 
                ////生成Services接口文件
                //str_generate = Services_Interface_Generate.CreateText(wcf_NameSpacePath, modulelogo, entityName, chinaComment, addEntityParam);
                //tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.WCF_InterFace, filePrefixName, entityName, modulelogo);
 
 
                ////生成Services接口实现文件
                //str_generate = Services_InterfaceRealize_Generate.CreateText(wcf_NameSpacePath, modulelogo,
                //    entityName, chinaComment, filePrefixName, primaryKey, tableAlias, addEntityParam, columnList, groupName);
                //tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.WCF_InterFaceRealize, filePrefixName, entityName, modulelogo);
 
                /*
                //生成存储过程文件
                 str_generate = Procedure_Generate.CreateProcText(tableName, tableAlias, createPerson, chinaComment,
                    primaryKey, filePrefixName, orderByName, modulelogo, columnList);
                 tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.Proc, filePrefixName, entityName, modulelogo);
 
                //生成DAL文件
                str_generate = DAL_Generate.CreateDALText(filePrefixName, tableName, entityName, createPerson,
                   chinaComment, primaryKey, primaryKeyDesc, modulelogo, tableAlias, columnList);
                tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.DAL, filePrefixName, entityName, modulelogo);
 
                //生成BLL文件
                str_generate = BLL_Generate.CreateBLLText(filePrefixName, tableName, entityName, createPerson,
                   chinaComment, primaryKey, primaryKeyDesc, modulelogo, tableAlias, addEntityParam, columnList);
                tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.BLL, filePrefixName, entityName, modulelogo);
 
    
 
                //生成AddModel文件
                str_generate = AddModel_Generate.CreateAddModelLText(addEntityParam, chinaComment, columnList);
                tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.AddModelParam, filePrefixName, entityName, modulelogo);
 
 
              
 
                //*/
 
                //VUE方法配置
                //str_generate = VUE_FunConfig_Generate.CreateText(modulelogo, chinaComment, routePrefix, entityName);
                //tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.VUE_FunConfig, filePrefixName, entityName, modulelogo);
 
                //VUE文件
                //str_generate = VUE_Generate.CreateText(tableAlias, modulelogo, primaryKey, columnList, chinaComment
                //    , this.tb_templeteFileDownName.Text, this.tb_importExcelCategroy.Text);
                //tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.VUEFile, filePrefixName, entityName, modulelogo);
 
                //btn_InsertSql_Click(null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("生成文件失败!" + ex.Message);
                return;
            }
            //MessageBox.Show("生成文件成功!");
            //成功之后打开文件夹
            using (System.Diagnostics.Process.Start(this.tbPath.Text))
            {
 
            }
            //*/
        }
 
        #region 分类文件
 
        /// <summary>
        /// 生成Model
        /// </summary>
        /// <param name="_tableName"></param>
        private void CreateModelFile(List<ColumnModel> strList, string _tableName, string filePrefixName, string nameSpacePath,
            string createPerson, string chinaComment, string entityName, string modulelogo)
        {
            bool tf = TextHelper.Export2File(tbPath.Text, _tableName,
                Model_Generate.GenerateModel(_tableName, strList, filePrefixName, nameSpacePath, createPerson, chinaComment, entityName),
                FileType.Model, filePrefixName, entityName, modulelogo);
        }
 
        /// <summary>
        /// 生成Model参数
        /// </summary>
        /// <param name="_tableName"></param>
        private void CreateModelParamFile(List<ColumnModel> strList, string _tableName, string filePrefixName, string nameSpacePath,
            string createPerson, string chinaComment, string entityName, string modulelogo)
        {
            bool tf = TextHelper.Export2File(tbPath.Text, _tableName,
                Model_Generate.GenerateModelParam(_tableName, strList, filePrefixName, nameSpacePath, createPerson, chinaComment, entityName),
                FileType.Model, filePrefixName, entityName, modulelogo);
        }
        #endregion
 
        /// <summary>
        /// 文本改变事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void tb_TableName_TextChanged(object sender, EventArgs e)
        {
            string tableName = this.tb_TableName.Text.Trim();//表名
            if (tableName != "")
            {
                var str = CommonHelper.TitleToUpper(tableName);
                this.tb_FileName.Text = this.tb_EntityName.Text = str;
                var index = tableName.IndexOf('_');
                if (index > -1)
                {
                    var moule_str = tableName.Substring(index + 1, tableName.Length - index - 1);
                    this.tb_Modulelogo.Text = moule_str;
                    this.tb_EntityProName.Text = CommonHelper.TitleToLower(moule_str);
                }
                else
                {
                    this.tb_Modulelogo.Text = tableName;
                    this.tb_EntityProName.Text = CommonHelper.TitleToLower(tableName);
                }
            }
        }
 
        private void btn_InsertSql_Click(object sender, EventArgs e)
        {
            string connStr = this.lbl_DataSource.Text.Trim();//数据库连接字符串
            if (connStr == "")
            {
                MessageBox.Show("请选择数据库源!");
                this.cmb_DataSource.Focus();
                return;
            }
            var tableName = this.tb_TableName.Text.Trim();
            if (tableName == string.Empty)
            {
                MessageBox.Show("请输入表名!");
                return;
            }
            List<ColumnModel> columnList = StructStrHelper.GetColumnList(tableName, connStr);
            if (columnList.Count == 0)
            {
                MessageBox.Show("没有获取到表下面的列集合!");
                return;
            }
            string chinaComment = this.tb_ChinaComment.Text.Trim();//中文注释
            string createPerson = this.tb_CreatePerson.Text.Trim();//创建人
            var str_generate = InsertSQL_Generate.CreateInsertSQLText(tableName, createPerson, chinaComment, columnList);
            bool tf = TextHelper.Export2File(tbPath.Text, tableName, str_generate, FileType.SQL_Insert, "", "", "");
            //MessageBox.Show("生成文件成功!");
            //成功之后打开文件夹
            using (System.Diagnostics.Process.Start(this.tbPath.Text + "\\" + this.tb_TableName.Text))
            {
 
            }
        }
 
        private void label13_Click(object sender, EventArgs e)
        {
 
        }
 
        private void MainForm_Load(object sender, EventArgs e)
        {
            //tb_EntityProName.Enabled = false;
            tb_FileName.Enabled = false;
            tb_Modulelogo.Enabled = false;
            tb_WCF_NameSpacePath.Enabled = true;
            tb_RoutePrefix.Enabled = false;
        }
 
        private void cmb_DataSource_SelectedIndexChanged(object sender, EventArgs e)
        {
            string connStr = (this.cmb_DataSource.SelectedItem as ListItem).Value;
            var name = (this.cmb_DataSource.SelectedItem as ListItem).Text;
            this.lbl_DataSource.Text = connStr;
            dataBaseName = name;
            if (name == "GSiemens_LES")
            {
                this.tb_ProjectNamePrefix.Text = "LES";
            }
            else if (name == "GSiemens_WIP")
            {
                this.tb_ProjectNamePrefix.Text = "WIP";
            }
            else if (name.Contains("AoSinWms"))
            {
                this.tb_ProjectNamePrefix.Text = "AoSinWms";
            }
            else
            {
                this.tb_ProjectNamePrefix.Text = "Test";
            }
        }
 
        private void ck_IsShowImport_CheckedChanged(object sender, EventArgs e)
        {
            //this.tb_templeteFileDownName.Enabled = false;
            //this.tb_importExcelCategroy.Enabled = false;
            //if (this.ck_IsShowImport.Checked)
            //{
            //    this.tb_templeteFileDownName.Enabled = true;
            //    this.tb_importExcelCategroy.Enabled = true;
            //}
        }
 
        private void tb_EntityProName_TextChanged(object sender, EventArgs e)
        {
 
        }
 
        private void cmb_DataBase_SelectedIndexChanged(object sender, EventArgs e)
        {
            string connStr = (this.cmb_DataBase.SelectedItem as ListItem).Value;
            var name = (this.cmb_DataBase.SelectedItem as ListItem).Text;
 
            dataBaseEnum = (DataBaseEnum)Enum.Parse(typeof(DataBaseEnum), name);
        }
    }
}