public SiteGroupCms.Entity.Role GetEntity(int _roleid) { SiteGroupCms.Entity.Role role = new SiteGroupCms.Entity.Role(); using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [yy_roleinfo] WHERE [id]=" + _roleid; DataTable dt = _doh.GetDataTable(); SiteGroupCms.Dal.RightDal rightdal = new RightDal(); SiteGroupCms.Entity.Right right = new SiteGroupCms.Entity.Right(); if (dt.Rows.Count > 0) { role.Title = dt.Rows[0]["role"].ToString(); role.Id = _roleid; role.Rights = dt.Rows[0]["rights"].ToString(); role.Sort = Str2Int(dt.Rows[0]["sort"].ToString()); role.Description = dt.Rows[0]["description"].ToString(); string[] strs = role.Rights.Split(','); for (int i = 0; i < strs.Length - 1; i++) { role.Righttitle += rightdal.GetEntity(Str2Int(strs[i])).Title + ";"; } } } return(role); }
public DataTable GetDT(string where) { SiteGroupCms.Entity.Right right = new SiteGroupCms.Entity.Right(); using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [yy_rightinfo] WHERE " + where; DataTable dt = _doh.GetDataTable(); return(dt); } }
public SiteGroupCms.Entity.Right GetEntity(int _rightid) { SiteGroupCms.Entity.Right right = new SiteGroupCms.Entity.Right(); using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.SqlCmd = "SELECT * FROM [yy_rightinfo] WHERE [id]=" + _rightid; DataTable dt = _doh.GetDataTable(); if (dt.Rows.Count > 0) { right.Title = dt.Rows[0]["title"].ToString(); right.Id = _rightid; right.Sort = Str2Int(dt.Rows[0]["sort"].ToString()); right.Description = dt.Rows[0]["description"].ToString(); } } return(right); }
public void getroleinfo() { SiteGroupCms.Dal.RoleDal roledal = new SiteGroupCms.Dal.RoleDal(); SiteGroupCms.Entity.Role role = new SiteGroupCms.Entity.Role(); SiteGroupCms.Dal.RightDal rightdal = new SiteGroupCms.Dal.RightDal(); SiteGroupCms.Entity.Right right = new SiteGroupCms.Entity.Right(); if (id != "0") { role = roledal.GetEntity(Str2Int(id)); } if (role != null) { _response += "{\"IsError\":false,\"Message\":\"加载成功\",\"Data\":{\"id\":" + role.Id + ","; string[] strs = role.Rights.Split(','); for (int i = 0; i < strs.Length - 1; i++) { _response += "\"q" + strs[i] + "\":true,"; } _response += "\"title\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(role.Title) + ",\"description\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(role.Description); _response += "}}"; } Response.Write(_response); }
public void GetListJSON(int _thispage, int _pagesize, string _wherestr, ref string _jsonstr, string ordercol, string ordertype) { SiteGroupCms.Dal.RightDal rightdal = new RightDal(); SiteGroupCms.Entity.Right right = new SiteGroupCms.Entity.Right(); using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = _wherestr; string sqlStr = ""; int _countnum = _doh.Count("yy_roleinfo"); sqlStr = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_roleinfo", ordercol, _pagesize, _thispage, ordertype, _wherestr); _doh.Reset(); _doh.SqlCmd = sqlStr; DataTable dt = _doh.GetDataTable(); DataTable dt2 = new DataTable(); DataColumn col = new DataColumn("id", System.Type.GetType("System.String")); DataColumn col2 = new DataColumn("title", System.Type.GetType("System.String")); DataColumn col3 = new DataColumn("rights", System.Type.GetType("System.String")); DataColumn col4 = new DataColumn("description", System.Type.GetType("System.String")); dt2.Columns.Add(col); dt2.Columns.Add(col2); dt2.Columns.Add(col3); dt2.Columns.Add(col4); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt2.NewRow(); dr["id"] = dt.Rows[i]["id"]; dr["title"] = dt.Rows[i]["role"]; dr["rights"] = Getrighttitle(Str2Int(dt.Rows[i]["id"].ToString())); dr["description"] = dt.Rows[i]["description"].ToString(); dt2.Rows.Add(dr); } _jsonstr = SiteGroupCms.Utils.dtHelp.DT2JSON(dt2, _countnum); dt.Clear(); dt.Dispose(); } }