151 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			151 lines
		
	
	
		
			3.6 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Text; | |||
|  | using System.Data; | |||
|  | using System.Configuration; | |||
|  | 
 | |||
|  | 
 | |||
|  | namespace DeiNiu.Data.BaseObject | |||
|  | { | |||
|  |     [Serializable] | |||
|  |     public abstract class BaseModel :BaseOperModel | |||
|  |     { | |||
|  |         internal int custOperFlag = 0;      | |||
|  |         public BaseModel() | |||
|  |         { | |||
|  |             getImp(); | |||
|  |         } | |||
|  |         public  BaseModel(DataRow dr) | |||
|  |         { | |||
|  |             getModel(dr);  | |||
|  |         } | |||
|  |         public BaseModel(System.Data.SqlClient.SqlConnection _Conn) | |||
|  |               | |||
|  |         { | |||
|  |             getImp(); | |||
|  |             model_imp._Conn = _Conn; | |||
|  | 
 | |||
|  | 
 | |||
|  |         } | |||
|  |        protected BaseModel_Imp model_imp; | |||
|  |         public int Add() | |||
|  |         { | |||
|  |             _operater = DeiNiu.Utils.WmsConstants.CURRENT_USER_ID;  | |||
|  |             return model_imp.Add(this); | |||
|  |         } | |||
|  | 
 | |||
|  |         public int Update() | |||
|  |         { | |||
|  |             _operater = DeiNiu.Utils.WmsConstants.CURRENT_USER_ID; | |||
|  |             _lastmodified = getDateTime(); | |||
|  |             return model_imp.Update(this); | |||
|  |         } | |||
|  | 
 | |||
|  |         public int Delete() | |||
|  |         { | |||
|  |            return model_imp.Delete(this); | |||
|  |         } | |||
|  |         public int rownumStart | |||
|  |         { | |||
|  |             get { return model_imp.rownumStart; } | |||
|  |             set { model_imp.rownumStart = value; } | |||
|  |         } | |||
|  | 
 | |||
|  |         public int rownumEnd | |||
|  |         { | |||
|  |             get { return model_imp.rownumEnd; } | |||
|  |             set { model_imp.rownumEnd = value; } | |||
|  |         } | |||
|  | 
 | |||
|  |         public int QueryCount() | |||
|  |         { | |||
|  |             string tmp = model_imp.QueryCount().Tables[0].Rows[0][0].ToString(); | |||
|  |             return tmp != string.Empty | |||
|  |                        ? Convert.ToInt32(tmp) | |||
|  |                        : 0; | |||
|  | 
 | |||
|  |         } | |||
|  |         public DataSet QueryActived() | |||
|  |         { | |||
|  |             return model_imp.QueryActived(); | |||
|  |         } | |||
|  |         public DataSet Query(BaseModel exampleObj) | |||
|  |         { | |||
|  |             return model_imp.Query(exampleObj); | |||
|  |         } | |||
|  |         public DataSet Query() | |||
|  |         { | |||
|  |             return model_imp.Query(); | |||
|  |         } | |||
|  |         protected DataSet CustQuery(int custOperFlag) | |||
|  |         { | |||
|  |             this.custOperFlag = custOperFlag; | |||
|  |             return model_imp.CustQuery(this); | |||
|  |         } | |||
|  |          | |||
|  |         protected int CustOper(int custOperFlag) | |||
|  |         { | |||
|  |             this.custOperFlag = custOperFlag; | |||
|  |             return model_imp.CustOper(this); | |||
|  |         } | |||
|  | 
 | |||
|  | 
 | |||
|  |         public void getModel(DataRow dr) | |||
|  |         { | |||
|  | 
 | |||
|  |             model_imp.getModel(this, dr); | |||
|  |         } | |||
|  |         public void getModel() | |||
|  |         { | |||
|  |             custOperFlag = 0;  //2010.1.3 | |||
|  |            model_imp.getModel(this); | |||
|  |         } | |||
|  |         public void getModel(int custOperFlag) | |||
|  |         { | |||
|  |             this.custOperFlag = custOperFlag; | |||
|  |             model_imp.getModel(this); | |||
|  |         } | |||
|  |         /*private void getImp() | |||
|  |         { | |||
|  |             Type tp = GetType(); | |||
|  |             String impClassName = getImpClassName(tp.FullName); | |||
|  |            // impClassName = "DeiNiu.wms.Data.Model.Department_Imp"; | |||
|  |             Type tpImp = tp.Assembly.GetType(impClassName); | |||
|  |              model_imp = (BaseModel_Imp)System.Activator.CreateInstance(tpImp); | |||
|  |         } | |||
|  |         */ | |||
|  |         protected virtual void getImp() | |||
|  |         { | |||
|  |         } | |||
|  | 
 | |||
|  |         private String getImpClassName(String ClassName) | |||
|  |         { | |||
|  |             return ClassName + "_Imp"; | |||
|  |            | |||
|  |         } | |||
|  | 
 | |||
|  |         public DataSet Query(string condition) | |||
|  |         { | |||
|  |             cmdParameters[0] = condition; | |||
|  |             return CustQuery(99); | |||
|  |         } | |||
|  |         public int getNextSeq() | |||
|  |         { | |||
|  |             return model_imp.getSequence("seqOrderNo"); | |||
|  |         } | |||
|  |         /// <summary> | |||
|  |         /// <20><>ȡ<EFBFBD><C8A1><EFBFBD>ݿ<EFBFBD><DDBF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> | |||
|  |         /// </summary> | |||
|  |         /// <returns></returns> | |||
|  |         public string getDateTime() | |||
|  |         { | |||
|  |             return model_imp.getDateTime(); | |||
|  |         } | |||
|  | 
 | |||
|  |     } | |||
|  |      | |||
|  | 
 | |||
|  | 
 | |||
|  | 
 | |||
|  | } |