Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("ScoreCardMeetingScheduleID,LastMeetingDate,DateOfReminderStart,Frequency,ReminderSofar,CurrentDate")] ScoreCardMeetingSchedule scoreCardMeetingSchedule)
        {
            if (ModelState.IsValid)
            {
                _context.Add(scoreCardMeetingSchedule);
                var objList = await _context.ScorecardActivity.ToListAsync();

                foreach (var obj in objList)
                {
                    if (obj.Status == 4)
                    {
                        obj.meetingStatusList = obj.meetingStatusList + ",4";
                        obj.IsUpdated         = true;
                    }
                    else if (obj.Status == 0)
                    {
                        obj.meetingStatusList = obj.meetingStatusList + ",0";
                        obj.IsUpdated         = true;
                    }
                    else
                    {
                        //obj.meetingStatusList = obj.meetingStatusList + ",9";
                        obj.IsUpdated = false;
                    }
                    _context.Update(obj);
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(scoreCardMeetingSchedule));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ScoreCardMeetingScheduleID,LastMeetingDate,DateOfReminderStart,Frequency,ReminderSofar,CurrentDate")] ScoreCardMeetingSchedule scoreCardMeetingSchedule)
        {
            if (id != scoreCardMeetingSchedule.ScoreCardMeetingScheduleID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(scoreCardMeetingSchedule);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ScoreCardMeetingScheduleExists(scoreCardMeetingSchedule.ScoreCardMeetingScheduleID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(scoreCardMeetingSchedule));
        }
Ejemplo n.º 3
0
        // GET: ScoreCardMeetingSchedules/Create
        public IActionResult Create()
        {
            ScoreCardMeetingSchedule Obj = new ScoreCardMeetingSchedule();

            Obj.Frequency           = 1;
            Obj.ReminderSofar       = 1;
            Obj.CurrentDate         = DateTime.Now.Date;
            Obj.LastMeetingDate     = DateTime.Now.Date;
            Obj.DateOfReminderStart = DateTime.Today.AddDays(-(int)DateTime.Today.DayOfWeek + (int)DayOfWeek.Monday);
            return(View(Obj));
        }