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("操作失败");
            }
        }
Beispiel #2
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");
            }
        }