137 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			137 lines
		
	
	
		
			2.8 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
 | |
| /// <summary>
 | |
| ///LOGIC CLASS FOR TABLE t_wmsStockRecord
 | |
| ///By wm with codesmith. 
 | |
| ///on 05/14/2017
 | |
| /// </summary>
 | |
| 
 | |
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using DeiNiu.wms.Data.Model;
 | |
| using System.Data;
 | |
| using System.Transactions;
 | |
| using DeiNiu.Data.BaseObject;
 | |
| 
 | |
| namespace DeiNiu.wms.Logical
 | |
| {
 | |
|     [Serializable]
 | |
|     public class lWmsStockRecord  :lbase
 | |
|     {
 | |
|         WmsStockRecord _obj;
 | |
|         public lWmsStockRecord()
 | |
|         {
 | |
|              initialize();
 | |
|         }
 | |
|  
 | |
|         public  WmsStockRecord getWmsStockRecord
 | |
|         {
 | |
|             get
 | |
|             {
 | |
|                 return _obj;
 | |
|             }
 | |
|         }
 | |
|   
 | |
| 		/// <summary>
 | |
| 		/// get all data
 | |
| 		/// </summary>
 | |
|         public DataSet getAllData()
 | |
|         {
 | |
|            return _obj.Query();
 | |
|         }
 | |
| 
 | |
|         protected override BaseModel getModel()
 | |
|         {
 | |
|             return _obj;
 | |
|         }
 | |
| 
 | |
| 
 | |
|         /// <summary>
 | |
|         /// get all data
 | |
|         /// </summary>
 | |
|         public DataSet getAllActiveData()
 | |
|         {
 | |
|             return _obj.QueryActived();
 | |
|         }
 | |
| 
 | |
| 
 | |
| 
 | |
| 		/// <summary>
 | |
| 		/// get a record by id
 | |
| 		/// </summary>
 | |
|         public void initialize(int id)
 | |
| 		{
 | |
|             _obj = id != 0 ? new WmsStockRecord(id) : new WmsStockRecord();
 | |
| 		}
 | |
| 
 | |
|         /// <summary>
 | |
| 		/// get a record by id 0
 | |
| 		/// </summary>
 | |
|         public void initialize()
 | |
|         {
 | |
|             initialize(0);
 | |
|         }
 | |
| 
 | |
|          /// <summary>
 | |
|         /// get a record by id
 | |
|         /// </summary>
 | |
|         public void initialize(DataRow dr)
 | |
|         {
 | |
|             _obj =   new WmsStockRecord(dr);
 | |
|         }
 | |
| 
 | |
|  
 | |
|         //begin cust db operation, query, excute sql etc.
 | |
|         
 | |
|      
 | |
| 
 | |
|          /// <summary>
 | |
|         ///  query with like, return talbe and record cnt.
 | |
|         /// </summary>
 | |
|         public DataSet Query(string namelike, int rownumStart, int rownumEnd)
 | |
|         {
 | |
|             if (rownumEnd > rownumStart && rownumStart > 0)
 | |
|             {
 | |
|                 _obj.rownumStart = rownumStart;
 | |
|                 _obj.rownumEnd = rownumEnd;
 | |
|             }
 | |
|             DataSet ds = string.IsNullOrEmpty(namelike) ? _obj.Query()  : _obj.QueryByName(namelike) ;
 | |
|             return ds;
 | |
|       
 | |
|         }  
 | |
| 
 | |
|         /// <summary>
 | |
|         /// update in a transaction scrop
 | |
|         /// </summary>
 | |
| 
 | |
|         public void update()
 | |
|         {
 | |
|             if (valid())
 | |
|             {
 | |
|                 using (TransactionScope scope = new TransactionScope())
 | |
|                 {
 | |
| 
 | |
|                     //Node tmp = new Node();
 | |
|                     //tmp.parentid = 1;
 | |
|                     //tmp.name = "test trans" + DateTime.Now;
 | |
|                     //tmp.description = "this is for transTest";
 | |
|                     //tmp.Add();
 | |
|                     _obj.Update();
 | |
| 
 | |
|                     scope.Complete();
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         
 | |
|          private bool valid()
 | |
|         {
 | |
|             return true;
 | |
|         }
 | |
|         
 | |
|   
 | |
|     }
 | |
|     
 | |
|     
 | |
| }
 | |
|   |