Exemplo n.º 1
0
 public long AddDisplayPartition(T_BG_DisplayPartition displayGuideFile)
 {
     try
     {
         return(_bgDisplayPartitionRepository.Add(displayGuideFile));
     }
     catch (Exception)
     {
         return(-1L);
     }
 }
Exemplo n.º 2
0
 public bool UpdateAndDelMongoDb(T_BG_DisplayPartition displayGuideFile, string mongDbName)
 {
     try
     {
         MongoDBHelper.DelFileByName(mongDbName, displayGuideFile.FileName);
         return(_bgDisplayPartitionRepository.Update(displayGuideFile));
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 3
0
        public JsonResult SaveDisplayPartition()
        {
            JsonDisplayPartitionSaveDisplayPartition json = new JsonDisplayPartitionSaveDisplayPartition();
            long     departId    = CommonHelper.GetPostValue("departId").ToLong(-1L);
            string   departName  = CommonHelper.GetPostValue("departName");
            DateTime time        = CommonHelper.GetPostValue("time").ToDateTime(DateTime.MinValue);
            string   fileName    = CommonHelper.GetPostValue("fileName");
            string   oldFileName = CommonHelper.GetPostValue("oldFileName");

            departName  = HttpUtility.UrlDecode(departName);
            oldFileName = HttpUtility.UrlDecode(oldFileName);
            if (departId < 0 || string.IsNullOrEmpty(departName) || string.IsNullOrEmpty(fileName))
            {
                json.ErrorCode    = "E001";
                json.ErrorMessage = "参数不全!";
                return(Json(json));
            }

            T_BG_DisplayPartition displayPartition = new T_BG_DisplayPartition();

            displayPartition.UserId         = LoginHelper.UserId;
            displayPartition.FileName       = fileName;
            displayPartition.DepartmentId   = departId;
            displayPartition.DepartmentName = departName;
            displayPartition.PublishTime    = time;
            displayPartition.AddTime        = DateTime.Now;
            displayPartition.IsDel          = 0;
            displayPartition.OldFileName    = oldFileName;
            long result = _bgDisplayPartitionService.AddDisplayPartition(displayPartition);

            if (result > 0)
            {
                json.ErrorCode    = "E000";
                json.ErrorMessage = "添加成功!";
            }
            else
            {
                json.ErrorCode    = "E001";
                json.ErrorMessage = "添加失败!";
            }
            return(Json(json));
        }
        public JsonResult DelFile()
        {
            long id = CommonHelper.GetPostValue("id").ToLong(-1L);

            JsonDisplayPartitionDel json = new JsonDisplayPartitionDel();

            if (id < 0)
            {
                json.ErrorCode    = "E001";
                json.ErrorMessage = "参数获取失败!";
                return(Json(json));
            }

            T_BG_DisplayPartition displayPartition = _bgDisplayPartitionService.Get(id);

            if (displayPartition == null)
            {
                json.ErrorCode    = "E002";
                json.ErrorMessage = "未获得该数据!";
                return(Json(json));
            }
            displayPartition.IsDel = 1;
            bool re = _bgDisplayPartitionService.UpdateAndDelMongoDb(displayPartition, "mq_bg_displaypartition");

            if (re)
            {//D250A7C4-8314-4626-BA2C-9AC6C7728061.JPG
                json.ErrorCode    = "E000";
                json.ErrorMessage = "删除成功!";
            }
            else
            {
                json.ErrorCode    = "E003";
                json.ErrorMessage = "删除失败!";
            }
            return(Json(json));
        }