82 lines
1.8 KiB
C#
82 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using DeiNiu.Data.BaseObject;
|
|
using System.Data;
|
|
|
|
namespace DeiNiu.wms.Logical
|
|
{
|
|
public class lbase
|
|
{
|
|
|
|
|
|
BaseModel _obj;
|
|
public lbase()
|
|
{
|
|
|
|
}
|
|
public lbase(int operId)
|
|
{
|
|
this._operId = operId;
|
|
}
|
|
|
|
|
|
/// <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 = "";
|
|
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;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|