53 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
		
		
			
		
	
	
			53 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
|  | <%@ CodeTemplate Language="C#" TargetLanguage="Text" Description="This template demonstrates using properties defined in external assemblies." %> | ||
|  | <%@ Property Name="SourceTable" Type="SchemaExplorer.TableSchema" Category="Context" Description="The table to use for this sample." %> | ||
|  | <%@ Assembly Name="SchemaExplorer" %> | ||
|  | <%@ Import Namespace="SchemaExplorer" %>  | ||
|  | <script runat="template"> | ||
|  | public string getObjClassName() | ||
|  | {  | ||
|  | 	string tablename = this.SourceTable.Name.Substring(2); | ||
|  |     string firstChar = tablename.Substring(0,1); | ||
|  |     string className = firstChar.ToUpper() + tablename.Substring(1); | ||
|  |     return className ; | ||
|  | } | ||
|  | </script> | ||
|  | 
 | ||
|  | /// <summary> | ||
|  | ///INTERFACE IMPLIMENT FOR TABLE <%=this.SourceTable.Name%> | ||
|  | ///By wm with codesmith.  | ||
|  | ///on <%= DateTime.Now.ToString("MM/dd/yyyy")%> | ||
|  | /// </summary> | ||
|  | 
 | ||
|  | using System; | ||
|  | using System.Data.SqlClient;  | ||
|  | namespace DeiNiu.wms.Data.Model | ||
|  | { | ||
|  |     [Serializable]  class <%= getObjClassName() %>_Imp : <%= getObjClassName() %>_base_Imp | ||
|  |     {  | ||
|  |         protected override void CmdPrepare(SqlCommand sqlCmd) | ||
|  |         {  | ||
|  |             base.CmdPrepare(sqlCmd); | ||
|  |             <%= getObjClassName() %> mObj = ( <%= getObjClassName() %>)modelObj; | ||
|  |             switch (_cust_op_flag) | ||
|  |             { | ||
|  |              case 99:  //query with dic | ||
|  |                     _strSql = "SELECT *,ROW_NUMBER() OVER (ORDER BY ID DESC) as sortNo  FROM <%=this.SourceTable.Name%>  WHERE DR = 1 " + mObj.CmdParameters[0].ToString(); | ||
|  |                     _strSql = "SELECT * FROM (" + _strSql + " )AS SORTEDTB WHERE sortNo BETWEEN @START AND @END" + " ORDER BY ID DESC"; | ||
|  |                     _strSql += ";SELECT COUNT(*) FROM <%=this.SourceTable.Name%>  WHERE DR = 1 " + mObj.CmdParameters[0].ToString(); | ||
|  |                     sqlCmd.CommandText = _strSql; | ||
|  |                     sqlCmd.Parameters.AddWithValue("@START", this._rownumStart); | ||
|  |                     sqlCmd.Parameters.AddWithValue("@END", this._rownumEnd); | ||
|  |                     sqlCmd.CommandText = _strSql; | ||
|  | 
 | ||
|  |                     break; | ||
|  |                 case 100:  //by name | ||
|  |                     _strSql = "SELECT * FROM <%=this.SourceTable.Name%> WHERE NAME = @NAME"; | ||
|  |                     sqlCmd.CommandText = _strSql;  | ||
|  |                      sqlCmd.Parameters.AddWithValue("@NAME",   mObj.CmdParameters[0]  ); | ||
|  |                     break; | ||
|  |      | ||
|  |                   | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | } |