CheckEmpRight.cs
上传用户:autodoor
上传日期:2022-08-04
资源大小:9973k
文件大小:1k
- 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;
- }
- }
- }
- }