Web.cs.cmt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <#@ template language="c#" HostSpecific="True" #>
  2. <#@ output extension= ".cs" #>
  3. <#
  4. TableHost host = (TableHost)(Host);
  5. string ModelSpace = host.NameSpace+".Model."+ host.GetModelClass(host.TableName);
  6. string DALSpace= host.NameSpace+".BLL."+ host.GetBLLClass(host.TableName);
  7. ColumnInfo identityKey=host.IdentityKey;
  8. #>
  9. <# foreach (ColumnInfo c in host.Fieldlist)
  10. { #>
  11. <# if(c.IsIdentity) { continue; } #>
  12. <# if(CodeCommon.DbTypeToCS(c.TypeName).ToLower()=="string") { #>
  13. string <#=c.ColumnName#> = txt<#=c.ColumnName#>.Text; <# } #>
  14. <# if(CodeCommon.DbTypeToCS(c.TypeName).ToLower()=="int")
  15. {
  16. WriteLine("int {0} = int.Parse(txt{1}.Text);",c.ColumnName,c.ColumnName );
  17. }
  18. #>
  19. <# if(CodeCommon.DbTypeToCS(c.TypeName).ToLower()=="decimal")
  20. {
  21. WriteLine("decimal {0} = decimal.Parse(txt{1}.Text);",c.ColumnName,c.ColumnName );
  22. }
  23. #>
  24. <# if(CodeCommon.DbTypeToCS(c.TypeName).ToLower()=="bool")
  25. {
  26. WriteLine("bool {0} = chk{1}.Checked;",c.ColumnName,c.ColumnName );
  27. }
  28. #>
  29. <# if(CodeCommon.DbTypeToCS(c.TypeName).ToLower()=="datetime")
  30. {
  31. WriteLine("DateTime {0} = DateTime.Parse(txt{1}.Text);",c.ColumnName,c.ColumnName );
  32. }
  33. #>
  34. <# if(CodeCommon.DbTypeToCS(c.TypeName).ToLower()=="byte[]")
  35. {
  36. WriteLine("byte[] {0} = byte[].Parse(txt{1}.Text);",c.ColumnName,c.ColumnName );
  37. }
  38. #>
  39. <# } #>
  40. <#=ModelSpace#> model= new <#=ModelSpace#>();
  41. <# foreach (ColumnInfo c in host.Fieldlist)
  42. {
  43. if(c.IsIdentity) { continue; }
  44. WriteLine("model.{0} = {1}; ",c.ColumnName,c.ColumnName );
  45. } #>
  46. bll.Add(model);
  47. Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功!");