Ejemplo n.º 1
0
        public View.Games.CRW.CRWLog CRW_rLog(View.Games.CRW.Game_User args, int argsCRWTypeID)
        {
            // var now = WebDateTime.Now;
            var now   = DateTime.Now;
            var today = now.Date;

            var taskResult = mDatabase.Table <View.Games.CRW.CRWLog>()
                             .Where(i => i.UserID == args.ID && i.CRWTypeID == argsCRWTypeID && i.DateValue == today.Ticks)
                             .OrderByDescending(i => i.UpdateTimeValue)
                             .FirstOrDefaultAsync();

            if (taskResult != null)
            {
                if (taskResult.Result != null)
                {
                    return(taskResult.Result);
                }
            }

            var nearLastest = mDatabase.Table <View.Games.CRW.CRWLog>()
                              .Where(i => i.UserID == args.ID && i.CRWTypeID == argsCRWTypeID)
                              .OrderByDescending(i => i.UpdateTimeValue)
                              .FirstOrDefaultAsync();

            View.Games.CRW.CRWLog toAdd = new View.Games.CRW.CRWLog()
            {
                UserID            = args.ID,
                CRWTypeID         = argsCRWTypeID,
                Level             = 1,
                DateValue         = today.Ticks,
                DateDisplay       = today.ToString("yyyy-MM-dd"),
                UpdateTimeValue   = now.Ticks,
                UpdateTimeDisplay = now.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                Percentage        = null,
                NextLevel         = null,
                UseTime           = 0,
                UseTimeDisplay    = "0秒"
            };


            if (nearLastest != null && nearLastest.Result != null)
            {
                var lastestLog = nearLastest.Result;

                toAdd.Level     = lastestLog.Level;
                toAdd.NextLevel = lastestLog.NextLevel;
            }

            CRW_cLog(toAdd);

            return(CRW_rLog(args, argsCRWTypeID));
        }
Ejemplo n.º 2
0
 public void CRW_uLog(View.Games.CRW.CRWLog args)
 {
     mDatabase.UpdateAsync(args);
 }
Ejemplo n.º 3
0
 public void CRW_cLog(View.Games.CRW.CRWLog args)
 {
     mDatabase.InsertAsync(args);
 }