Ejemplo n.º 1
0
        public ActionResult Delete(int id)
        {
            var assignTask = TaskBO.AssignTaskGetById(id);

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

            TaskBO.AssignTaskDelete(id);
            AlertBO.Delete(id, (int)AlertType.AssignTask);
            return(RedirectToAction("Index", new { id = assignTask.TaskId }));
        }
Ejemplo n.º 2
0
        public ActionResult ListReport(ReportSearchModel searchModel)
        {
            if (searchModel == null)
            {
                searchModel = new ReportSearchModel();
            }
            DateTime sdate;
            DateTime edate;

            DateTime.TryParseExact(searchModel.StartDate, Helper.FormatDate,
                                   new CultureInfo("en-US"),
                                   DateTimeStyles.None,
                                   out sdate);
            DateTime.TryParseExact(searchModel.EndDate, Helper.FormatDate,
                                   new CultureInfo("en-US"),
                                   DateTimeStyles.None,
                                   out edate);

            var reports = TaskBO.ReportSearch(searchModel.UserId, sdate, edate);

            var user = new List <User>
            {
                new User {
                    UserName = "******"
                }
            };

            user.AddRange(UserBO.GetByDepartmentId(CurrentUser.DepartmentLeader));
            ViewBag.Users = user;
            var temReport = new List <Report>();

            if (reports != null && reports.Count > 0)
            {
                for (int i = 0; i < reports.Count; i++)
                {
                    reports[i].AssignTask = TaskBO.AssignTaskGetById(reports[i].AssignTaskId);
                    reports[i].Task       = TaskBO.GetById(reports[i].AssignTask.TaskId);
                    reports[i].User       = UserBO.GetById(reports[i].UserReport);


                    if (reports[i].User.DepartmentId == CurrentUser.DepartmentLeader)
                    {
                        temReport.Add(reports[i]);
                    }
                }
            }

            searchModel.Reports = temReport;
            return(View(searchModel));
        }
Ejemplo n.º 3
0
        public ActionResult OverDues(string date)
        {
            DateTime sdate;

            if (!DateTime.TryParseExact(date, Helper.FormatDate,
                                        new CultureInfo("en-US"),
                                        DateTimeStyles.None,
                                        out sdate))
            {
                sdate = DateTime.Now;
            }
            var users = TaskBO.ReportsOverDues(CurrentUser.DepartmentLeader, sdate.ToString("dd/MM/yyyy"));

            ViewBag.Date = sdate;
            return(View(users ?? new List <User>()));
        }
Ejemplo n.º 4
0
        public ActionResult Create(AssignTask assignTask)
        {
            var task = TaskBO.GetById(assignTask.TaskId);

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


            assignTask.CreateBy   = CurrentUser.Id;
            assignTask.CreateDate = DateTime.Now;
            assignTask.ModifyBy   = CurrentUser.Id;
            assignTask.ModifyDate = DateTime.Now;

            if (!string.IsNullOrEmpty(assignTask.StartAndEndDate) && assignTask.StartAndEndDate.Split('-').Length == 2)
            {
                var      strStart = assignTask.StartAndEndDate.Split('-')[0].Trim();
                var      strEnd   = assignTask.StartAndEndDate.Split('-')[1].Trim();
                DateTime sdate;
                DateTime edate;
                if (DateTime.TryParseExact(strStart, Helper.FormatDate,
                                           new CultureInfo("en-US"),
                                           DateTimeStyles.None,
                                           out sdate))
                {
                    assignTask.StartDate = sdate;
                }

                if (DateTime.TryParseExact(strEnd, Helper.FormatDate,
                                           new CultureInfo("en-US"),
                                           DateTimeStyles.None,
                                           out edate))
                {
                    assignTask.EndDate = edate;
                }

                TaskBO.AssignTaskInsert(assignTask);
                AlertBO.Insert(assignTask.Requirement, (int)AlertType.AssignTask, 0, assignTask.UserId);
            }
            return(RedirectToAction("Index", new { id = assignTask.TaskId }));


            ViewBag.Task  = task;
            ViewBag.Users = UserBO.GetByDepartmentId(CurrentUser.DepartmentLeader);
            return(View(assignTask));
        }
Ejemplo n.º 5
0
        public ActionResult UpdateEmployee(int id)
        {
            var subtask = TaskBO.AssignTaskGetById(id);

            if (subtask == null)
            {
                return(RedirectToAction("NotFound", "Home"));
            }
            ViewBag.SubTask = subtask;
            ViewBag.Task    = TaskBO.GetById(subtask.TaskId);
            ViewBag.Users   = UserBO.GetByDepartmentId(CurrentUser.DepartmentLeader);
            if (subtask.UserId <= 0 && ViewBag.Users != null && ViewBag.Users.Count > 0)
            {
                subtask.UserId = ViewBag.Users[0].Id;
            }
            return(View());
        }
Ejemplo n.º 6
0
        public ActionResult Edit(int id)
        {
            var assignTask = TaskBO.AssignTaskGetById(id);

            //AssignTask model;
            if (assignTask != null)
            {
                assignTask.StartAndEndDate = assignTask.StartDate.ToString(Helper.FormatDate) + " - " + assignTask.EndDate.ToString(Helper.FormatDate);
            }
            else
            {
                return(RedirectToAction("NotFound", "Home"));
            }
            ViewBag.Task  = TaskBO.GetById(assignTask.TaskId);
            ViewBag.Users = UserBO.GetByDepartmentId(CurrentUser.DepartmentLeader);
            return(View("Create", assignTask));
        }
Ejemplo n.º 7
0
        public ActionResult Create(int assignTaskId)
        {
            var assignTask = TaskBO.AssignTaskGetById(assignTaskId);

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

            var report = new Report
            {
                AssignTaskId = assignTaskId
            };

            PrepareData();
            return(View(report));
        }
Ejemplo n.º 8
0
 public IHttpActionResult UpdateTask(entities.Task editTask)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(BadRequest());
         }
         _TaskBO = new TaskBO();
         _TaskBO.EditTask(editTask);
         return(Ok("Success"));
     }
     catch (Exception)
     {
         return(Ok("Error"));
     }
 }
Ejemplo n.º 9
0
        public ActionResult Create(int id)
        {
            var task = TaskBO.GetById(id);

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

            var assignTask = new AssignTask
            {
                TaskId = id
            };

            ViewBag.Task  = task;
            ViewBag.Users = UserBO.GetByDepartmentId(CurrentUser.DepartmentLeader);
            return(View(assignTask));
        }
Ejemplo n.º 10
0
        //
        // GET: /AssignTask/

        public ActionResult Index(int id)
        {
            var task = TaskBO.GetById(id);

            if (task == null)
            {
                return(RedirectToAction("NotFound", "Home"));
            }
            var assignTasks = TaskBO.AssignTaskGetByTaskId(id);

            if (assignTasks != null && assignTasks.Count > 0)
            {
                for (int i = 0; i < assignTasks.Count; i++)
                {
                    assignTasks[i].User = UserBO.GetById(assignTasks[i].UserId);
                }
            }

            ViewBag.Task = task;

            return(View(assignTasks));
        }
Ejemplo n.º 11
0
        //
        // GET: /Report/

        public ActionResult Index(string date)
        {
            var      lstreport = new List <Report>();
            DateTime sdate;

            if (!DateTime.TryParseExact(date, Helper.FormatDate,
                                        new CultureInfo("en-US"),
                                        DateTimeStyles.None,
                                        out sdate))
            {
                sdate = DateTime.Now;
            }
            var reports = TaskBO.ReportByUserReportAndReportDate(CurrentUser.Id, sdate.ToString("dd/MM/yyyy"));

            if (reports != null && reports.Count > 0)
            {
                foreach (var item in reports)
                {
                    item.AssignTask = TaskBO.AssignTaskGetById(item.AssignTaskId);
                }
            }
            ViewBag.Date = sdate;
            return(View(reports ?? new List <Report>()));
        }
Ejemplo n.º 12
0
        public ActionResult Comment(Report model)
        {
            var report = TaskBO.ReportGetById(model.Id);

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

            if (!string.IsNullOrEmpty(model.Comment))
            {
                report.Comment     = model.Comment;
                report.CommentBy   = CurrentUser.Id;
                report.CommentDate = DateTime.Now;
                TaskBO.ReportUpdate(report);
                AlertBO.Insert(report.Comment, (int)AlertType.Comment, 0, report.UserReport);
                return(RedirectToAction("ListReport"));
            }
            else
            {
                ModelState.AddModelError("", "Comment is not empty");
            }
            return(View(report));
        }
Ejemplo n.º 13
0
        public ActionResult ViewTaskCallReportList(TaskViewType viewType)
        {
            IList <CallReportTaskViewModel> modelList = new List <CallReportTaskViewModel>();
            IList <ICallReportVO>           taskList  = null;

            if (viewType == TaskViewType.Draft)
            {
                taskList = TaskBO.RetrieveCallReportTaskList(User.Identity.Name, true);
                ViewBag.ActiveSubSubMenu = "TaskDraftCallReport";
            }
            else
            {
                taskList = TaskBO.RetrieveCallReportTaskList(User.Identity.Name, false);
                ViewBag.ActiveSubSubMenu = "TaskSubmittedCallReport";
            }

            if (taskList != null)
            {
                modelList = (IList <CallReportTaskViewModel>)TaskMapper.Map(
                    taskList, typeof(IList <ICallReportVO>), typeof(IList <CallReportTaskViewModel>));
            }

            return(View(modelList));
        }
Ejemplo n.º 14
0
        //
        // GET: /Task/

        public ActionResult Index(TasksSearchModel searchModel)
        {
            var listTasks = new List <TasksDisplayModel>();

            if (searchModel == null)
            {
                searchModel = new TasksSearchModel
                {
                    StartDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).ToString(Helper.FormatDate),
                    EndDate   = new DateTime(DateTime.Now.Year, DateTime.Now.Month + 1, 1).AddDays(-1).ToString(Helper.FormatDate),
                };
            }
            DateTime sdate;
            DateTime edate;

            DateTime.TryParseExact(searchModel.StartDate, Helper.FormatDate,
                                   new CultureInfo("en-US"),
                                   DateTimeStyles.None,
                                   out sdate);
            DateTime.TryParseExact(searchModel.EndDate, Helper.FormatDate,
                                   new CultureInfo("en-US"),
                                   DateTimeStyles.None,
                                   out edate);

            var departments = new List <Department> {
                new Department {
                    UserId = 0, Name = "--- All ---"
                }
            };

            departments.AddRange(DepartmentBO.GetAll());
            ViewBag.Departments = departments;

            var projects = new List <Project> {
                new Project {
                    Id = 0, Name = "--- All ---"
                }
            };

            projects.AddRange(ProjectBO.GetAll());
            ViewBag.Projects = projects;

            var tasks = TaskBO.Search(searchModel.Name, searchModel.Leader, sdate, edate);

            foreach (var item in tasks)
            {
                var department = DepartmentBO.GetById(item.Leader);
                var project    = ProjectBO.GetById(item.ProjectId);
                var model      = new TasksDisplayModel
                {
                    Id          = item.Id,
                    ProjectId   = item.ProjectId,
                    ProjectName = project.Name,
                    Name        = item.Name,
                    Description = item.Description,
                    Leader      = item.Leader,
                    LeaderName  = department.Name,
                    Priority    = item.Priority,
                    StartDate   = item.StartDate,
                    EndDate     = item.EndDate,
                    User        = UserBO.GetById(item.Leader),
                    CreatedDate = item.CreateDate == null ? string.Empty : ((DateTime)item.CreateDate).ToString(Helper.FormatDate),
                };

                if (CurrentUser.IsManager || CurrentUser.DepartmentLeader == item.Leader)
                {
                    listTasks.Add(model);
                }
            }
            searchModel.Tasks = listTasks;
            return(View(searchModel));
        }
Ejemplo n.º 15
0
        public ActionResult Delete(int id)
        {
            TaskBO.GetInstance().Delete(id);

            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 16
0
 public ActionResult Edit(int id)
 {
     return(View(TaskBO.GetInstance().Get(id)));
 }
Ejemplo n.º 17
0
        //
        // GET: /ManageTask/

        public ActionResult Index(int id = 0)
        {
            return(View(TaskBO.GetInstance().GetAll(id)));
        }