Ejemplo n.º 1
0
        public string DelContentType(string nId)
        {
            if (string.IsNullOrEmpty(nId))
            {
                return("没有找到要删除的数据,请检查");
            }
            Guid gId = Guid.Empty;

            if (!Guid.TryParse(nId, out gId))
            {
                return("当前行的主键ID不合法,请检查");
            }

            if (ctBll == null)
            {
                ctBll = new BLL.ContentType();
            }
            int effect = ctBll.Delete(nId);

            if (effect > 0)
            {
                return("操作成功");
            }
            else
            {
                return("操作失败");
            }
        }
Ejemplo n.º 2
0
        public string GetContentTypeJson()
        {
            string jsonAppend = "";

            if (ctBll == null)
            {
                ctBll = new BLL.ContentType();
            }
            List <Model.ContentType> list = ctBll.GetList();

            if (list != null)
            {
                List <Model.ContentType> parentList = list.FindAll(delegate(Model.ContentType m) { return(m.ParentID.Equals(Guid.Empty)); });
                jsonAppend += "[";
                foreach (Model.ContentType model in parentList)
                {
                    jsonAppend += "{'id':'" + model.NumberID + "','text':'" + model.TypeName + "'";
                    GetChildren(model, list, ref jsonAppend);

                    jsonAppend += "},";
                }
                jsonAppend  = jsonAppend.Trim(',');
                jsonAppend += "]";
            }

            return(jsonAppend);
        }
Ejemplo n.º 3
0
 public string GetTreeJson()
 {
     if (ctBll == null)
     {
         ctBll = new BLL.ContentType();
     }
     return(ctBll.GetTreeJson());
 }
Ejemplo n.º 4
0
 public List <Model.ContentType> GetContentType()
 {
     if (ctBll == null)
     {
         ctBll = new BLL.ContentType();
     }
     return(ctBll.GetList());
 }
Ejemplo n.º 5
0
        public List <Model.ContentType> GetContentType()
        {
            if (ctBll == null)
            {
                ctBll = new BLL.ContentType();
            }
            int totalCount = 0;

            return(ctBll.GetList(1, 10000, out totalCount, "", null));
        }
Ejemplo n.º 6
0
        public string UpdateContentType(string nId, string name, string parentId)
        {
            if (string.IsNullOrEmpty(nId))
            {
                return("没有找到要编辑的数据,请检查");
            }
            Guid gId = Guid.Empty;

            if (!Guid.TryParse(nId, out gId))
            {
                return("当前编辑行的主键ID不合法,请检查");
            }
            if (string.IsNullOrEmpty(name))
            {
                return("类型名称不能为空");
            }
            if (string.IsNullOrEmpty(parentId))
            {
                return("所属名称对应值不正确,请检查");
            }
            Guid pId = Guid.Empty;

            if (!Guid.TryParse(parentId, out pId))
            {
                return("所属名称对应值格式不正确");
            }

            Model.ContentType model = new Model.ContentType();
            model.NumberID        = nId;
            model.TypeName        = name;
            model.ParentID        = pId;
            model.SameName        = "All";
            model.LastUpdatedDate = DateTime.Now;

            if (ctBll == null)
            {
                ctBll = new BLL.ContentType();
            }
            int effect = ctBll.Update(model);

            if (effect == 110)
            {
                return("已存在相同记录");
            }
            if (effect > 0)
            {
                return("操作成功");
            }
            else
            {
                return("操作失败");
            }
        }
Ejemplo n.º 7
0
        private void OnSave()
        {
            string sTypeName = txtTypeName.Value.Trim();
            string sParent   = txtParent.Value.Trim();

            Guid parentId = Guid.Empty;

            if (!string.IsNullOrEmpty(sParent))
            {
                Guid.TryParse(sParent, out parentId);
            }

            Model.ContentTypeInfo model = new Model.ContentTypeInfo();
            model.TypeName        = sTypeName;
            model.ParentID        = parentId;
            model.Sort            = 0;
            model.SameName        = "All";
            model.LastUpdatedDate = DateTime.Now;

            if (ctBll == null)
            {
                ctBll = new BLL.ContentType();
            }
            int result = -1;

            if (!string.IsNullOrEmpty(nId))
            {
                model.NumberID = nId;
                result         = ctBll.Update(model);
            }
            else
            {
                result = ctBll.Insert(model);
            }
            if (result == 110)
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "已存在相同记录!", "温馨提醒", "error");
                return;
            }

            if (result > 0)
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "提交成功!");
            }
            else
            {
                WebHelper.MessageBox.Messager(this.Page, lbtnPostBack, "提交失败,系统异常!", "温馨提醒", "error");
            }
        }
Ejemplo n.º 8
0
 private void Bind()
 {
     if (!string.IsNullOrEmpty(nId))
     {
         if (ctBll == null)
         {
             ctBll = new BLL.ContentType();
         }
         Model.ContentTypeInfo model = ctBll.GetModel(nId);
         if (model != null)
         {
             txtTypeName.Value = model.TypeName;
             txtParent.Value   = model.ParentName;
         }
     }
 }
Ejemplo n.º 9
0
        public string InsertContentType(string name, string parentId)
        {
            if (string.IsNullOrEmpty(name))
            {
                return("类型名称不能为空");
            }
            if (string.IsNullOrEmpty(parentId))
            {
                return("所属名称对应值不正确,请检查");
            }
            Guid pId = Guid.Empty;

            if (!Guid.TryParse(parentId, out pId))
            {
                return("所属名称对应值格式不正确");
            }

            Model.ContentTypeInfo model = new Model.ContentTypeInfo();
            model.TypeName        = name;
            model.ParentID        = pId;
            model.SameName        = "All";
            model.LastUpdatedDate = DateTime.Now;

            if (ctBll == null)
            {
                ctBll = new BLL.ContentType();
            }
            int effect = ctBll.Insert(model);

            if (effect == 110)
            {
                return("已存在相同记录");
            }
            if (effect > 0)
            {
                return("操作成功");
            }
            else
            {
                return("操作失败");
            }
        }
Ejemplo n.º 10
0
        public string GetSiteHelper()
        {
            string htmlAppend = string.Empty;

            if (ctBll == null)
            {
                ctBll = new BLL.ContentType();
            }
            if (cdBll == null)
            {
                cdBll = new BLL.ContentDetail();
            }
            cdList = cdBll.GetList();
            List <Model.ContentTypeInfo> ctList = ctBll.GetList();

            Model.ContentTypeInfo rootModel = ctList.Find(delegate(Model.ContentTypeInfo m) { return(m.TypeName == "站点所有帮助"); });
            if (rootModel != null)
            {
                htmlAppend += GetChildren(rootModel, ctList);
            }

            return(htmlAppend);
        }