public ActionResult Edit(int id) { if (!CurrentUser.IsManager) { return(RedirectToAction("NotFound", "Home")); } var item = TaskBO.GetById(id); TasksModel model; if (item != null) { model = new TasksModel { Id = item.Id, ProjectId = item.ProjectId, Name = item.Name, Description = item.Description, Priority = item.Priority, StartDate = item.StartDate, EndDate = item.EndDate, Leader = item.Leader, StartAndEndDate = item.StartDate.ToString(Helper.FormatDate) + " - " + item.EndDate.ToString(Helper.FormatDate), DocumentIds = string.Empty, Documents = new List <Document>() }; } else { return(RedirectToAction("NotFound", "Home")); } PreparingData(); return(View("Create", model)); }
public ActionResult MyTask(AssignTasksSearchModel searchmodel) { var listAssignTasks = new List <AssignTask>(); if (searchmodel == null) { searchmodel = new AssignTasksSearchModel(); } 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 assigntasks = TaskBO.AssignTaskSearch(searchmodel.Requirement, CurrentUser.Id, sdate, edate); if (assigntasks != null) { foreach (var item in assigntasks) { item.Task = TaskBO.GetById(item.TaskId); } listAssignTasks = assigntasks; } searchmodel.AssignTask = listAssignTasks; return(View(searchmodel)); }
public ActionResult Edit(TasksModel model) { if (!CurrentUser.IsManager) { return(RedirectToAction("NotFound", "Home")); } if (model != null) { var task = TaskBO.GetById(model.Id); if (task == null) { return(RedirectToAction("NotFound", "Home")); } task.ProjectId = model.ProjectId; task.Leader = model.Leader; task.Name = model.Name; task.Priority = model.Priority; task.Description = model.Description; task.ModifyBy = CurrentUser.Id; task.ModifyDate = DateTime.Now; if (!string.IsNullOrEmpty(model.StartAndEndDate) && model.StartAndEndDate.Split('-').Length == 2) { var strStart = model.StartAndEndDate.Split('-')[0].Trim(); var strEnd = model.StartAndEndDate.Split('-')[1].Trim(); DateTime sdate; DateTime edate; if (DateTime.TryParseExact(strStart, Helper.FormatDate, new CultureInfo("en-US"), DateTimeStyles.None, out sdate)) { task.StartDate = sdate; } if (DateTime.TryParseExact(strEnd, Helper.FormatDate, new CultureInfo("en-US"), DateTimeStyles.None, out edate)) { task.EndDate = edate; } TaskBO.Update(task); //TODO ... Insert document } return(RedirectToAction("Index")); } model = new TasksModel(); PreparingData(); return(View("Create", model)); }
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)); }
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)); }
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()); }
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)); }
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)); }
// // 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)); }