using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using WMS.DBUtility;
using WMS.IData.ICommon;
using WMS.IData;using Oracle.ManagedDataAccess.Client;
namespace WMS.SqlServerData.Common
{
public class CommonData : ICommon
{
public DataTable GetTable(string sql)
{
DataTable table = SystemDataObject.Instance.GetDataTable(sql);
return table;
}
///
/// 通过指定的字段属性查询数据
///
///
public DataTable GetCustomCtrlData(string tableName, string clmValue, string clmName, string whereSelect, string clmClassName)
{
string SqlStr = string.Empty;
if (string.IsNullOrEmpty(clmClassName))
{
SqlStr = "select " + clmValue + "," + clmName + " from " + tableName + " where 1 = 1 ";
}
else {
SqlStr = "select " + clmValue + "," + clmName + "," + clmClassName + " from " + tableName + " where 1 = 1 ";
}
if (whereSelect != "")
{
SqlStr = SqlStr + " and " + whereSelect;
}
SqlStr = SqlStr + "order by " + clmValue;
DataTable table = SystemDataObject.Instance.GetDataTable(SqlStr);
return table;
}
///
/// 返回通用查询的数据
///
/// 实体类的数据类型
///
///
///
///
public DataTable GetListData(List column, Dictionary clmValue, string tableName)
{
// T classType = new T();
// classType.GetType();
string clmTable = string.Empty;
foreach (var clm in column)
{
if (clmTable.Trim().Length == 0)
{
clmTable = clm;
}
else
{
clmTable = clmTable + "," + clm;
}
}
string whereTable = string.Empty;
foreach (var whe in clmValue)
{
if (whereTable.Trim().Length == 0)
{
whereTable = " where t." + whe.Key + " like '%" + whe.Value + "%'";
}
else
{
whereTable = " and t." + whe.Key + " like '%" + whe.Value + "%'";
}
}
string SqlStr = "select distinct " + clmTable + " from " + tableName + whereTable;
// List