| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 |
- using Castle.ActiveRecord;
- using System;
- using System.Data;
- using System.Text;
- namespace BizCom
- {
- [ActiveRecord("CE_ErpPermission ")]
- public class CeErpPermission : ComBase<CeErpPermission>
- {
- /// <summary>
- /// ÄÚ²¿±àºÅ
- /// </summary>
- [PrimaryKey(PrimaryKeyType.Native)]
- public int ID { get; set; }
- private int _orgID = 0;
- /// <summary>
- ///×éÖ¯±àºÅ
- /// </summary>
- [Property]
- public int OrgID
- {
- get { return _orgID; }
- set { _orgID = value; }
- }
- private int _postID = 0;
- /// <summary>
- ///ְλ±àºÅ
- /// </summary>
- [Property]
- public int PostID
- {
- get { return _postID; }
- set { _postID = value; }
- }
- private int _modularID = 0;
- /// <summary>
- ///Ä£¿é±àºÅ
- /// </summary>
- [Property]
- public int ModularID
- {
- get { return _modularID; }
- set { _modularID = value; }
- }
- public static DataTable GetErpPermission(object uid)
- {
- string sql = string.Format("select ModularID as ID,Name,code,Tag,Url,Icon,ParentID,IsOperate from view_erppermission where PostID={0} and isDel=0 order by sort asc ", uid);
- return ExecuteDataset(sql).Tables[0];
- }
- public static DataTable GetErpAllPermission()
- {
- string sql = string.Format("select ID,Name,Tag,Url,Icon,ParentID,IsOperate from ce_erpmodular where isDel=0 order by sort asc ");
- return ExecuteDataset(sql).Tables[0];
- }
- public static DataTable GetPermission(string pId, string oId)
- {
- string sql = "select ModularID as ID from view_erppermission where orgid={0} and postID={1} and isDel=0 ";
- return DbConn.ExecuteDataset(string.Format(sql, oId, pId)).Tables[0];
- }
- public static void SaveOrgPermission(string oId, string v)
- {
- StringBuilder sqlList = new StringBuilder();
- sqlList.AppendFormat("delete from Ce_ErpPermission where OrgID={0} and PostID=0 ;", oId);
- if (v.Length > 0)
- {
- //Ä£¿éÖµ
- string[] sArr = v.Split(',');
- foreach (string arr in sArr)
- {
- sqlList.AppendFormat("insert into Ce_ErpPermission(OrgID,ModularID) Values({0},{1}); ", oId, arr);
- }
- }
- try
- {
- DbConn.ExecuteNonQuery(sqlList.ToString());
- }
- catch (Exception)
- {
- throw;
- }
- }
- public static void SavePostPermission(string pId, string oId, string v)
- {
- StringBuilder sqlList = new StringBuilder();
- sqlList.AppendFormat("delete from Ce_ErpPermission where OrgID={0} and PostID={1} ;", oId, pId);
- if (v.Length > 0)
- {
- //Ä£¿éÖµ
- string[] sArr = v.Split(',');
- foreach (string arr in sArr)
- {
- sqlList.AppendFormat("insert into Ce_ErpPermission(OrgID,PostID,ModularID) Values({0},{1},{2}); ", oId, pId, arr);
- }
- }
- try
- {
- DbConn.ExecuteNonQuery(sqlList.ToString());
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
- }
|