123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Models;
- using System.Data;
- using System.Data.SqlClient;
- namespace DAL
- {
- /// <summary>
- /// 功能权限多表联查数据访问类
- /// </summary>
- public class FunctionOperatingService
- {
- /// <summary>
- /// 读取方法
- /// </summary>
- /// <param name="t">对象</param>
- /// <param name="type">对象区分</param>
- /// <param name="sql">sql语句</param>
- /// <param name="cmdType">文本类型</param>
- /// <param name="param">可变参数数组</param>
- /// <returns>返回集合</returns>
- public List<FunctionOperating> excuteSql(string sql, params SqlParameter[] param)
- {
- List<FunctionOperating> foList = null;
- FunctionOperating fo = null;
- using (SqlDataReader dr = SqlHelper.ExcuteReader(sql, CommandType.Text, param))
- {
- if (dr != null)
- {
- foList = new List<FunctionOperating>();
- while (dr.Read())
- {
- fo = new FunctionOperating();
- fo.Name = dr["Name"].ToString();
- fo.Code = dr["Code"].ToString();
- fo.IsEnable = Convert.ToInt32(dr["IsEnable"]);
- fo.Uid = Convert.ToInt32(dr["Uid"]);
- foList.Add(fo);
- }
- }
- }
- return foList;
- }
- /// <summary>
- /// 根据用户编号获取数据
- /// </summary>
- /// <param name="uid"></param>
- /// <returns></returns>
- public List<FunctionOperating> GetAll(string code,int uid)
- {
- string sql = "select sf.[Name],sf.Code,sf.IsEnable,c.Uid from SystemFunction sf join Competence c on sf.Id = c.Sid where STable = 1 and IsEnable = 1 and Code = @Code and c.uid = @Uid";
- return excuteSql(sql, new SqlParameter("@Code", code), new SqlParameter("@Uid", uid));
- }
- }
- }
|