/// <summary> /// 得到列表JSON数据 /// </summary> /// <param name="_thispage">当前页码</param> /// <param name="_pagesize">每页记录条数</param> /// <param name="_wherestr">搜索条件</param> /// <param name="_jsonstr">返回值</param> public void GetListJSON(int _thispage, int _pagesize, string _wherestr, ref string _jsonstr, string ordercol, string ordertype) { SiteGroupCms.Entity.Admin _admin = new SiteGroupCms.Entity.Admin(); AdminDal _adminobj = new AdminDal(); CatalogDal catadalobj = new CatalogDal(); using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = _wherestr; string sqlStr = ""; int _countnum = _doh.Count("yy_templateinfo"); sqlStr = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_templateinfo", 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("type", System.Type.GetType("System.String")); DataColumn col3 = new DataColumn("title", System.Type.GetType("System.String")); DataColumn col4 = new DataColumn("source", System.Type.GetType("System.String")); DataColumn col5 = new DataColumn("addtime", System.Type.GetType("System.String")); DataColumn col6 = new DataColumn("filename", System.Type.GetType("System.String")); dt2.Columns.Add(col); dt2.Columns.Add(col2); dt2.Columns.Add(col3); dt2.Columns.Add(col4); dt2.Columns.Add(col5); dt2.Columns.Add(col6); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt2.NewRow(); dr["id"] = dt.Rows[i]["id"]; dr["title"] = dt.Rows[i]["title"]; dr["source"] = dt.Rows[i]["source"]; if (dt.Rows[i]["type"].ToString() == "1") { dr["type"] = "系统首页"; } else if (dt.Rows[i]["type"].ToString() == "2") { dr["type"] = "栏目页"; } else if (dt.Rows[i]["type"].ToString() == "3") { dr["type"] = "内容页"; } else { dr["type"] = "公共页"; } dr["addtime"] = String.Format("{0:g}", SiteGroupCms.Utils.Validator.StrToDate(dt.Rows[i]["addtime"].ToString(), DateTime.Now)); dr["filename"] = dt.Rows[i]["filename"]; dt2.Rows.Add(dr); } _jsonstr = SiteGroupCms.Utils.dtHelp.DT2JSON(dt2, _countnum); dt.Clear(); dt.Dispose(); } }
public void loaddata() { SiteGroupCms.Dal.AdminDal admindal = new Dal.AdminDal(); Repeater1.DataSource = admindal.GetpersonDT("job like '%总顾问%'", " sort asc, id asc"); Repeater1.DataBind(); Repeater2.DataSource = admindal.GetpersonDT("job like '%主管%'", "sort asc, id asc"); Repeater2.DataBind(); Repeater3.DataSource = admindal.Getdepartdt("商务组", "sort asc, id asc"); Repeater3.DataBind(); Repeater4.DataSource = admindal.Getdepartdt("美工组", "sort asc, id asc"); Repeater4.DataBind(); Repeater5.DataSource = admindal.Getdepartdt("程序组", "sort asc, id asc"); Repeater5.DataBind(); Repeater6.DataSource = admindal.Getdepartdt("往期成员", "sort asc, id asc"); Repeater6.DataBind(); }
/// <summary> /// 得到列表JSON数据 /// </summary> /// <param name="_thispage">当前页码</param> /// <param name="_pagesize">每页记录条数</param> /// <param name="_joinstr">关联条件</param> /// <param name="_wherestr">分页条件(不带A.)</param> /// <param name="_jsonstr">返回值</param> public void GetListJSON(int _thispage, int _pagesize, string _wherestr, ref string _jsonstr) { using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = _wherestr; string sqlStr = ""; int _countnum = _doh.Count("yy_loginfo"); sqlStr = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_loginfo", "id", _pagesize, _thispage, "desc", _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("type", System.Type.GetType("System.String")); DataColumn col3 = new DataColumn("douser", System.Type.GetType("System.String")); DataColumn col4 = new DataColumn("doip", System.Type.GetType("System.String")); DataColumn col5 = new DataColumn("dotime", System.Type.GetType("System.String")); dt2.Columns.Add(col); dt2.Columns.Add(col2); dt2.Columns.Add(col3); dt2.Columns.Add(col4); dt2.Columns.Add(col5); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt2.NewRow(); dr["id"] = dt.Rows[i]["id"].ToString(); dr["type"] = new DoDal().GetEntity(Str2Int(dt.Rows[i]["dotype"].ToString())).Dotype; dr["dotime"] = String.Format("{0:g}", SiteGroupCms.Utils.Validator.StrToDate(dt.Rows[i]["dotime"].ToString(), DateTime.Now)); dr["doip"] = dt.Rows[i]["doip"].ToString(); dr["douser"] = new AdminDal().GetEntity(dt.Rows[i]["douserid"].ToString()).UserName; dt2.Rows.Add(dr); } _jsonstr = SiteGroupCms.Utils.dtHelp.DT2JSON(dt2, _countnum); dt.Clear(); dt.Dispose(); dt2.Clear(); dt2.Dispose(); } }
/// <summary> /// 得到列表JSON数据 /// </summary> /// <param name="_thispage">当前页码</param> /// <param name="_pagesize">每页记录条数</param> /// <param name="_wherestr">搜索条件</param> /// <param name="_jsonstr">返回值</param> public void GetListJSON(int _thispage, int _pagesize, string _wherestr, ref string _jsonstr, string ordercol, string ordertype) { SiteGroupCms.Entity.Admin _admin = new SiteGroupCms.Entity.Admin(); AdminDal _adminobj = new AdminDal(); using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = _wherestr; string sqlStr = ""; int _countnum = _doh.Count("yy_deptinfo"); sqlStr = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_deptinfo", 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("name", System.Type.GetType("System.String")); DataColumn col3 = new DataColumn("TotalNum", 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); SiteGroupCms.Dal.AdminDal Admindal = new SiteGroupCms.Dal.AdminDal(); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt2.NewRow(); dr["id"] = dt.Rows[i]["id"]; dr["name"] = dt.Rows[i]["dept"]; dr["description"] = dt.Rows[i]["description"]; dr["TotalNum"] = Admindal.GetDeptNum(dt.Rows[i]["id"].ToString()).ToString(); dt2.Rows.Add(dr); } _jsonstr = SiteGroupCms.Utils.dtHelp.DT2JSON(dt2, _countnum); dt.Clear(); dt.Dispose(); } }
/// <summary> /// 得到列表JSON数据 /// </summary> /// <param name="_thispage">当前页码</param> /// <param name="_pagesize">每页记录条数</param> /// <param name="_wherestr">搜索条件</param> /// <param name="_jsonstr">返回值</param> public void GetListJSON(int _thispage, int _pagesize, string _wherestr, ref string _jsonstr, string ordercol, string ordertype) { SiteGroupCms.Entity.Admin _admin = new SiteGroupCms.Entity.Admin(); AdminDal _adminobj = new AdminDal(); using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = _wherestr; string sqlStr = ""; int _countnum = _doh.Count("yy_noticeinfo"); sqlStr = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_noticeinfo", 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("senduser", System.Type.GetType("System.String")); DataColumn col4 = new DataColumn("sendtime", System.Type.GetType("System.String")); DataColumn col5 = new DataColumn("isread", System.Type.GetType("System.String")); dt2.Columns.Add(col); dt2.Columns.Add(col2); dt2.Columns.Add(col3); dt2.Columns.Add(col4); dt2.Columns.Add(col5); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt2.NewRow(); dr["id"] = dt.Rows[i]["id"]; if (dt.Rows[i]["isread"].ToString() == "0") { dr["title"] = "<span style=color:red>" + dt.Rows[i]["title"].ToString() + "</span>"; } else { dr["title"] = dt.Rows[i]["title"].ToString(); } if (dt.Rows[i]["senduserid"].ToString() != "" && dt.Rows[i]["senduserid"].ToString() != "0") { if (_adminobj.GetEntity(dt.Rows[i]["senduserid"].ToString()) != null) { dr["senduser"] = _adminobj.GetEntity(dt.Rows[i]["senduserid"].ToString()).UserName; } else { dr["senduser"] = "******"; } } else { dr["senduser"] = "******"; } if (dt.Rows[i]["isread"].ToString() == "0") { dr["isread"] = "未读"; } else { dr["isread"] = "已读"; } dr["sendtime"] = String.Format("{0:g}", SiteGroupCms.Utils.Validator.StrToDate(dt.Rows[i]["sendtime"].ToString(), DateTime.Now)); dt2.Rows.Add(dr); } _jsonstr = SiteGroupCms.Utils.dtHelp.DT2JSON(dt2, _countnum); dt.Clear(); dt.Dispose(); } }
public void GetListJSON(int type, int _thispage, int _pagesize, string _wherestr, ref string _jsonstr, string ordercol, string ordertype) { //type 用来表示是选择站点的还是所有的 0,all,1 当前站点 //特别注意一定要保证user表和person表的一致性 为了保证在检索的时候的方便,以personinfo作为基准 SiteGroupCms.Entity.Admin _admin = new SiteGroupCms.Entity.Admin(); SiteGroupCms.Entity.Admin currentadmin = (SiteGroupCms.Entity.Admin)HttpContext.Current.Session["admin"]; AdminDal _adminobj = new AdminDal(); using (DbOperHandler _doh = new Common().Doh()) { string sqlStr = ""; string sqlStr2 = ""; string sqlStr3 = ""; sqlStr = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_personinfo", ordercol, _pagesize, _thispage, ordertype, _wherestr); string wheres = ""; if (type == 1)//显示当前站点的 { wheres = " id in (SELECT uid From yy_personinfo Where " + _wherestr + ") and siteid=" + currentadmin.CurrentSite; } //wheres = " id in (" + SiteGroupCms.Utils.SqlHelp.GetSql("uid", "yy_personinfo", ordercol, _pagesize, _thispage, ordertype, _wherestr) + ") and siteid=" + currentadmin.CurrentSite; else { wheres = " id in (SELECT uid From yy_personinfo Where " + _wherestr + ")"; } // wheres = " id in (" + SiteGroupCms.Utils.SqlHelp.GetSql("uid", "yy_personinfo", ordercol, _pagesize, _thispage, ordertype, _wherestr) + ")"; sqlStr2 = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_userinfo", ordercol, _pagesize, _thispage, ordertype, wheres); sqlStr3 = "SELECT * From yy_userinfo Where " + wheres; //用来没有输入检索条件的数据显示 _doh.Reset(); _doh.SqlCmd = sqlStr; DataTable dt3 = _doh.GetDataTable();//personinfo表 //用来统计总条数 _doh.Reset(); _doh.SqlCmd = sqlStr3; int _countnum = _doh.GetDataTable().Rows.Count; //用来输入检索条件的数据显示 _doh.Reset(); _doh.SqlCmd = sqlStr2; DataTable dt = _doh.GetDataTable();//userinfo表的 DataTable dt2 = new DataTable(); DataColumn col = new DataColumn("id", System.Type.GetType("System.String")); DataColumn col2 = new DataColumn("username", System.Type.GetType("System.String")); DataColumn col3 = new DataColumn("truename", System.Type.GetType("System.String")); DataColumn col4 = new DataColumn("depttitle", System.Type.GetType("System.String")); DataColumn col5 = new DataColumn("job", System.Type.GetType("System.String")); DataColumn col9 = new DataColumn("state", System.Type.GetType("System.String")); DataColumn col6 = new DataColumn("role", System.Type.GetType("System.String")); DataColumn col7 = new DataColumn("addtime", System.Type.GetType("System.String")); DataColumn col8 = new DataColumn("logintime", System.Type.GetType("System.String")); DataColumn col10 = new DataColumn("sort", System.Type.GetType("System.String")); dt2.Columns.Add(col); dt2.Columns.Add(col2); dt2.Columns.Add(col3); dt2.Columns.Add(col4); dt2.Columns.Add(col5); dt2.Columns.Add(col6); dt2.Columns.Add(col7); dt2.Columns.Add(col8); dt2.Columns.Add(col9); dt2.Columns.Add(col10); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt2.NewRow(); dr["id"] = dt.Rows[i]["id"]; dr["username"] = dt.Rows[i]["username"]; if (dt.Rows[i]["islock"].ToString() == "0") { dr["state"] = "未锁定"; } else { dr["state"] = "<span style='color:red'>已锁定</span>"; } dr["truename"] = dt3.Rows[i]["truename"]; DepartDal departdal = new DepartDal(); dr["depttitle"] = departdal.GetEntity(dt3.Rows[i]["deptid"].ToString()).Name; dr["job"] = dt3.Rows[i]["job"].ToString(); dr["role"] = new RoleDal().GetEntity(Str2Int(dt.Rows[i]["roleid"].ToString())).Title; dr["addtime"] = String.Format("{0:g}", SiteGroupCms.Utils.Validator.StrToDate(dt.Rows[i]["addtime"].ToString(), DateTime.Now)); dr["logintime"] = String.Format("{0:g}", SiteGroupCms.Utils.Validator.StrToDate(dt.Rows[i]["lastlogintime"].ToString(), DateTime.Now)); dr["sort"] = dt3.Rows[i]["sort"].ToString(); dt2.Rows.Add(dr); } _jsonstr = SiteGroupCms.Utils.dtHelp.DT2JSON(dt2, _countnum); dt.Clear(); dt.Dispose(); } }
/// <summary> /// 得到列表JSON数据 /// </summary> /// <param name="_thispage">当前页码</param> /// <param name="_pagesize">每页记录条数</param> /// <param name="_wherestr">搜索条件</param> /// <param name="_jsonstr">返回值</param> public void GetListJSON(int _thispage, int _pagesize, string _wherestr, ref string _jsonstr, string orderstr) { SiteGroupCms.Entity.Admin _admin = new SiteGroupCms.Entity.Admin(); AdminDal _adminobj = new AdminDal(); CatalogDal catadalobj = new CatalogDal(); using (DbOperHandler _doh = new Common().Doh()) { _doh.Reset(); _doh.ConditionExpress = _wherestr; string sqlStr = ""; int _countnum = _doh.Count("yy_articleinfo"); sqlStr = SiteGroupCms.Utils.SqlHelp.GetSql("*", "yy_articleinfo", _pagesize, _thispage, orderstr, _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("author", System.Type.GetType("System.String")); DataColumn col4 = new DataColumn("addtime", System.Type.GetType("System.String")); DataColumn col5 = new DataColumn("catalogid", System.Type.GetType("System.String")); DataColumn col6 = new DataColumn("state", System.Type.GetType("System.String")); DataColumn col7 = new DataColumn("clickcount", System.Type.GetType("System.String")); DataColumn col8 = new DataColumn("articletype", System.Type.GetType("System.String")); dt2.Columns.Add(col); dt2.Columns.Add(col2); dt2.Columns.Add(col3); dt2.Columns.Add(col4); dt2.Columns.Add(col5); dt2.Columns.Add(col6); dt2.Columns.Add(col7); dt2.Columns.Add(col8); for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = dt2.NewRow(); dr["id"] = dt.Rows[i]["id"]; if (dt.Rows[i]["yyarticleid"].ToString() == "" || dt.Rows[i]["yyarticleid"].ToString() == "0") { if (dt.Rows[i]["linkurl"] != null && dt.Rows[i]["linkurl"].ToString() != "")//为连接文章 { dr["articletype"] = "链接"; } else { dr["articletype"] = "普通"; } dr["title"] = dt.Rows[i]["title"]; if (dt.Rows[i]["author"].ToString() == "") { dr["author"] = "匿名"; } else { dr["author"] = dt.Rows[i]["author"].ToString(); } dr["addtime"] = String.Format("{0:d}", SiteGroupCms.Utils.Validator.StrToDate(dt.Rows[i]["addtime"].ToString(), DateTime.Now)); if (dt.Rows[i]["catalogid"].ToString() != "") { if (catadalobj.GetEntity(dt.Rows[i]["catalogid"].ToString()) != null) { dr["catalogid"] = catadalobj.GetEntity(dt.Rows[i]["catalogid"].ToString()).Title; } else { dr["catalogid"] = "栏目不存在了"; } } else { dr["catalogid"] = "无栏目"; } dr["state"] = ""; if (dt.Rows[i]["ispassed"].ToString() == "0") { dr["state"] += "<span style='color:red;'>未审核</span> "; } else { dr["state"] += "已审核 "; } if (dt.Rows[i]["isrecommend"].ToString() != "0") { dr["state"] += "推荐 "; } if (dt.Rows[i]["isppt"].ToString() != "0") { dr["state"] += "幻灯片 "; } if (dt.Rows[i]["isroll"].ToString() != "0") { dr["state"] += "滚动 "; } if (dt.Rows[i]["ispublish"].ToString() != "0") { dr["state"] += "已发布 "; } else { dr["state"] += "<span style='color:red;'>未发布</span> "; } if (dt.Rows[i]["isshare"].ToString() != "0") { dr["state"] += "共享 "; } dr["clickcount"] = dt.Rows[i]["clickcount"].ToString(); } else //如果是引用 则查找源文章 { dr["articletype"] = "引用"; SiteGroupCms.Entity.Article yuanarticle = new ArticleDal().GetEntity(dt.Rows[i]["yyarticleid"].ToString()); if (yuanarticle.Title == null)//源文章不存在了 { dr["title"] = "源文章不存在了"; } else { dr["title"] = yuanarticle.Title; } if (dt.Rows[i]["author"].ToString() == "") { dr["author"] = "匿名"; } else { dr["author"] = dt.Rows[i]["author"].ToString(); } dr["addtime"] = String.Format("{0:g}", yuanarticle.Addtime); if (yuanarticle.Catalogid.ToString() != "") { if (catadalobj.GetEntity(yuanarticle.Catalogid.ToString()) != null) { dr["catalogid"] = catadalobj.GetEntity(yuanarticle.Catalogid.ToString()).Title; } else { dr["catalogid"] = "栏目不存在了"; } } else { dr["catalogid"] = "无栏目"; } dr["state"] = ""; if (yuanarticle.Ispass.ToString() == "0") { dr["state"] += "未审核 "; } else { dr["state"] += "已审核 "; } if (yuanarticle.Isrecommend.ToString() != "0") { dr["state"] += "推荐 "; } if (yuanarticle.Isppt.ToString() != "0") { dr["state"] += "幻灯片 "; } if (yuanarticle.Isroll.ToString() != "0") { dr["state"] += "滚动 "; } if (yuanarticle.Ispublish.ToString() != "0") { dr["state"] += "已发布 "; } else { dr["state"] += "未发布 "; } if (yuanarticle.Isshare.ToString() != "0") { dr["state"] += "共享 "; } dr["clickcount"] = yuanarticle.Clickcount.ToString(); } dt2.Rows.Add(dr); } _jsonstr = SiteGroupCms.Utils.dtHelp.DT2JSON(dt2, _countnum); dt.Clear(); dt.Dispose(); } }