예제 #1
0
        public async Task <bool> SaveCommentAll(ViewCommentModel tbl, int display)
        {
            try
            {
                IEnumerable <TblDailyDetail> model = await _db.TblDailyDetail.Where(m => m.DailyId == tbl.idDaily).ToListAsync();

                foreach (var item in model)
                {
                    if (display == 3)
                    {
                        item.Level1   = tbl.level;
                        item.Comment1 = tbl.comment;
                    }
                    else if (display == 4)
                    {
                        item.Level2   = tbl.level;
                        item.Comment2 = tbl.comment;
                    }
                    else if (display > 4)
                    {
                        item.Level3   = tbl.level;
                        item.Comment3 = tbl.comment;
                    }
                }

                await _db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
예제 #2
0
        public async Task <IActionResult> SaveComment([FromBody] ViewCommentModel tbl)
        {
            int            Display = int.Parse(HttpContext.User.FindFirst("Display").Value);
            bool           status;
            TblDailyDetail model;

            model = await _detailDiaryRepository.GetByMa(tbl.id);

            if (Display == 3)
            {
                model.Comment1 = tbl.comment;
                model.Level1   = tbl.level;
            }
            else if (Display == 4)
            {
                model.Comment2 = tbl.comment;
                model.Level2   = tbl.level;
            }
            else if (Display > 4)
            {
                model.Comment3 = tbl.comment;
                model.Level3   = tbl.level;
            }
            status = await _detailDiaryRepository.Update(model);

            return(Ok(new { status = status }));
        }
예제 #3
0
        public async Task <IActionResult> Comment(long Id)
        {
            int Display            = int.Parse(HttpContext.User.FindFirst("Display").Value);
            ViewCommentModel model = new ViewCommentModel();
            var tbl = await _detailDiaryRepository.GetByMa(Id);

            var job = await _jobRepository.GetAll();

            ViewBag.JobList  = new SelectList(job.Where(m => m.Id == tbl.JobId), "Id", "TenJob");
            model.id         = tbl.Id;
            model.jobId      = tbl.JobId;
            model.method     = tbl.Method;
            model.contentJob = tbl.ContentJob;
            model.result     = tbl.Result;
            if (Display == 3)
            {
                model.level   = tbl.Level1.HasValue ? tbl.Level1.Value : 3;
                model.comment = tbl.Comment1;
            }
            else if (Display == 4)
            {
                model.level   = tbl.Level2.HasValue ? tbl.Level2.Value : 3;
                model.comment = tbl.Comment2;
            }
            else if (Display > 4)
            {
                model.level   = tbl.Level3.HasValue ? tbl.Level3.Value : 3;
                model.comment = tbl.Comment3;
            }
            return(PartialView("_Comment", model));
        }
예제 #4
0
        public async Task <IActionResult> SaveCommentAll([FromBody] ViewCommentModel tbl)
        {
            int  Display = int.Parse(HttpContext.User.FindFirst("Display").Value);
            bool status;


            status = await _detailDiaryRepository.SaveCommentAll(tbl, Display);

            return(Ok(new { status = status }));
        }
        public JsonResult GetProjectInfo(int ProjectId)
        {
            CommentManager          commentManager = new CommentManager();
            List <ViewCommentModel> commentList    = new List <ViewCommentModel>();
            var path = commentManager.GetProjectInfo(ProjectId).Rows;

            if (path.Count > 0)
            {
                for (int i = 0; i < path.Count; i++)
                {
                    ViewCommentModel viewComment = new ViewCommentModel();
                    viewComment.ProjectName = path[i]["ProjectName"].ToString();
                    viewComment.Description = path[i]["Description"].ToString();
                    commentList.Add(viewComment);
                }
            }
            return(Json(commentList));
        }