コード例 #1
0
ファイル: Account.cs プロジェクト: jochemstoel/EPONS
        public bool AllowScale(Guid accountId, string scaleID)
        {
            Guid scaleId = BaseModel.DecryptId(scaleID);

            return(Execute(context =>
            {
                ScalePermission sp = (ScalePermission)context.ScalePermissions.OrderByDescending(x => x.DateCreatedTimestamp).FirstOrDefault(x => x.AccountId == accountId && x.ScaleId == scaleId);
                return sp != null && !olderThanYear(sp.LastUpdateTimestamp) && sp.Grade >= 80;
            }));
        }
コード例 #2
0
        public JsonResult MoodleManuaImport(Data.Models.ScalePermission model, bool overrideDate = false)
        {
            Guid AccountId = DataAccess.Account.GetAccountIdByUsername(model.Username);

            Data.ScalePermission scalePermission = new ScalePermission()
            {
                AccountId            = AccountId,
                DateCreatedTimestamp = overrideDate ? model.GradeDate : DateTime.Now,
                Grade = model.Grade,
                LastUpdateAccountId = UserHelper.GetCurrentAccount().GetId(),
                LastUpdateTimestamp = overrideDate ? model.GradeDate : DateTime.Now,
                ScaleId             = Data.Models.BaseModel.DecryptId(model.ScaleId)
            };

            return(Json(DataAccess.Account.AddScalePermission(scalePermission)));
        }