public TaskTracker GetSubTaskByID(int id) { TaskTracker _obj = new TaskTracker(); return _obj.GetSubTaskByID(id); }
public IHttpActionResult EditTask(TaskTracker _obj) { TaskTracker _objTask = new TaskTracker(); if (!ModelState.IsValid) { return BadRequest(ModelState); } try { _objTask.UpdateTask(_obj.Task_ID, _obj.Title, _obj.Description, Convert.ToDateTime( _obj.TaskDueDate), _obj.Task_Status, Convert.ToDateTime( _obj.StartDate)); } catch (Exception ex) { } return StatusCode(HttpStatusCode.NoContent); }
public List<TaskTracker> GetTaskAndSubTask() { List<TaskTracker> _lst = new List<TaskTracker>(); using (var db = new SqlHelper(ConfigurationManager.ConnectionStrings["collect2000ConnectionString"].ConnectionString)) { var q = @"SELECT Task_ID, Task_Title, InternalRadioOption, DayInterval, MonthInterval,WeekNumber,WeekDayName,MonthName, Task_Description, TaskAssignedTo, Task_DueDate, CreatedDate, AppointmentStartTime, AppointmentEndTime, RecurrencePatternType, RecurrencePatternInterval, RecurrencePatternFallOn, RecurrenceRangeStartDate, RecurrenceRangeEndByDate, RecurrenceRangeType, RecurrenceRangeOccurrence, TaskAssignedBy FROM dbo.ERC_Tasks ORDER BY Task_ID DESC;"; using (var dr = db.Query(q)) { while (dr.Read()) { TaskTracker info = new TaskTracker(); info.Task_ID = Convert.ToInt32(dr[0].ToString()); info.Title = Convert.ToString(dr["Task_Title"]); info.Description = Convert.ToString(dr["Task_Description"]); info.TaskDueDate = Convert.ToString(dr["Task_DueDate"]); info.CreatedDate = Convert.ToString(dr["CreatedDate"]); info.AppointmentStartTime = dr["AppointmentStartTime"] as string ?? ""; info.AppointmentEndTime = dr["AppointmentEndTime"] as string ?? ""; info.RecurrencePatternType = dr["RecurrencePatternType"] as string ?? ""; info.RecurrencePatternInterval = dr["RecurrencePatternInterval"] as int? ?? 0; info.RecurrencePatternFallOn = dr["RecurrencePatternFallOn"] as string ?? ""; info.RecurrenceRangeStartDate = dr["RecurrenceRangeStartDate"] as string ?? ""; info.RecurrenceRangeEndByDate = dr["RecurrenceRangeEndByDate"] as string ?? ""; info.RecurrenceRangeType = dr["RecurrenceRangeType"] as string ?? ""; info.RecurrenceRangeOccurrence = dr["RecurrenceRangeOccurrence"] as int? ?? 0; info.TaskAssignedBy = Convert.ToString(dr["TaskAssignedBy"]) as string ?? ""; info.TaskAssignedTo = Convert.ToString(dr["TaskAssignedTo"]) as string ?? ""; info.InternalRadioOption = Convert.ToString(dr["InternalRadioOption"]) as string ?? ""; info.DayInterval = Convert.ToString(dr["DayInterval"]) as string ?? ""; info.MonthInterval = Convert.ToString(dr["MonthInterval"]) as string ?? ""; info.WeekNumber = Convert.ToString(dr["WeekNumber"]) as string ?? ""; info.WeekDayName = Convert.ToString(dr["WeekDayName"]) as string ?? ""; info.MonthName = Convert.ToString(dr["MonthName"]) as string ?? ""; info.SubTask = GetSubTaskList(Convert.ToInt32(dr[0].ToString())); _lst.Add(info); } } } if (_lst == null) { throw new Exception("No match data found "); } return _lst; }
public TaskTracker GetSubTaskByID(int ID) { TaskTracker info = new TaskTracker(); using (var db = new SqlHelper(ConfigurationManager.ConnectionStrings["collect2000ConnectionString"].ConnectionString)) { var q = @"SELECT SubTask_ID, Task_ID, Task_Title, Task_Description, Task_DueDate, CreatedDate, StartDate, Task_Status FROM dbo.ERC_SubTasks WHERE SubTask_ID = @ID;"; using (var dr = db.Query(q, new SqlParameter("@ID", ID))) { if (dr.Read()) { info.SubTask_ID = Convert.ToInt32(dr[0].ToString()); info.Task_ID = Convert.ToInt32(dr["Task_ID"].ToString()); info.Title = Convert.ToString(dr["Task_Title"]); info.Description = Convert.ToString(dr["Task_Description"]); info.TaskDueDate = Convert.ToString(dr["Task_DueDate"]); info.CreatedDate = Convert.ToString(dr["CreatedDate"]); info.StartDate = Convert.ToString(dr["StartDate"]); info.Task_Status = Convert.ToString(dr["Task_Status"]); } } } if (info == null) { throw new Exception("No match data found "); } return info; }
private List<TaskTracker> GetSubTaskList(int taskId) { List<TaskTracker> _lst = new List<TaskTracker>(); using (var db = new SqlHelper(ConfigurationManager.ConnectionStrings["collect2000ConnectionString"].ConnectionString)) { var q = @" EXEC USP_GetAllSubTaskByID @ID "; using (var dr = db.Query(q, new SqlParameter("@ID", taskId))) { while (dr.Read()) { TaskTracker info = new TaskTracker(); user usreinfo = new user(); usreinfo.UserName = Convert.ToString(dr["AssignedTo"]); info.Task_ID = Convert.ToInt32(dr["Task_ID"].ToString()); info.SubTask_ID = Convert.ToInt32(dr["SubTask_ID"].ToString()); info.Title = Convert.ToString(dr["Task_Title"]); info.Description = Convert.ToString(dr["Task_Description"]); info.TaskDueDate = Convert.ToString(dr["TaskDueDate"]); info.CreatedDate = Convert.ToString(dr["CreatedDate"]); info.StartDate = Convert.ToString(dr["StartDate"]); info.Task_Status = Convert.ToString(dr["Task_Status"]); info.AssignedTo = usreinfo; _lst.Add(info); } } } if (_lst == null) { throw new Exception("No match data found "); } return _lst; }
public List<TaskTracker> GetAllTasks() { TaskTracker _obj = new TaskTracker(); var _lst = _obj.GetTaskAndSubTask(); return _lst; }
public IHttpActionResult AddSubTaskAssignment(Assignment _objView) { TaskTracker _objTask = new TaskTracker(); if (!ModelState.IsValid) { return BadRequest(ModelState); } _objTask.AddSubTaskAssignment(_objView); return CreatedAtRoute("DefaultApi", new { id = _objView.TaskId }, _objView); }
public IHttpActionResult DeleteSubTasks(int id) { if (id == 0) { return NotFound(); } TaskTracker _objTask = new TaskTracker(); _objTask.DeleteSubTask(id); return Ok("Deleted successfully."); }
public string AddReccurrence(TaskTracker _obj) { TaskTracker _objTask = new TaskTracker(); try { _objTask.AddReccurrence(_obj.Task_ID, _obj.InternalRadioOption, _obj.DayInterval, _obj.MonthInterval, _obj.WeekNumber, _obj.WeekDayName, _obj.MonthName ,_obj.AppointmentStartTime, _obj.AppointmentEndTime, _obj.RecurrencePatternType, _obj.RecurrencePatternInterval, _obj.RecurrencePatternFallOn, _obj.RecurrenceRangeStartDate, _obj.RecurrenceRangeEndByDate, _obj.RecurrenceRangeType, _obj.RecurrenceRangeOccurrence); } catch (Exception ex) { return "error"; } return "ok"; }
public string AddSubTask(TaskTracker _obj) { TaskTracker _objTask = new TaskTracker(); try { _objTask.AddSubTask(_obj.Title, _obj.Description, Convert.ToDateTime(_obj.TaskDueDate), _obj.Task_Status, _obj.Task_ID, Convert.ToDateTime(_obj.StartDate)); } catch (Exception ex) { return "error"; } return "ok"; }