checkempright.cs

来自「专业的办公oa代码下载 c#语言编写 三层结构」· CS 代码 · 共 49 行

CS
49
字号
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Security.Cryptography;
using System.Text;

namespace qminoa.DA
{
	public class CheckEmpRight
	{
		public CheckEmpRight()
		{

		}
		public int GetEmpRight(int EmpID,string FuncName)
		{   
			SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"].ToString());
			SqlCommand myCommand = new SqlCommand("sysGetEmpRight", myConnection);
			myCommand.CommandType = CommandType.StoredProcedure;
			SqlParameter parameterEmpID = new SqlParameter("@empid", SqlDbType.Int, 4);
			parameterEmpID.Value = EmpID;
			myCommand.Parameters.Add(parameterEmpID);
			
			SqlParameter parameterFuncName = new SqlParameter("@funcname", SqlDbType.VarChar, 50);
			parameterFuncName.Value = FuncName;
			myCommand.Parameters.Add(parameterFuncName);
			SqlParameter parameterEmpRight = new SqlParameter("@userright", SqlDbType.Int, 4);
			parameterEmpRight.Direction = ParameterDirection.Output;
			myCommand.Parameters.Add(parameterEmpRight);

			myConnection.Open();
			myCommand.ExecuteNonQuery();
			myConnection.Close();
			if ((parameterEmpRight.Value != null) && (parameterEmpRight.Value != System.DBNull.Value)) 
			{
				return Convert.ToInt16(parameterEmpRight.Value);
			}
			else 
			{
				return -1;
			}
		}

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?