コード例 #1
0
        public string getcataloglist(string siteid)
        {
            string str = "{\"catalog\":[";

            SiteGroupCms.Entity.Catalog catalog = new SiteGroupCms.Entity.Catalog();
            using (DbOperHandler _doh = new Common().Doh())
            {
                _doh.Reset();
                _doh.SqlCmd = "SELECT * FROM [yy_cataloginfo] WHERE [siteid]=" + siteid;
                DataTable dt = _doh.GetDataTable();

                if (dt.Rows.Count > 0)
                {
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        SiteGroupCms.Entity.Admin _admin = ((SiteGroupCms.Entity.Admin)HttpContext.Current.Session["admin"]);
                        if (_admin.Catalogid == "" || _admin.Catalogid.IndexOf(dt.Rows[i]["id"].ToString() + ",") >= 0)//超级管理或者包含该栏目则显示
                        {
                            str += "{\"id\":\"" + dt.Rows[i]["id"].ToString() + "\",\"title\":\"" + dt.Rows[i]["title"].ToString() + "\"},";
                        }
                    }
                }
            }
            return(str.Remove(str.Length - 1, 1) + "]}");
        }
コード例 #2
0
 /// <summary>
 /// 绑定数据到实体
 /// </summary>
 /// <param name="_id"></param>
 public void BindData2Entity(string _id, SiteGroupCms.Entity.Catalog catalog)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT * FROM [yy_cataloginfo] WHERE [Id]=" + _id;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count > 0)
         {
             catalog.ID               = Str2Int(_id);
             catalog.Title            = dt.Rows[0]["title"].ToString();
             catalog.Father           = Str2Int(dt.Rows[0]["fatherid"].ToString());
             catalog.Linkurl          = dt.Rows[0]["linkurl"].ToString();
             catalog.Type             = dt.Rows[0]["type"].ToString();
             catalog.Picurl           = dt.Rows[0]["picurl"].ToString();
             catalog.Description      = dt.Rows[0]["description"].ToString();
             catalog.Meta_description = dt.Rows[0]["meta_description"].ToString();
             catalog.Meta_Keywords    = dt.Rows[0]["meta_keywords"].ToString();
             catalog.IsShare          = Str2Int(dt.Rows[0]["isshare"].ToString());
             catalog.Listtemplate     = Str2Int(dt.Rows[0]["listtemplate"].ToString());
             catalog.Contentfileex    = dt.Rows[0]["contentfileex"].ToString();
             catalog.Dirname          = dt.Rows[0]["dirname"].ToString();
             catalog.Siteid           = Str2Int(dt.Rows[0]["siteid"].ToString());
             catalog.ContentTemplate  = Str2Int(dt.Rows[0]["contenttemplate"].ToString());
         }
     }
 }
コード例 #3
0
 public void getcataloginfo()
 {
     SiteGroupCms.Dal.CatalogDal catalogdal = new SiteGroupCms.Dal.CatalogDal();
     SiteGroupCms.Entity.Catalog catalog    = new SiteGroupCms.Entity.Catalog();
     if (id != "0")
     {
         catalog = catalogdal.GetEntity(id);
     }
     if (catalog != null)
     {
         _response += "{\"IsError\":false,\"Message\":\"加载成功\",\"Data\":{\"id\":" + catalog.ID + ",";
         _response += "\"title\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(catalog.Title) + ",\"fathercatalog_val\":\"" + catalog.Father + "\",";
         _response += "\"dirname\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(catalog.Dirname) + ",\"desctiption\":" + SiteGroupCms.Utils.fastJSON.JSON.WriteString(catalog.Description) + ",\"isshare\":\"" + catalog.IsShare + "\",";
         _response += "\"listtemplate_val\":\"" + catalog.Listtemplate + "\",\"contenttemplate_val\":\"" + catalog.ContentTemplate + "\"";
         _response += "}}";
     }
     Response.Write(_response);
 }
コード例 #4
0
 public int insertcatalog(SiteGroupCms.Entity.Catalog obj)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.AddFieldItem("title", obj.Title);
         _doh.AddFieldItem("fatherid", obj.Father);
         _doh.AddFieldItem("description", obj.Description);
         _doh.AddFieldItem("siteid", obj.Siteid);
         _doh.AddFieldItem("dirname", obj.Dirname);
         _doh.AddFieldItem("isshare", obj.IsShare);
         _doh.AddFieldItem("meta_keywords", obj.Meta_Keywords);
         _doh.AddFieldItem("contenttemplate", obj.ContentTemplate);
         _doh.AddFieldItem("listtemplate", obj.Listtemplate);
         int _insert = _doh.Insert("yy_cataloginfo");
         return(_insert);
     }
 }
コード例 #5
0
 public DataTable GetDT(string _wherestr, string _order)
 {
     SiteGroupCms.Entity.Catalog catalog = new SiteGroupCms.Entity.Catalog();
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.SqlCmd = "SELECT * FROM [yy_cataloginfo] WHERE " + _wherestr + " order by " + _order;
         DataTable dt = _doh.GetDataTable();
         if (dt.Rows.Count > 0)
         {
             return(dt);
         }
         else
         {
             return(null);
         }
     }
 }
コード例 #6
0
 public void updatecatalog()
 {
     catalog                 = catalogdal.GetEntity(id);
     catalog.ID              = Str2Int(id);
     catalog.Title           = title;
     catalog.Description     = description;
     catalog.IsShare         = isshare == "true" ? 1 : 0;
     catalog.Listtemplate    = Str2Int(listtemplate);
     catalog.ContentTemplate = Str2Int(contenttemplate);
     catalog.Meta_Keywords   = keywords;
     if (catalogdal.update(catalog))
     {
         _response = "{\"IsError\":false,\"Message\":\"保存成功\",\"Data\":0}";
         new SiteGroupCms.Dal.LogDal().SaveLog(31);
     }
     else
     {
         _response = "{\"IsError\":true,\"Message\":\"保存失败\",\"Data\":0}";
     }
 }
コード例 #7
0
 public bool update(SiteGroupCms.Entity.Catalog obj)
 {
     using (DbOperHandler _doh = new Common().Doh())
     {
         _doh.Reset();
         _doh.ConditionExpress = "id=@id";
         _doh.AddConditionParameter("@id", obj.ID);
         _doh.AddFieldItem("title", obj.Title);
         // _doh.AddFieldItem("fatherid", obj.Father);不允许修改父级栏目
         _doh.AddFieldItem("description", obj.Description);
         //  _doh.AddFieldItem("siteid", obj.Siteid);//不允许修改站点
         //  _doh.AddFieldItem("dirname", obj.Dirname);//不允许修改栏目目录
         _doh.AddFieldItem("isshare", obj.IsShare);
         _doh.AddFieldItem("meta_keywords", obj.Meta_Keywords);
         _doh.AddFieldItem("contenttemplate", obj.ContentTemplate);
         _doh.AddFieldItem("listtemplate", obj.Listtemplate);
         int _update = _doh.Update("yy_cataloginfo");
         return(_update == 1);
     }
 }