Ejemplo n.º 1
0
 public ActionResult Create(Report model)
 {
     if (Validate(model))
     {
         var assignTask = TaskBO.AssignTaskGetById(model.AssignTaskId);
         var report     = new Report
         {
             ReportResult     = model.ReportResult,
             AssignTaskId     = model.AssignTaskId,
             CompletedPercent = model.CompletedPercent,
             NextTask         = model.NextTask,
             CreateDate       = DateTime.Now,
             ReportDate       = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day),
             CreateBy         = CurrentUser.Id,
             ModifyBy         = CurrentUser.Id,
             ModifyDate       = DateTime.Now,
             TaskId           = assignTask != null ?assignTask.TaskId : 0,
             UserReport       = CurrentUser.Id,
             CommentDate      = DateTime.Now,
             ReportType       = model.ReportType
         };
         TaskBO.ReportInsert(report);
         AlertBO.Insert(report.ReportResult, (int)AlertType.Report, 0, assignTask.CreateBy);
         TaskBO.AssignTaskUpdateCompleted(model.AssignTaskId, model.CompletedPercent);
         return(RedirectToAction("Index"));
     }
     PrepareData();
     return(View(model));
 }
Ejemplo n.º 2
0
        public ActionResult Edit(Report model)
        {
            var report = TaskBO.ReportGetById(model.Id);

            if (report == null)
            {
                return(RedirectToAction("NotFound", "Home"));
            }

            if (Validate(model))
            {
                report.ReportResult     = model.ReportResult;
                report.CompletedPercent = model.CompletedPercent;
                report.NextTask         = model.NextTask;
                report.ModifyBy         = CurrentUser.Id;
                report.ModifyDate       = DateTime.Now;
                report.ReportType       = model.ReportType;


                TaskBO.ReportUpdate(report);
                TaskBO.AssignTaskUpdateCompleted(report.AssignTaskId, model.CompletedPercent);
                return(RedirectToAction("Index"));
            }
            PrepareData();
            return(View("Create", model));
        }