Example #1
0
 public BlockListModel(BlockList blockList)
     :base(blockList)
 {
     if(blockList != null)
     {
         Application_Id = blockList.Application_Id;
         BlockType_Id = blockList.BlockType_Id;
         Content = blockList.Content;
     }
 }
Example #2
0
 public void UpdateBlockList(int appid, int userId, string token, BlockList blockL)
 {
     try
     {
         CheckToken(appid, userId, token);
         CheckCommand(appid, blockL.Application_Id, userId, BuiltIns.BlockCommand.Id, BuiltIns.AllRole.Id);
         using (TransactionScope scope = new TransactionScope())
         {
             modelAccesser.Update<BlockList>(blockL);
             if (!string.IsNullOrEmpty(blockL.Content))
             {
                 modelAccesser.Add<BlockHistory>(new BlockHistory
                 {
                     Application_Id = blockL.Application_Id,
                     BlockType_Id = blockL.BlockType_Id,
                     Content = blockL.Content,
                     IsBlock = true,
                     OptUser_Id = userId,
                     Time = DateTime.Now
                 });
             }
             scope.Complete();
         }
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
Example #3
0
 public void DeleteBlockList(int appid, int userId, string token, int id)
 {
     try
     {
         CheckToken(appid, userId, token);
         BlockList blockL = new BlockList { Id = id };
         modelAccesser.Get<BlockList>(blockL);
         if (blockL.Loaded)
         {
             CheckCommand(appid, blockL.Application_Id, userId, BuiltIns.BlockCommand.Id, BuiltIns.AllRole.Id);
             using (TransactionScope scope = new TransactionScope())
             {
                 modelAccesser.Add<BlockHistory>(new BlockHistory
                 {
                     Application_Id = blockL.Application_Id,
                     BlockType_Id = blockL.BlockType_Id,
                     Content = blockL.Content,
                     IsBlock = false,
                     OptUser_Id = userId,
                     Time = DateTime.Now
                 });
                 modelAccesser.Delete(blockL);
                 scope.Complete();
             }
         }
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
Example #4
0
 public BlockList GetBlockList(int appid, int userId, string token, int id)
 {
     try
     {
         CheckToken(appid, userId, token);
         BlockList list = new BlockList { Id = id };
         modelAccesser.Get<BlockList>(list);
         return list.Loaded ? list : null;
     }
     catch (Exception)
     {
         throw new DatabaseException();
     }
 }
 public JsonResult NewBlockList()
 {
     BlockList list = new BlockList { Application_Id = BuiltIns.AllApplication.Id, BlockType_Id = BuiltIns.BlockUserType.Id, Content = string.Empty };
     string message = string.Empty;
     bool success = false;
     try
     {
         AddEntity<BlockList>(list);
         success = true;
     }
     catch (DatabaseException exception)
     {
         message = exception.Message;
     }
     return Json(new {Success = success,Model = new BlockListModel(list), Message = message}, JsonRequestBehavior.AllowGet);
 }
Example #6
0
 public void UpdateBlockList(int userId, string token, YoYoStudio.Model.Core.BlockList blockL)
 {
     client.UpdateBlockList(application_Id, userId, token, blockL);
 }
Example #7
0
 public YoYoStudio.Model.Core.BlockList AddBlockList(int userId, string token, YoYoStudio.Model.Core.BlockList blockL)
 {
     return(client.AddBlockList(application_Id, userId, token, blockL));
 }