SVN r1120
SVN-Revision: r1120
This commit is contained in:
@@ -80,7 +80,11 @@ namespace Lskj.Business.Impl
|
||||
/// <returns><c>true</c> if [has contain column]; otherwise, <c>false</c>.</returns>
|
||||
public static bool HasExistsColumn(string tableName, string colName)
|
||||
{
|
||||
string sqlValue = string.Format("select 1 from sys.columns where object_id=object_id('{0}') and name='{1}'", tableName, colName);
|
||||
string sqlValue = string.Format("select object_id from sys.columns where object_id = object_id('{0}') and name = '{1}'", tableName, colName);
|
||||
if (SqlHelper.ConnectionType == ConnectionType.DmServer)
|
||||
{
|
||||
sqlValue = string.Format("select COLUMN_NAME from ALL_TAB_COLUMNS where TABLE_NAME = '{0}' and COLUMN_NAME = '{1}'", tableName, colName);
|
||||
}
|
||||
return SqlHelper.ExecuteDataTable(sqlValue).Rows.Count > 0;
|
||||
}
|
||||
/// <summary>
|
||||
@@ -507,7 +511,7 @@ namespace Lskj.Business.Impl
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <param name="parameters">The parameters.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static int ExecSqlValue(string sqlValue, params SqlParameter[] parameters)
|
||||
public static int ExecSqlValue(string sqlValue, params DbParameter[] parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -531,7 +535,7 @@ namespace Lskj.Business.Impl
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <param name="parameters">The parameters.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static int ExecSqlValueMes(string sqlValue, params SqlParameter[] parameters)
|
||||
public static int ExecSqlValueMes(string sqlValue, params DbParameter[] parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -556,7 +560,7 @@ namespace Lskj.Business.Impl
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <param name="parameters">The parameters.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
public static int ExecSqlValue(string sqlValue, DbTransaction Trans, params SqlParameter[] parameters)
|
||||
public static int ExecSqlValue(string sqlValue, DbTransaction Trans, params DbParameter[] parameters)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -594,8 +598,9 @@ namespace Lskj.Business.Impl
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <param name="parameters">The parameters.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public static int ExecProcedure(string sqlValue, params DbParameter [] parameters)
|
||||
public static int ExecProcedure(string sqlValue, params DbParameter[] parameters)
|
||||
{
|
||||
|
||||
return SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, sqlValue, parameters);
|
||||
|
||||
}
|
||||
@@ -611,7 +616,7 @@ namespace Lskj.Business.Impl
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <param name="parameters">The parameters.</param>
|
||||
/// <returns>System.Object.</returns>
|
||||
public static int ExecProcedure(string sqlValue, DbTransaction Trans, params DbParameter[] parameters)
|
||||
public static int ExecProcedure(string sqlValue, DbTransaction Trans, params DbParameter[] parameters)
|
||||
{
|
||||
|
||||
return SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure, sqlValue, Trans, 1, parameters);
|
||||
@@ -649,7 +654,7 @@ namespace Lskj.Business.Impl
|
||||
/// <exception cref="System.NotImplementedException"></exception>
|
||||
public static string GetBasePrimaryKey(string menuCode)
|
||||
{
|
||||
string sqlValue = "select top 1 fieldname from P_systemwordbooktab where tab=@tab order by orderid";
|
||||
string sqlValue = "select top 1 fieldname from P_systemwordbooktab where tab = @tab order by orderid";
|
||||
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue, new SqlParameter[] { new SqlParameter("@tab", menuCode) });
|
||||
|
||||
return (dtTable.Rows.Count > 0) ? dtTable.Rows[0]["fieldname"] + "" : string.Empty;
|
||||
@@ -670,6 +675,10 @@ namespace Lskj.Business.Impl
|
||||
string viewColumn = string.Empty;
|
||||
string targetColumn = string.Empty;
|
||||
string sqlValue = "select name from sys.columns where object_id=object_id('p_SubsysPurviewTab') and name like '%purview'";
|
||||
if (SqlHelper.ConnectionType == ConnectionType.DmServer)
|
||||
{
|
||||
sqlValue = "select COLUMN_NAME name from ALL_TAB_COLUMNS where TABLE_NAME = 'p_SubsysPurviewTab' and COLUMN_NAME like '%purview%'";
|
||||
}
|
||||
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue);
|
||||
|
||||
if (dtTable.Rows.Count == 0)
|
||||
@@ -756,44 +765,6 @@ namespace Lskj.Business.Impl
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 替换特殊字符 {#p_
|
||||
/// </summary>
|
||||
/// <param name="defaultValue"></param>
|
||||
/// <param name="parentValue"></param>
|
||||
/// <param name="otherParams"></param>
|
||||
/// <returns></returns>
|
||||
public static string SpecialReplacement(string defaultValue,string[] otherParams = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(defaultValue)) return defaultValue;
|
||||
|
||||
if (defaultValue.ToLower().Contains("{#p_"))
|
||||
{
|
||||
try
|
||||
{
|
||||
List<string> paramList = ReplaceHelper.GetParamFields(defaultValue);
|
||||
|
||||
foreach (var item in paramList)
|
||||
{
|
||||
string index = item.Replace("{#p_", "").Replace("}", "");
|
||||
int i = 0;
|
||||
if (int.TryParse(index, out i))
|
||||
{
|
||||
defaultValue = defaultValue.Replace(item, otherParams != null ? otherParams[i - 1] : "");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:获取记录</para>
|
||||
/// <para>创建人:龚宇超</para>
|
||||
@@ -846,7 +817,7 @@ namespace Lskj.Business.Impl
|
||||
/// </summary>
|
||||
/// <param name="sqlValue">The SQL value.</param>
|
||||
/// <returns>System.String.</returns>
|
||||
public static object GetResult(string sqlValue, DbTransaction Trans)
|
||||
public static object GetResult(string sqlValue, DbTransaction Trans)
|
||||
{
|
||||
return SqlHelper.ExecuteScalar(sqlValue, Trans);
|
||||
}
|
||||
@@ -916,7 +887,7 @@ namespace Lskj.Business.Impl
|
||||
/// <returns>DataRow.</returns>
|
||||
public static DataRow GetSystemTab()
|
||||
{
|
||||
string sqlValue = "select * from dbo.p_systemtab";
|
||||
string sqlValue = "select * from p_systemtab";
|
||||
return GetDataRowResult(sqlValue);
|
||||
}
|
||||
/// <summary>
|
||||
@@ -1022,10 +993,9 @@ namespace Lskj.Business.Impl
|
||||
/// <returns>SqlDataAdapter.</returns>
|
||||
public static DbDataAdapter GetAdapterResult(string sqlValue)
|
||||
{
|
||||
DbDataAdapter dbDataAdapter = SqlHelper.dbFactory.CreateDataAdapter();
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(sqlValue)) return dbDataAdapter;
|
||||
if (string.IsNullOrWhiteSpace(sqlValue)) return null;
|
||||
sqlValue = GetDefaultValue(sqlValue);
|
||||
sqlValue = ReplaceHelper.ReplaceParam(sqlValue);
|
||||
return SqlHelper.ExecuteAdapter(CommandType.Text, sqlValue);
|
||||
@@ -1033,7 +1003,7 @@ namespace Lskj.Business.Impl
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return dbDataAdapter;
|
||||
return null;
|
||||
}
|
||||
/// <summary>
|
||||
/// <para>说明:获取打印配置</para>
|
||||
@@ -1089,7 +1059,7 @@ namespace Lskj.Business.Impl
|
||||
/// <param name="tagid"></param>
|
||||
/// <param name="mid"></param>
|
||||
/// <returns></returns>
|
||||
public static int deleteFlow(int tagid, string Dllcode, string stepCode, int typeID, out string tipMsg, DbTransaction Trans)
|
||||
public static int deleteFlow(int tagid, string Dllcode, string stepCode, int typeID, out string tipMsg, DbTransaction Trans)
|
||||
{
|
||||
SqlParameter pMsg = new SqlParameter("@msg", SqlDbType.VarChar, 2000);
|
||||
pMsg.Direction = ParameterDirection.Output;
|
||||
@@ -1190,8 +1160,9 @@ namespace Lskj.Business.Impl
|
||||
/// <returns></returns>
|
||||
public static string GetPrimaryKey(string TableName)
|
||||
{
|
||||
string sqlValue = string.Format("SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME='{0}'", TableName);
|
||||
DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue);
|
||||
//string sqlValue = string.Format("SELECT TABLE_NAME,COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME='{0}'", TableName);
|
||||
DataTable dtTable = MainImpl.GetDatabaseProperty(TableName);
|
||||
//DataTable dtTable = SqlHelper.ExecuteDataTable(sqlValue);
|
||||
return (dtTable.Rows.Count > 0) ? dtTable.Rows[0]["COLUMN_NAME"] + "" : string.Empty;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user