public async Task <bool> UpdateData(string Id, string currentUser, string result, string remark)
        {
            var ExistingSuggestion = _context.CipfSuggestion.Where(x => x.SuggestionId == Id).FirstOrDefault();

            if (ExistingSuggestion != null)
            {
                ExistingSuggestion.ApproveDt = DateTime.Now;
                ExistingSuggestion.Status    = result;
                ExistingSuggestion.Remark    = remark;
                if (result == "Đã duyệt đề xuất")
                {
                    ExistingSuggestion.IndicatorOfStatus = 2;
                }
                else if (result == "Hoàn tất")
                {
                    ExistingSuggestion.IndicatorOfStatus = 6;
                }
                else
                {
                    ExistingSuggestion.IndicatorOfStatus = 7;
                }

                ExistingSuggestion.ApproveSuggBy = currentUser;
                await _context.SaveChangesAsync();
            }
            else
            {
                return(await Task.FromResult(false));
            }
            return(await Task.FromResult(true));
        }
Exemplo n.º 2
0
        public async Task <bool> RejectSuggestion(string suggestionId, string currentUser)
        {
            var existSuggestion = _context.CipfSuggestion.Where(x => x.SuggestionId == suggestionId).FirstOrDefault();

            if (existSuggestion != null)
            {
                existSuggestion.Status            = "Hành động không hiệu quả";
                existSuggestion.IndicatorOfStatus = 8;
                existSuggestion.ApproveDt         = DateTime.Now;
                //existSuggestion.ApproveSuggBy = currentUser;
                await _context.SaveChangesAsync();

                return(await Task.FromResult(true));
            }
            else
            {
                return(await Task.FromResult(false));
            }
        }
Exemplo n.º 3
0
        public async Task <bool> UpdatePlanDt(string suggestionId, DateTime planDt, string currentUser)
        {
            var existSuggestion = _context.CipfSuggestion.Where(x => x.SuggestionId == suggestionId).FirstOrDefault();

            if (existSuggestion != null)
            {
                existSuggestion.Status             = "Đang thực hiện";
                existSuggestion.IndicatorOfStatus  = 4;
                existSuggestion.ApproveDt          = DateTime.Now;
                existSuggestion.ApproveSuggBy      = currentUser;
                existSuggestion.PlanFinishActionDt = planDt;
                await _context.SaveChangesAsync();

                return(await Task.FromResult(true));
            }
            else
            {
                return(await Task.FromResult(false));
            }
        }