Esempio n. 1
0
        public void UpdateBinder(int id)
        {
            ContentSection section = sectionService.GetById(id, ctx.app.Id);

            if (section == null)
            {
                echoToParentPart(lang("exDataNotFound"));
                return;
            }

            int tplId  = section.TemplateId;
            int cTplId = section.CustomTemplateId;

            section = ContentValidator.ValidateSectionEdit(section, ctx);
            if (errors.HasErrors)
            {
                run(EditBinder, id);
                return;
            }

            // 此处不修改模板
            section.TemplateId       = tplId;
            section.CustomTemplateId = cTplId;


            if (section.ServiceId > 0)
            {
                sectionService.Update(section);
                updateParamValues(section, sectionService, ctx);  // 修改数据源参数
            }

            echoToParentPart(lang("opok"));
        }
        public virtual void UpdateBinder(long id)
        {
            ContentSection section = sectionService.GetById(id, ctx.app.Id);

            if (section == null)
            {
                echoToParentPart(lang("exDataNotFound"));
                return;
            }

            long tplId  = section.TemplateId;
            long cTplId = section.CustomTemplateId;

            section = ContentValidator.ValidateSectionEdit(section, ctx);
            if (errors.HasErrors)
            {
                run(EditBinder, id);
                return;
            }

            // 此处不修改模板
            section.TemplateId       = tplId;
            section.CustomTemplateId = cTplId;

            section.MetaKeywords    = ctx.Post("MetaKeywords");
            section.MetaDescription = strUtil.CutString(ctx.Post("MetaDescription"), 250);


            if (section.ServiceId > 0)
            {
                sectionService.Update(section);
                updateParamValues(section, sectionService, ctx);  // 修改数据源参数
            }

            echoToParentPart(lang("opok"));
        }