1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <#@ template debug="false" hostspecific="false" language="C#" #>
- <#@ output extension=".cs" #>
- <#@ assembly name="System.Xml" #>
- <#@ assembly name="System.Data" #>
- <#
- System.Data.SqlClient.SqlConnection db = new System.Data.SqlClient.SqlConnection("Data Source=192.168.0.66\\LIOT; User Id=sa; Password=1; Initial Catalog=LIOT.Exam");
- System.Data.DataTable dtDictionaryItem = new System.Data.DataTable();
- System.Data.SqlClient.SqlDataAdapter daDictionaryItem = new System.Data.SqlClient.SqlDataAdapter("select * from Sys_Dictionary", db);
-
- db.Open();
- daDictionaryItem.Fill(dtDictionaryItem);
- #>
- using System;
- namespace EMIS.ViewModel
- {
- [Serializable]
- public enum DictionaryItem
- {
- <#
- for (int j = 0; j < dtDictionaryItem.Rows.Count; j ++)
- {
- System.Data.DataRow dr = dtDictionaryItem.Rows[j];
- string enumItem = "";
- enumItem += @"///<summary>
- ///" + dr["Name"] + @"
- ///</summary>
- ";
- enumItem += dr["DictionaryCode"];
- if (j != dtDictionaryItem.Rows.Count - 1)
- {
- enumItem += ",";
- }
- #>
- <#= enumItem#>
- <#}
- #>}
-
- <#
- for (int i = 0; i < dtDictionaryItem.Rows.Count; i ++)
- {
- System.Data.DataRow dr = dtDictionaryItem.Rows[i];
- string enumItem = "";
- enumItem += @" ///<summary>
- ///" + dr["Name"] + @"
- ///</summary>
- [Serializable]
- ";
- enumItem += "public enum " + dr["DictionaryCode"];
- #>
- <#= enumItem#>
- {
- <#
- System.Data.SqlClient.SqlDataAdapter daDictionaryItemElement = new System.Data.SqlClient.SqlDataAdapter(@"
- select di.*
- from Sys_DictionaryItem di
- inner join Sys_Dictionary d on di.DictionaryCode=d.DictionaryCode
- where di.DictionaryCode='" + dr["DictionaryCode"] + "' and (di.IsEditable=0 or d.IsEditable=0)", db);
- System.Data.DataTable dtDictionaryItemElement = new System.Data.DataTable();
- daDictionaryItemElement.Fill(dtDictionaryItemElement);
- for (int j = 0; j < dtDictionaryItemElement.Rows.Count; j ++)
- {
- System.Data.DataRow drElement = dtDictionaryItemElement.Rows[j];
- string elementItem = "";
- elementItem += @"///<summary>
- ///" + drElement["Name"] + " -- " + drElement["Value"] + @"
- ///</summary>
- [System.ComponentModel.Description(""" + drElement["Name"] + @""")]
- ";
- elementItem += drElement["Code"] + " = " + drElement["Value"].ToString();
- if (j != dtDictionaryItemElement.Rows.Count - 1)
- {
- elementItem += ",";
- }#>
- <#= elementItem#>
- <#}
- #>
- }
- <#}
- #>
- }
|