Example #1
0
        public async Task Execute(IJobExecutionContext context)
        {
            string token    = context.JobDetail.JobDataMap.GetString("tokens");
            string thanksId = context.JobDetail.JobDataMap.GetString("thanks");
            string giftId   = context.JobDetail.JobDataMap.GetString("gift");
            string fbId     = context.JobDetail.JobDataMap.GetString("feedback");

            //JobDataMap dataMap = context.JobDetail.JobDataMap;

            string[] tokens = token.Split("//");

            // string[] tokens = { "eWvonZUuTSc:APA91bGB4mMs6wAxOFj4H4rTn0uwPonwsDBW6904QiYuKH0zmhP0-T8519ZktWmjuo73livxkt_ZgVBJwbLLDPVjvi0QOnIcFTAfc8ZluLRmAJXnfDOsP-olvZQUKYS4lrqhhqvM8sy6" };
            var data = new { action = uConstant.FIREBASE_RELOAD_ACTION, click_action = "FLUTTER_NOTIFICATION_CLICK" };
            await util.SendPushNoti(tokens, "SERVER_REQUEST", "TaskEnd" + DateTime.Now + "", data);

            thanks.UpdateStatusNewThanks(thanksId);
            await thanks.SaveChangesAsync();

            if (!string.IsNullOrEmpty(giftId))
            {
                gift.UpdateStatusNewGift(giftId);
                await gift.SaveChangesAsync();
            }

            feedback.UpdateStatusNewFeedback(fbId);
        }
        public async Task <IActionResult> CreateNewThank(Thanks thank)
        {
            string   brandId = HttpContext.Session.GetString("brandId");
            string   userNameToCreateThank = HttpContext.Session.GetString("adminName");
            DateTime currentDate           = DateTime.Now;

            thank.BrandId    = brandId;
            thank.Username   = userNameToCreateThank;
            thank.CreateDate = currentDate;
            thank.Status     = 0;

            _thanksRepository.Add(thank);
            await _thanksRepository.SaveChangesAsync();

            getThanksByBranIdCreate();
            getFeedbackID();
            return(View("ManageThanks"));
        }