public IDataResult <Task> Add(Task task) { _validation = new Validation <TaskValidator>(); _validation.Validate(task); _taskDal.Add(task); return(new SuccessDataResult <Task>(task)); }
void AddRangeEmployee(Task task) { selectedEmployees.ForEach(employee => { _taskService.AddEmployee(task, employee); }); }
public void CreateTask(int id, Task task, string username) { //Implementaion to check whether user has authorization to the board relevent to this task. //Use the board id and user name which are sent in the input for this purpose _taskRepository.CreateTask(id, task); }
public Task EditTask(int board_id, int task_id, Task task) { var retrievedTask = _kanbanContext.Tasks.Where(b => b.TaskId == task_id && b.BoardId == board_id).First(); retrievedTask.Title = task.Title == ""? retrievedTask.Title: task.Title; retrievedTask.Description = task.Description == "" ? retrievedTask.Description : task.Description; retrievedTask.StartDate = task.StartDate.HasValue ? task.StartDate: retrievedTask.StartDate; retrievedTask.EndDate = task.EndDate.HasValue ? task.EndDate : retrievedTask.EndDate; retrievedTask.OrderNo = task.OrderNo == 0 ? retrievedTask.OrderNo : task.OrderNo; try { var retrievedStatusId = _kanbanContext.Statuses.Where(s => s.StatusType == task.Status.StatusType).First().StatusId; retrievedTask.StatusId = retrievedStatusId; } catch { retrievedTask.StatusId = retrievedTask.StatusId; } try { var retrievedTagId = _kanbanContext.Tags.Where(s => s.Tagname == task.Tag.Tagname).First().TagId; retrievedTask.StatusId = retrievedTagId; } catch { retrievedTask.TagId = retrievedTask.TagId; } _kanbanContext.Tasks.Update(retrievedTask); _kanbanContext.SaveChanges(); _kanbanContext.Tasks.Include(c => c.Comments).Where(b => b.TaskId == task_id && b.BoardId == board_id).First(); return(retrievedTask); }
public void View(Entities.Task task) { while (true) { Console.Clear(); Console.WriteLine("***********************"); Console.WriteLine("***** LOGWORK MENU ****"); Console.WriteLine("***** [W]RITE *********"); Console.WriteLine("***** [R]EAD **********"); Console.WriteLine("***** E[X]IT **********"); Console.WriteLine("***********************"); Console.Write("***** YOUR CHOICE : "); var choice = Console.ReadLine(); Console.Clear(); CommentView comView = new CommentView(); switch (choice.ToUpper()) { case "W": MakeWorkTime(task); break; case "R": GetAll(task); break; case "X": Console.Clear(); return; default: { Console.WriteLine("*******************************"); Console.WriteLine("******** INVALID CHOICE! *******"); Console.WriteLine("*******************************"); Thread.Sleep(1300); break; } } } }
public IResult Update(Task task) { _validation = new Validation <TaskValidator>(); _validation.Validate(task); _taskDal.Update(task); return(new SuccessResult()); }
private void SaveButton_Click(object sender, EventArgs e) { Task inserTask = new Task(); var userId = from u in userData.QueryAll() where u.USER_NAME == AssignedToComboBox.Text select u.USER_ID; int selectedUser = 0; foreach(int sU in userId) { selectedUser = sU; } inserTask.USER_ID = selectedUser; inserTask.ASSIGNED_BY = loggedInUser.USER_ID; inserTask.TASK_TITLE = TaskTitleTextBox.Text; inserTask.TASK_DETAILS = DetailsTextBox.Text; inserTask.ISSUE_DATE = IssueDatePicker.Value.Date; inserTask.DUE_DATE = DueDatePicker.Value.Date; if(SendEmailCheckBox.Checked) { inserTask.SEND_EMAIL = true; } else { inserTask.SEND_EMAIL = false; } taskData.Insert(inserTask); taskDataGridView.DataSource = taskData.QueryAll(); this.Close(); }
public TaskForm(int taskID) { InitializeComponent(); this.taskID = taskID; this.Text = "Güncelleme Formu"; task = _taskBusiness.GetById(taskID); txtDescription.Text = task.Description; }
public Task EditTask(int board_id, int task_id, string username, Task task) { //Implementaion to check whether user has authorization to the edit sent task //Use the task id and user name which are sent in the input for this purpose Task taskResponse = _taskRepository.EditTask(board_id, task_id, task); return(taskResponse); }
public override void SetUp() { gebruiker = new User(); sprintGebruiker = Creation.SprintGebruiker(gebruiker); taak = new Task(); taak2 = new Task(); base.SetUp(); }
public void CreateTask(int id, Task task) { //check where the board id is valid and then then inser task to table task.BoardId = id; if (_kanbanContext.Statuses.Where(s => s.StatusId == task.StatusId).First() != null && _kanbanContext.Tags.Where(t => t.TagId == task.TagId).First() != null) { _kanbanContext.Tasks.Add(task); } _kanbanContext.SaveChanges(); }
public List <Task> ListTasks(Entities.Task oTask) { try { oITareas = new Tareas(); return(oITareas.ListTaskbyState(oTask)); } catch (Exception ex) { throw; } }
private void MakeWorkTime(Entities.Task task) { Console.WriteLine(); LoggedWork lg = new LoggedWork(); LoggedWorkRepo repo = new LoggedWorkRepo("worktime.txt"); Console.WriteLine("How Much Time Takes U TO DO The Task? "); Console.Write("(int) "); lg.TimeSpent = int.Parse(Console.ReadLine()); lg.LoggedOn = DateTime.Now; lg.UserId = AuthenticationService.LoggedUser.Id; lg.TaskId = task.Id; repo.Save(lg); View(task); }
internal void CommentMenu(Entities.Task task) { Console.Clear(); Console.WriteLine("**** COMMENT MENU ****"); Console.WriteLine("** [V]IEW COMMENTS **"); Console.WriteLine("** [M]AKE COMMENTS **"); var choice = Console.ReadLine(); switch (choice.ToUpper()) { case "V": GetAllComments(task); break; case "M": AddComment(task); break; } }
public void Insert(Task taskObj) { string insertQuery = "INSERT INTO TASK(USER_ID, ASSIGNED_BY, TASK_TITLE, TASK_DETAILS, ISSUE_DATE, DUE_DATE, SEND_EMAIL)" + "VALUES(@USER_ID, @ASSIGNED_BY, @TASK_TITLE, @TASK_DETAILS, @ISSUE_DATE, @DUE_DATE, @SEND_EMAIL)"; MySqlCommand insertCommand = new MySqlCommand(insertQuery); MySqlParameter userIDParam = new MySqlParameter("@USER_ID", MySqlDbType.Int16); userIDParam.Value = taskObj.USER_ID; MySqlParameter assignedByParam = new MySqlParameter("@ASSIGNED_BY", MySqlDbType.Int16); assignedByParam.Value = taskObj.ASSIGNED_BY; MySqlParameter taskTitleParam = new MySqlParameter("@TASK_TITLE", MySqlDbType.VarChar, 50); taskTitleParam.Value = taskObj.TASK_TITLE; MySqlParameter taskDetailsParam = new MySqlParameter("@TASK_DETAILS", MySqlDbType.VarChar, 200); taskDetailsParam.Value = taskObj.TASK_DETAILS; MySqlParameter issueDateParam = new MySqlParameter("@ISSUE_DATE", MySqlDbType.DateTime); issueDateParam.Value = taskObj.ISSUE_DATE; MySqlParameter dueDateParam = new MySqlParameter("@DUE_DATE", MySqlDbType.DateTime); dueDateParam.Value = taskObj.DUE_DATE; MySqlParameter taskSendEmailParam = new MySqlParameter("@SEND_EMAIL", MySqlDbType.Byte); taskSendEmailParam.Value = taskObj.SEND_EMAIL; insertCommand.Parameters.Add(userIDParam); insertCommand.Parameters.Add(assignedByParam); insertCommand.Parameters.Add(taskTitleParam); insertCommand.Parameters.Add(taskDetailsParam); insertCommand.Parameters.Add(issueDateParam); insertCommand.Parameters.Add(dueDateParam); insertCommand.Parameters.Add(taskSendEmailParam); dataAccess.Execute(insertCommand); }
private void GetAll(Entities.Task task) { var logedUser = AuthenticationService.LoggedUser; LoggedWorkRepo repo = new LoggedWorkRepo("worktime.txt"); var time = repo.GetAll(); Console.Clear(); foreach (var t in time) { if (t.TaskId == task.Id) { Console.Write("Created by ID: "); Console.WriteLine(t.UserId); Console.Write("Logged on: "); Console.WriteLine(t.LoggedOn); Console.Write("LOGWORK: "); Console.WriteLine(t.TimeSpent); Console.WriteLine("###############################"); } } Console.ReadKey(); Console.Clear(); View(task); }
internal void AddComment(Entities.Task task) { Console.Clear(); CommentRepo repo = new CommentRepo("comments.txt"); Comment com = new Comment(); Console.WriteLine("***************************"); Console.WriteLine("***** ADD NEW COMMENT *****"); Console.Write("Comment: "); com.Comments = Console.ReadLine(); com.ParentId = Convert.ToInt32(task.Id); com.CreatedBy = Convert.ToInt32(AuthenticationService.LoggedUser.Id); repo.Save(com); Console.Clear(); Console.WriteLine("*******************************"); Console.WriteLine("********* COMPLETED!!! ********"); Console.WriteLine("*******************************"); Thread.Sleep(1500); Console.Clear(); DetailMenuVIew detailMenu = new DetailMenuVIew(); detailMenu.PrintRepo(task); }
private void GetAllComments(Entities.Task task) { var logedUser = AuthenticationService.LoggedUser; CommentRepo repo = new CommentRepo("comments.txt"); var coms = repo.GetAll(); Console.Clear(); foreach (var com in coms) { if (com.ParentId == task.Id) { Console.Write("Created by ID: "); Console.WriteLine(com.CreatedBy); Console.Write("Comments: "); Console.WriteLine(com.Comments); Console.WriteLine("###############################"); } } Console.ReadKey(); Console.Clear(); DetailMenuVIew detailMenu = new DetailMenuVIew(); detailMenu.PrintRepo(task); }
private void miDelete_Click(object sender, EventArgs e) { if (dgvTask.SelectedRows.Count > 0) { try { object cellValue = dgvTask.SelectedRows[0].Cells["ID"].Value; int taskID = (int)cellValue; _task = _businessTask.GetById(taskID); DialogResult dr = MessageBox.Show("Silmek istediğinize eminmisiniz", "Dikkat", MessageBoxButtons.YesNo); if (dr == DialogResult.Yes) { _businessTask.Remove(_task); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public bool IsUserLikedTask(DataContext db, Task task) { return this.GetCurrentUser(db).TasksLiked.Find(taskFind => taskFind.TaskId == task.TaskId) != null; }
private void SaveButton_Click(object sender, EventArgs e) { Task task = new Task(); task.TASK_ID = taskItem.TASK_ID; task.TASK_TITLE = TaskTitleTextBox.Text; task.TASK_DETAILS = DetailsTextBox.Text; task.ISSUE_DATE = IssueDatePicker.Value; task.DUE_DATE = DueDatePicker.Value; task.SEND_EMAIL = SendEmailCheckBox.Checked; var userId = from user in userData.QueryAll() where user.USER_NAME == taskItem.ASSIGNED_TO select user.USER_ID; foreach(int uID in userId) { task.USER_ID = uID; } userId = from user in userData.QueryAll() where user.USER_NAME == taskItem.ASSIGNED_BY select user.USER_ID; foreach(int uID in userId) { task.ASSIGNED_BY = uID; } taskData.Update(task, task.TASK_ID); initTaskDataGridView(userData.QueryAll(), taskData.QueryAll()); this.Close(); }
public void AddTaskLiked(DataContext db, Task task) { this.GetCurrentUser(db).TasksLiked.Add(task); }
public static void UserLikeTask(Task task) { GetCurrentUser().TasksLiked.Add(task); }
public bool AddTaskToRole(Entities.Role role, Entities.Task task) { return(true); }
private void btnSave_Click(object sender, EventArgs e) { _taskBusiness = new TaskBusiness(); try { if (this.taskID < 1) { task = new Entities.Task(); task.BeginDate = dtpBeginDate.Value; task.FinalDate = dtpFinalDate.Value; task.Description = txtDescription.Text; if (rdbNotStarted.Checked) { task.Status = "Başlanmadı"; } else if (rdbDevelop.Checked) { task.Status = "Geliştirilcek"; } else if (rdbTested.Checked) { task.Status = "Test Edilcek"; } task.EmloyeeId = (int)cmbEmployee.SelectedValue; task.ProjectId = (int)cmbProje.SelectedValue; _taskBusiness.Add(task); } else { task = new Entities.Task(); task.ID = this.taskID; task.BeginDate = dtpBeginDate.Value; task.FinalDate = dtpFinalDate.Value; task.Description = txtDescription.Text; if (rdbNotStarted.Checked) { task.Status = "Başlanmadı"; } else if (rdbDevelop.Checked) { task.Status = "Geliştirilcek"; } else if (rdbTested.Checked) { task.Status = "Test Edilcek"; } task.EmloyeeId = (int)cmbEmployee.SelectedValue; task.ProjectId = (int)cmbProje.SelectedValue; _taskBusiness.Update(task); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public bool RemoveTaskFromRole(Entities.Role role, Entities.Task task) { return(true); }
public override void SetUp() { taak = new Task(); base.SetUp(); }
public static List<Entities.Task> GetTestTask(int TestID) { List<Entities.Task> result = new List<Entities.Task>(); using (var connection = new SqlConnection(ConnectionString)) { connection.Open(); var command = connection.CreateCommand(); command.CommandText = "select TaskID,TestID,TaskNumber,Answer1,Answer2,Answer3,Answer4,CorrectAnswer,TaskText from [Database].dbo.Tasks where TestID=@testID order by TaskNumber ASC;"; var TestIDParam = command.CreateParameter(); TestIDParam.ParameterName = "@testID"; TestIDParam.Value = TestID; command.Parameters.Add(TestIDParam); using (var reader = command.ExecuteReader()) { while (reader.Read()) { Entities.Task task = new Entities.Task(); List<string> AnswersTest = new List<string>(); if (reader.GetValue(0) != DBNull.Value) { task.TaskID = reader.GetInt32(0); } if (reader.GetValue(1) != DBNull.Value) { task.TestID = reader.GetInt32(1); } if (reader.GetValue(2) != DBNull.Value) { task.Number = reader.GetInt32(2); } if (reader.GetValue(3) != DBNull.Value) { task.Answer_1= reader.GetString(3); } if (reader.GetValue(4) != DBNull.Value) { task.Answer_2=reader.GetString(4); } if (reader.GetValue(5) != DBNull.Value) { task.Answer_3=reader.GetString(5); } if (reader.GetValue(6) != DBNull.Value) { task.Answer_4=reader.GetString(6); } if (reader.GetValue(7) != DBNull.Value) { task.CorrectAnswer = reader.GetInt32(7); } if (reader.GetValue(8) != DBNull.Value) { task.TaskText = reader.GetString(8); } result.Add(task); } } } return result; }
public List<Task> QueryAll() { DataTable dataTable = new DataTable(); List<Task> taskList = new List<Task>(); string queryAll = "SELECT * FROM TASK"; MySqlCommand queryAllCommand = new MySqlCommand(queryAll); dataTable = dataAccess.Query(queryAllCommand); for (int i = 0; i < dataTable.Rows.Count; i++) { Task taskObject = new Task(); taskObject.TASK_ID = (int)dataTable.Rows[i][0]; taskObject.USER_ID = (int)dataTable.Rows[i][1]; taskObject.ASSIGNED_BY = (int)dataTable.Rows[i][2]; taskObject.TASK_TITLE = (string)dataTable.Rows[i][3]; taskObject.TASK_DETAILS = (string)dataTable.Rows[i][4]; taskObject.ISSUE_DATE = (DateTime)dataTable.Rows[i][5]; taskObject.DUE_DATE = (DateTime)dataTable.Rows[i][6]; taskObject.SEND_EMAIL = (bool)dataTable.Rows[i][7]; taskList.Add(taskObject); } return taskList; }
public void Update(Task taskObj, int taskID) { string updateQuery = "UPDATE TASK SET USER_ID = @USER_ID, ASSIGNED_BY = @ASSIGNED_BY, " + "TASK_TITLE = @TASK_TITLE, TASK_DETAILS = @TASK_DETAILS, " + "ISSUE_DATE = @ISSUE_DATE, DUE_DATE = @DUE_DATE, SEND_EMAIL = @SEND_EMAIL " + "WHERE TASK_ID = @TASK_ID"; MySqlCommand updateCommand = new MySqlCommand(updateQuery); MySqlParameter userIDParam = new MySqlParameter("@USER_ID", MySqlDbType.Int16); userIDParam.Value = taskObj.USER_ID; MySqlParameter assignedByParam = new MySqlParameter("@ASSIGNED_BY", MySqlDbType.Int16); assignedByParam.Value = taskObj.ASSIGNED_BY; MySqlParameter taskTitleParam = new MySqlParameter("@TASK_TITLE", MySqlDbType.VarChar, 50); taskTitleParam.Value = taskObj.TASK_TITLE; MySqlParameter taskDetailsParam = new MySqlParameter("@TASK_DETAILS", MySqlDbType.VarChar, 200); taskDetailsParam.Value = taskObj.TASK_DETAILS; MySqlParameter issueDateParam = new MySqlParameter("@ISSUE_DATE", MySqlDbType.DateTime); issueDateParam.Value = taskObj.ISSUE_DATE; MySqlParameter dueDateParam = new MySqlParameter("@DUE_DATE", MySqlDbType.DateTime); dueDateParam.Value = taskObj.DUE_DATE; MySqlParameter taskSendEmailParam = new MySqlParameter("@SEND_EMAIL", MySqlDbType.Byte); taskSendEmailParam.Value = taskObj.SEND_EMAIL; MySqlParameter taskIDParam = new MySqlParameter("@TASK_ID", MySqlDbType.Int64); taskIDParam.Value = taskID; updateCommand.Parameters.Add(userIDParam); updateCommand.Parameters.Add(assignedByParam); updateCommand.Parameters.Add(taskTitleParam); updateCommand.Parameters.Add(taskDetailsParam); updateCommand.Parameters.Add(issueDateParam); updateCommand.Parameters.Add(dueDateParam); updateCommand.Parameters.Add(taskSendEmailParam); updateCommand.Parameters.Add(taskIDParam); dataAccess.Execute(updateCommand); }
public List<Task> QueryByItem(string item) { DataTable dataTable = new DataTable(); List<Task> taskList = new List<Task>(); int intValueOfItem = 0; int.TryParse(item, out intValueOfItem); DateTime itemDatetime; DateTime.TryParse(item, out itemDatetime); string queryByItem = "SELECT * FROM TASK WHERE TASK_ID = @TASK_ID OR USER_ID = @USER_ID," + "ASSIGNED_BY = @ASSIGNED_BY OR TASK_TITLE = @TASK_TITLE OR TASK_DETAILS = @TASK_DETAILS OR " + "ISSUE_DATE = @ISSUE_DATE OR DUE_DATE = @DUE_DATE OR SEND_EMAIL = @SEND_EMAIL"; MySqlCommand queryCommand = new MySqlCommand(queryByItem); MySqlParameter taskIDParam = new MySqlParameter("@TASK_ID", MySqlDbType.Int16); taskIDParam.Value = intValueOfItem; MySqlParameter userIDParam = new MySqlParameter("@USER_ID", MySqlDbType.Int16); userIDParam.Value = intValueOfItem; MySqlParameter assignedByParam = new MySqlParameter("@ASSIGNED_BY", MySqlDbType.Int16); assignedByParam.Value = intValueOfItem; MySqlParameter taskTitleParam = new MySqlParameter("@TASK_TITLE", MySqlDbType.VarChar, 50); taskTitleParam.Value = item; MySqlParameter taskDetailsParam = new MySqlParameter("@TASK_DETAILS", MySqlDbType.VarChar, 200); taskDetailsParam.Value = item; MySqlParameter issueDateParam = new MySqlParameter("@ISSUE_DATE", MySqlDbType.DateTime); issueDateParam.Value = itemDatetime; MySqlParameter dueDateParam = new MySqlParameter("@DUE_DATE", MySqlDbType.DateTime); dueDateParam.Value = itemDatetime; queryCommand.Parameters.Add(taskIDParam); queryCommand.Parameters.Add(userIDParam); queryCommand.Parameters.Add(assignedByParam); queryCommand.Parameters.Add(taskTitleParam); queryCommand.Parameters.Add(taskDetailsParam); queryCommand.Parameters.Add(issueDateParam); queryCommand.Parameters.Add(dueDateParam); dataTable = dataAccess.Query(queryCommand); for (int i = 0; i < dataTable.Rows.Count; i++) { Task taskObject = new Task(); taskObject.TASK_ID = (int)dataTable.Rows[i][0]; taskObject.USER_ID = (int)dataTable.Rows[i][1]; taskObject.ASSIGNED_BY = (int)dataTable.Rows[i][2]; taskObject.TASK_TITLE = (string)dataTable.Rows[i][3]; taskObject.TASK_DETAILS = (string)dataTable.Rows[i][4]; taskObject.ISSUE_DATE = (DateTime)dataTable.Rows[i][5]; taskObject.DUE_DATE = (DateTime)dataTable.Rows[i][6]; taskObject.SEND_EMAIL = (bool)dataTable.Rows[i][7]; } return taskList; }
public IResult AddEmployee(Task task, Employee employee) { _taskDal.AddEmployee(task, employee); return(new SuccessResult()); }
public void LoadData() { pnlDoing.Controls.Clear(); pnlToDo.Controls.Clear(); pnlDone.Controls.Clear(); List <Entities.Task> todoList = _taskService.GetToDoList(Session.CurrentProject.Id).Data; List <Entities.Task> doingList = _taskService.GetDoingList(Session.CurrentProject.Id).Data; List <Entities.Task> doneList = _taskService.GetDoneList(Session.CurrentProject.Id).Data; this.Text = Session.CurrentProject.Name + " - Task Board"; if (todoList.Count > 0) { for (int i = 1; i < todoList.Count + 1; i++) { Task task = todoList[i - 1]; TaskCard card = new TaskCard() { Details = task.Details, TaskStateNames = TaskStateBaseNames.ToDo, TaskId = task.Id, CreatedDate = task.CreateDate, Top = i != 1 ? 143 * (i - 1) : 5, Left = 15 }; card.ChangeState += OnChangeState; this.pnlToDo.Controls.Add(card); } } if (doingList.Count > 0) { for (int i = 1; i < doingList.Count + 1; i++) { Task task = doingList[i - 1]; TaskCard card = new TaskCard() { Details = task.Details, TaskStateNames = TaskStateBaseNames.Doing, TaskId = task.Id, CreatedDate = task.CreateDate, Top = i != 1 ? 143 * (i - 1) : 5, Left = 15 }; card.ChangeState += OnChangeState; this.pnlDoing.Controls.Add(card); } } if (doneList.Count > 0) { for (int i = 1; i < doneList.Count + 1; i++) { Task task = doneList[i - 1]; TaskCard card = new TaskCard() { Details = task.Details, TaskStateNames = TaskStateBaseNames.Done, TaskId = task.Id, CreatedDate = task.CreateDate, Top = i != 1 ? 143 * (i - 1) : 5, Left = 15 }; card.ChangeState += OnChangeState; this.pnlDone.Controls.Add(card); } } LoadEvents(); }
public IResult RemoveEmployee(Task task, Employee employee) { _taskDal.RemoveEmployee(task.Id, employee); return(new SuccessResult()); }