Пример #1
0
        public JsonResult AddFileMessage(string title, string lvl, string publictime, string htmlContent, string textContent, string fileOriginName, string fileNewName, string filePath, string filetype)
        {
            title          = HttpUtility.UrlDecode(title);
            htmlContent    = HttpUtility.UrlDecode(htmlContent);
            textContent    = HttpUtility.UrlDecode(textContent);
            fileOriginName = HttpUtility.UrlDecode(fileOriginName);
            filePath       = HttpUtility.UrlDecode(filePath);
            long             userid      = LoginHelper.UserId;
            T_BG_PublishFile publishFile = new T_BG_PublishFile
            {
                Title          = title,
                EditorId       = userid,
                PublishTime    = publictime.ToDateTime(DateTime.MinValue),
                PublishState   = 1,
                Lvl            = lvl.ToLong(-1),
                TextContent    = textContent,
                HtmlContent    = htmlContent,
                IsDel          = 0,
                FileNewName    = fileNewName,
                FileOriginName = fileOriginName,
                FilePath       = filePath,
                FileType       = filetype
            };
            //没有审核的列表
            bool result = _bgPublishFileService.AddPublishFile(publishFile);

            JsonBaseEntity json = new JsonBaseEntity {
                ErrorCode = result ? "E0001" : "E0009"
            };

            json.ErrorMessage = ErrorInfoHelper.GetErrorValue(json.ErrorCode);
            return(Json(json));
        }
Пример #2
0
        public JsonResult DelSingle()
        {
            long           id     = CommonHelper.GetPostValue("id").ToLong(-1);
            JsonBaseEntity result = new JsonBaseEntity();

            if (id <= 0)
            {
                result.ErrorCode    = "E0001";
                result.ErrorMessage = "未发现删除数据!";
                return(Json(result));
            }
            T_BG_PublishFile publishFile = new T_BG_PublishFile {
                Id = id, IsDel = 1
            };
            bool reslt = _bgPublishFileService.DelDateById(publishFile);

            if (reslt)
            {
                result.ErrorCode    = "E0000";
                result.ErrorMessage = "删除数据成功!";
            }
            else
            {
                result.ErrorCode    = "E0001";
                result.ErrorMessage = "删除数据失败!";
            }
            return(Json(result));
        }
Пример #3
0
 public bool UpdatePulishFile(T_BG_PublishFile publishFile)
 {
     if (publishFile == null)
     {
         return(false);
     }
     return(_bgPublishFileRepository.Update(publishFile));
 }
Пример #4
0
        public bool DelDateById(T_BG_PublishFile publishFile)
        {
            if (publishFile == null)
            {
                return(false);
            }
            string sqlString = @" UPDATE T_BG_PublishFile SET IsDel=1 WHERE Id=@Id";

            return(_bgPublishFileRepository.Update(sqlString, publishFile));
        }
Пример #5
0
 public bool AddPublishFile(T_BG_PublishFile publishFile)
 {
     try
     {
         long result = _bgPublishFileRepository.Add(publishFile);
         return(result > 0);
     }
     catch (Exception)
     {
         return(false);
     }
 }