public ActionResult Delete(int id) { TaskBO.ReportDelete(id); AlertBO.Delete(id, (int)AlertType.Comment); AlertBO.Delete(id, (int)AlertType.Report); return(RedirectToAction("Index")); }
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)); }
public ActionResult Create(TasksModel model) { if (!CurrentUser.IsManager) { return(RedirectToAction("NotFound", "Home")); } if (!string.IsNullOrEmpty(model.Name)) { var task = new Task(); task.ProjectId = model.ProjectId; task.Leader = model.Leader; task.Name = model.Name; task.Priority = model.Priority; task.Description = model.Description; task.CreateBy = CurrentUser.Id; task.ModifyBy = CurrentUser.Id; task.CreateDate = DateTime.Now; 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.Insert(task); var department = DepartmentBO.GetById(task.Leader); if (department != null && department.UserId > 0) { AlertBO.Insert(task.Name, (int)AlertType.Task, 0, department.UserId); } //TODO ... Insert document } return(RedirectToAction("Index")); } PreparingData(); return(View(model)); }
public ActionResult Delete(int id) { if (!CurrentUser.IsManager) { return(RedirectToAction("NotFound", "Home")); } TaskBO.TaskDelete(id); AlertBO.Delete(id, (int)AlertType.Task); return(RedirectToAction("Index")); }
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 })); }
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 Detail(int referenceId, int typeId, int id) { AlertBO.Delete(id); switch (typeId) { case (int)AlertType.AssignTask: return(RedirectToAction("MyTask", "AssignTask")); case (int)AlertType.Task: return(RedirectToAction("Index", "Task")); case (int)AlertType.Comment: return(RedirectToAction("Index", "Report")); case (int)AlertType.Event: return(RedirectToAction("Index", "Appointment")); case (int)AlertType.Report: return(RedirectToAction("ListReport", "Report")); } return(RedirectToAction("Index")); }
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)); }
public ActionResult Delete(int id) { AlertBO.Delete(id); return(RedirectToAction("Index")); }
public ActionResult Index() { var alert = AlertBO.GetAll(CurrentUser.Id) ?? new List <Alert>(); return(View(alert)); }
public JsonResult Create(AppointmentModel model) { ResponseAppointment response; if (Validate(model)) { model.Attendees = new List <int>(); if (!string.IsNullOrEmpty(model.AttendessStr)) { var split = model.AttendessStr.Split(','); if (split.Length > 0) { for (int i = 0; i < split.Length; i++) { try { model.Attendees.Add(int.Parse(split[i])); AlertBO.Insert(model.Title, (int)AlertType.Event, 0, int.Parse(split[i])); } catch (Exception) { } } } } var appointment = new Appointment { Id = model.Id, Title = model.Title, Description = model.Description, CreateBy = CurrentUser.Id, CreateDate = DateTime.Now, ModifyBy = CurrentUser.Id, ModifyDate = DateTime.Now, Attendees = model.Attendees != null ? model.Attendees.Select(u => new User { Id = u }).ToList() : new List <User>() }; var strStart = model.StartAndEndDate.Split('-')[0].Trim(); var strEnd = model.StartAndEndDate.Split('-')[1].Trim(); DateTime sdate; DateTime edate; if (DateTime.TryParseExact(strStart, Helper.FormatDateTime, new CultureInfo("en-US"), DateTimeStyles.None, out sdate)) { appointment.StartDate = sdate; } if (DateTime.TryParseExact(strEnd, Helper.FormatDateTime, new CultureInfo("en-US"), DateTimeStyles.None, out edate)) { appointment.EndDate = edate; } AppointmentBO.Insert(appointment); response = new ResponseAppointment { Result = 1, Appointment = new { Id = appointment.Id, Title = appointment.Title, StartDate = appointment.StartDate.ToString("yyyy-MM-dd HH:mm"), EndDate = appointment.EndDate.ToString("yyyy-MM-dd HH:mm"), } }; } else { response = new ResponseAppointment { Result = 0, ErrorMsg = string.Join("\n", (from state in ModelState.Values from error in state.Errors select error.ErrorMessage).ToList()) }; } return(Json(response, JsonRequestBehavior.AllowGet)); }
public JsonResult Delete(int id) { AppointmentBO.Delete(id); AlertBO.Delete(id, (int)AlertType.Event); return(Json("ok", JsonRequestBehavior.AllowGet)); }