Пример #1
0
        /// <summary>
        /// 保存模板
        /// </summary>
        public void Save()
        {
            if (TemplateType == TemplateType.自定义页 && this.CustomPageExist())
            {
                throw new Exception("页面“" + this.TemplateName + "”已存在请不要重复创建");
            }


            Dictionary <string, object> fields = new Dictionary <string, object>();

            fields["id"]               = this.TemplateId;
            fields["title"]            = this.TemplateName;
            fields["u_content"]        = SetContent(this.TemplateContent);
            fields["u_type"]           = (int)this.TemplateType;
            fields["u_defaultFlag"]    = this.IsDefault ? 1 : 0;
            fields["classId"]          = this.ColumnId;
            fields["u_datatypeId"]     = this.DatatypeId;
            fields["u_editboxStatus"]  = (int)this.EditMode;
            fields["u_parameterValue"] = this.ParameterValue;
            fields["u_webFAid"]        = this.IsMobile ? 1 : 0;
            fields["createDate"]       = System.DateTime.Now;
            fields["updateDate"]       = System.DateTime.Now;
            int        u_layer    = 0;
            ModuleInfo moduleInfo = ModuleClass.get(ColumnId);

            if (moduleInfo == null)
            {
                ColumnInfo columnInfo = ColumnClass.get(ColumnId);
                if (columnInfo != null)
                {
                    u_layer       = 2;
                    fields["url"] = @"/" + columnInfo.dirName + "/" + TemplateName;
                }
                else
                {
                    fields["url"] = @"/" + TemplateName;
                }
            }
            else
            {
                u_layer = 1;
                if (moduleInfo.type)
                {
                    fields["url"] = @"/" + moduleInfo.dirName + "/" + TemplateName;
                }
            }
            fields["u_layer"] = u_layer;
            this.TemplateId   = Save(fields);
            Build(true);
        }
Пример #2
0
        public ReturnValue moduleInfo(double id)
        {
            ReturnValue err = new ReturnValue();
            Permissions p   = this.loginInfo.value.getModulePermissions(id);

            if (!p.read)
            {
                err.errNo  = -1;
                err.errMsg = "没有查看该栏目的权限";
                return(err);
            }
            ModuleInfo info = ModuleClass.get(id);

            if (info == null)
            {
                err.errNo  = -1;
                err.errMsg = "没有找到指定id数据";
            }
            else
            {
                err.userData = info;
            }
            return(err);
        }