PermissionDAL.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Common.Wechat;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Text;
  6. using ZcPeng.PublicLibrary;
  7. namespace CoreEntity.DAL
  8. {
  9. public class PermissionDAL
  10. {
  11. /// <summary>
  12. ///
  13. /// ContactId
  14. /// </summary>
  15. /// <param name="PushAccountId"></param>
  16. /// <param name="BusinessId"></param>
  17. /// <returns></returns>
  18. public static Tuple<string, string> getPermission(string permUri, string roleid)
  19. {
  20. string commandTextContact = "Select A.PermissionRule,PermissionRuleType From " + Config.TablePrefix+ "RoleRelatePermission A " +
  21. " left join " + Config.TablePrefix + "Permission B on A.PermissionId = B.Id " +
  22. "Where A.RoleId=@RoleId and B.PermissionUrl = @PermissionUrl";
  23. string resultContact;
  24. string rule = "";
  25. string ruletype = "";
  26. List<List<Object>> parametersContact = new List<List<Object>>();
  27. DataTable dt = new DataTable();
  28. if (permUri != null && roleid != null)
  29. {
  30. parametersContact.Add(new List<Object>() { "RoleId", roleid });
  31. parametersContact.Add(new List<Object>() { "PermissionUrl", permUri });
  32. DataAccess.GetValues(commandTextContact, ref dt, DataAccess.ToParameters(parametersContact).ToArray(), out resultContact);
  33. }
  34. if (dt !=null && dt.Rows.Count > 0)
  35. {
  36. rule = DBNull.Value == dt.Rows[0]["PermissionRule"] ? "":(string)dt.Rows[0]["PermissionRule"];
  37. ruletype = DBNull.Value == dt.Rows[0]["PermissionRuleType"] ? "" : (string)dt.Rows[0]["PermissionRuleType"];
  38. }
  39. return new Tuple<string, string>(rule, ruletype); ;
  40. }
  41. }
  42. }