Exemplo n.º 1
0
        public Task <MessageResult> QueueProcessLogs_Set(bool?enabled, bool?clear)
        {
            var commandQueueProcessLogs = CommandQueueProcessLogs.Instance;

            commandQueueProcessLogs.Enabled = enabled ?? false;
            var needClear = clear ?? false;

            if (needClear)
            {
                commandQueueProcessLogs.Clear();
            }
            var result = string.Format("Set at:{0} enabled:{1}, clear:{2}", DateHelper.Instance.GetDateNow(), commandQueueProcessLogs.Enabled, needClear);

            return(MessageResult.Create(true, result).AsTask());
        }
Exemplo n.º 2
0
        public MessageResult ResetDb(ResetDbArgs args)
        {
            if (args.ClearIfExist)
            {
                _dbContext.Database.EnsureDeleted();
            }
            _dbContext.Database.EnsureCreated();

            //using (var tx = _dbContext.Database.BeginTransaction())
            //{
            //    var linkItems = _dbContext.LinkItems.ToList();
            //    if (linkItems.Count == 0)
            //    {
            //        linkItems.Add(new LinkItem { Title = "Link", Href = "#", Description = "连接" });
            //        _dbContext.SaveChanges();
            //    }
            //    tx.Commit();
            //}
            return(MessageResult.Create(true, "ResetDb Complete"));
        }
Exemplo n.º 3
0
 private MessageResult AppendLogsAndResult(bool success, string message, object data = null)
 {
     AppendLogs(message);
     return(MessageResult.Create(success, message, data));
 }
Exemplo n.º 4
0
 private MessageResult AppendLogsAndResult(bool success, string message)
 {
     AppendLogs(message);
     return(MessageResult.Create(success, message));
 }
Exemplo n.º 5
0
        public MessageResult Validate(SimpleProcessInfo info)
        {
            var success = SimpleProcessInfo.Validate(info, out var message);

            return(MessageResult.Create(success, message, info));
        }