92 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			92 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			C#
		
	
	
	
| using System;
 | |
| using System.Collections.Generic;
 | |
| using System.Linq;
 | |
| using System.Text;
 | |
| using DeiNiu.Data.BaseObject;
 | |
| using System.Data;
 | |
| using DeiNiu.wms.Data.Model;
 | |
| using DeiNiu.Utils;
 | |
| 
 | |
| namespace DeiNiu.wms.Logical
 | |
| {
 | |
|    public class lbase
 | |
|     { 
 | |
| 
 | |
|        BaseModel _obj;
 | |
|        public lbase()
 | |
|        {
 | |
|           
 | |
|        }
 | |
|        public lbase(int operId)
 | |
|        {
 | |
|            this._operId = operId;
 | |
|            initialConstants();
 | |
|        }
 | |
| 
 | |
| 
 | |
|        void initialConstants()
 | |
|        {
 | |
|             
 | |
| 
 | |
|        }
 | |
| 
 | |
|         /// <summary>
 | |
|         ///  query with like, return talbe and record cnt.
 | |
|         /// </summary>
 | |
|         public DataSet Query(string querystr, int rownumStart, int rownumEnd)
 | |
|         {
 | |
|             _obj = getModel();
 | |
|             if (rownumEnd > rownumStart && rownumStart > 0)
 | |
|             {
 | |
|                 _obj.rownumStart = rownumStart;
 | |
|                 _obj.rownumEnd = rownumEnd;
 | |
|             }
 | |
|             //  DataSet ds = string.IsNullOrEmpty(querystr) ? _obj.Query() : _obj.Query(querystr);
 | |
| 
 | |
|             if (string.IsNullOrEmpty(querystr))
 | |
|             {
 | |
|                 return _obj.Query("");
 | |
|             }
 | |
| 
 | |
|             string condition = "";
 | |
|          //   querystr = filtRiskChar(querystr);
 | |
|             string[] parameters = querystr.Split(";".ToCharArray());
 | |
|             foreach (string value in parameters)
 | |
|             {
 | |
|                 if (string.IsNullOrEmpty(value))
 | |
|                 {
 | |
|                     continue;
 | |
|                 }
 | |
| 
 | |
|                 string[] par = value.Split("#".ToCharArray());
 | |
|                 condition += par.Length == 0 ? "" : " and ";
 | |
|                 foreach (string p in par)
 | |
|                 {
 | |
|                     condition += p;
 | |
|                 }
 | |
| 
 | |
|             }
 | |
| 
 | |
|             return _obj.Query(condition);
 | |
| 
 | |
|         }
 | |
| 
 | |
|      
 | |
|         protected virtual BaseModel getModel()
 | |
|         {
 | |
|             return null;
 | |
|         }
 | |
| 
 | |
|         int _operId = 0;
 | |
|         public int operId
 | |
|         {
 | |
|             get { return _operId; }
 | |
|             set
 | |
|             {
 | |
|                 _operId = value;
 | |
|             }
 | |
|         }
 | |
| 
 | |
|     }
 | |
| }
 |