public ActionResult ConfigTemplate(string projectGuid, string fileSeriesGuid, string templateType)
        {
            return(ActionUtils.Json(() =>
            {
                CommUtils.AssertHasContent(projectGuid, "ProjectGuid不能为空");

                var dmsFileSeries = m_dbAdapter.DMSFileSeries.GetByGuid(fileSeriesGuid);
                var fileSeriesTemplateType = CommUtils.ParseEnum <DmsFileSeriesTemplateType>(templateType);
                var template = m_dbAdapter.DMSFileSeriesTemplate.GetByFileSeriesId(dmsFileSeries.Id);
                if (template == null)
                {
                    var dmsFileSeriesTemplate = new DMSFileSeriesTemplate();
                    dmsFileSeriesTemplate.FileSeriesId = dmsFileSeries.Id;
                    dmsFileSeriesTemplate.TemplateType = fileSeriesTemplateType;
                    m_dbAdapter.DMSFileSeriesTemplate.New(dmsFileSeriesTemplate);
                }
                else
                {
                    if (template.TemplateType != fileSeriesTemplateType)
                    {
                        template.TemplateType = fileSeriesTemplateType;
                        m_dbAdapter.DMSFileSeriesTemplate.Update(template);

                        var log = string.Format("更新模板文档类型为 [{0}]", Toolkit.ToCnString(fileSeriesTemplateType));
                        m_dbAdapter.DMSProjectLog.AddDmsProjectLog(projectGuid, fileSeriesGuid, log);
                    }
                }

                return ActionUtils.Success("");
            }));
        }
Ejemplo n.º 2
0
        private DMSFileSeriesTemplate NewDMSFileSeriesTemplate(int dmsFileSeriesId, DmsFileSeriesTemplateType fileSeriesTemplateType)
        {
            var dmsFileSeriesTemplate = new DMSFileSeriesTemplate();

            dmsFileSeriesTemplate.FileSeriesId = dmsFileSeriesId;
            dmsFileSeriesTemplate.TemplateType = fileSeriesTemplateType;
            return(m_dbAdapter.DMSFileSeriesTemplate.New(dmsFileSeriesTemplate));
        }