You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
191 lines
6.6 KiB
C#
191 lines
6.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Data;
|
|
using HomeService.DBHelper;
|
|
|
|
namespace HomeService.Utility
|
|
{
|
|
public class RangeUtil
|
|
{
|
|
#region 获取信息的基本函数
|
|
/// <summary>
|
|
/// 返回 某字段
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public string GetStrSQL(string strfield, string strSQL)
|
|
{
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, strSQL);
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
{
|
|
strSQL = DS.Tables[0].Rows[0]["" + strfield + ""].ToString();
|
|
}
|
|
else
|
|
{
|
|
strSQL = "";
|
|
}
|
|
return strSQL;
|
|
}
|
|
/// <summary>
|
|
/// 返回 数据集
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public DataSet GetAllSQL(string strSQL)
|
|
{
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, strSQL);
|
|
try
|
|
{
|
|
if (DS.Tables[0].Rows.Count <= 0)
|
|
{
|
|
DS = null;
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
DS = null;
|
|
}
|
|
return DS;
|
|
}
|
|
/// <summary>
|
|
/// 返回所有 分公司代码
|
|
/// </summary>
|
|
/// <param name="strUserID">用户GID</param>
|
|
/// <returns></returns>
|
|
public String GetCORPID(string strUserID)
|
|
{
|
|
string str = "select COMPANYID from user_company where USERID='" + strUserID + "' and COMPANYID in (select GID from [company] where ISDELETED=0 and ISDISABLE=0)";
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, str);
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
{
|
|
str = DS.Tables[0].Rows[0]["COMPANYID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
str = "";
|
|
}
|
|
return str;
|
|
}
|
|
/// <summary>
|
|
/// 返回所有 分公司名称
|
|
/// </summary>
|
|
/// <param name="strUserID">用户GID</param>
|
|
/// <returns></returns>
|
|
public String GetCORPNAME(string strCompanyID)
|
|
{
|
|
string str = "select top 1 [NAME] from company where GID='" + strCompanyID + "'";
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, str);
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
{
|
|
str = DS.Tables[0].Rows[0]["NAME"].ToString();
|
|
}
|
|
else
|
|
{
|
|
str = "";
|
|
}
|
|
return str;
|
|
}
|
|
/// <summary>
|
|
/// 返回有 分公司部门代码
|
|
/// </summary>
|
|
/// <param name="strUserID">用户GID</param>
|
|
/// <returns></returns>
|
|
public String GetDEPTGID(string strUserID)
|
|
{
|
|
string strcompanyid = GetCORPID(strUserID);
|
|
string str = "select GID from sys_dept where LINKID='" + strcompanyid + "' and DEPTNAME=(select top 1 DEPTNAME from user_baseinfo where USERID='" + strUserID + "')";
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, str);
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
{
|
|
str = DS.Tables[0].Rows[0]["GID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
str = "";
|
|
}
|
|
return str;
|
|
}
|
|
/// <summary>
|
|
/// 返回有 分公司部门名称
|
|
/// </summary>
|
|
/// <param name="strUserID">用户GID</param>
|
|
/// <returns></returns>
|
|
public String GetDEPTNAME(string strUserID)
|
|
{
|
|
string strcompanyid = GetCORPID(strUserID);
|
|
string str = "select top 1 DEPTNAME from user_baseinfo where USERID='" + strUserID + "' and COMPANYNAME=(select NAME from company where GID='" + strcompanyid + "')";
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, str);
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
{
|
|
str = DS.Tables[0].Rows[0]["DEPTNAME"].ToString();
|
|
}
|
|
else
|
|
{
|
|
str = "";
|
|
}
|
|
return str;
|
|
}
|
|
/// <summary>
|
|
/// 返回所有 用户显示名称
|
|
/// </summary>
|
|
/// <param name="strUserID">用户GID</param>
|
|
/// <returns></returns>
|
|
public String GetSHOWNAME(string strUserID)
|
|
{
|
|
string str = "select SHOWNAME from [user] where GID='" + strUserID + "' and ISDELETED=0";
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, str);
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
{
|
|
str = DS.Tables[0].Rows[0]["SHOWNAME"].ToString();
|
|
}
|
|
else
|
|
{
|
|
str = "";
|
|
}
|
|
return str;
|
|
}
|
|
/// <summary>
|
|
/// 返回所有 权限可视范围
|
|
/// </summary>
|
|
/// <param name="strUserID">登录用户</param>
|
|
/// <param name="strRange">模块列表名</param>
|
|
/// <returns></returns>
|
|
public String GetVISIBLERANGE(string strUserID, string strRange)
|
|
{
|
|
string str = "select VISIBLERANGE from VW_User_Authority where USERID='" + strUserID + "' and [NAME]='" + strRange + "' and ISDELETE=0";
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, str);
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
{
|
|
str = DS.Tables[0].Rows[0]["VISIBLERANGE"].ToString();
|
|
}
|
|
else
|
|
{
|
|
str = "";
|
|
}
|
|
return str;
|
|
}
|
|
/// <summary>
|
|
/// 返回所有 权限可操作范围
|
|
/// </summary>
|
|
/// <param name="strUserID">登录用户</param>
|
|
/// <param name="strRange">模块列表名</param>
|
|
/// <returns></returns>
|
|
public String GetOPERATERANGE(string strUserID, string strRange)
|
|
{
|
|
string str = "select OPERATERANGE from VW_User_Authority where USERID='" + strUserID + "' and [NAME]='" + strRange + "' and ISDELETE=0";
|
|
DataSet DS = SqlHelper.ExecuteDataset(SqlHelper._connectionStringStr, str);
|
|
if (DS.Tables[0].Rows.Count > 0)
|
|
{
|
|
str = DS.Tables[0].Rows[0]["OPERATERANGE"].ToString();
|
|
}
|
|
else
|
|
{
|
|
str = "";
|
|
}
|
|
return str;
|
|
}
|
|
#endregion
|
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
}
|
|
} |