예제 #1
0
        public static void WriteContentToTemplateFile(SiteInfo siteInfo, TemplateInfo templateInfo, string content, string administratorName)
        {
            if (content == null)
            {
                content = string.Empty;
            }
            var filePath = GetTemplateFilePath(siteInfo, templateInfo);

            FileUtils.WriteText(filePath, templateInfo.Charset, content);

            if (templateInfo.Id > 0)
            {
                var logInfo = new TemplateLogInfo(0, templateInfo.Id, templateInfo.SiteId, DateTime.Now, administratorName, content.Length, content);
                DataProvider.TemplateLogDao.Insert(logInfo);
            }
        }
예제 #2
0
        public void Insert(TemplateLogInfo logInfo)
        {
            var sqlString = "INSERT INTO siteserver_TemplateLog(TemplateID, PublishmentSystemID, AddDate, AddUserName, ContentLength, TemplateContent) VALUES (@TemplateID, @PublishmentSystemID, @AddDate, @AddUserName, @ContentLength, @TemplateContent)";

            var parms = new IDataParameter[]
            {
                GetParameter(ParmTemplateId, EDataType.Integer, logInfo.TemplateId),
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, logInfo.PublishmentSystemId),
                GetParameter(ParmAddDate, EDataType.DateTime, logInfo.AddDate),
                GetParameter(ParmAddUserName, EDataType.NVarChar, 255, logInfo.AddUserName),
                GetParameter(ParmContentLength, EDataType.Integer, logInfo.ContentLength),
                GetParameter(ParmTemplateContent, EDataType.NText, logInfo.TemplateContent)
            };

            ExecuteNonQuery(sqlString, parms);
        }