public void showtask(ref List <TaskClass> tasklist, int idproject) { SqlConnection connect = new SqlConnection(connectstr); SqlCommand cmd = new SqlCommand("select * from task inner join project on task.task_project_id=project.project_id inner join employee on task.task_employee_id=employee.employee_id where project.project_id='" + idproject + "'", connect); try { connect.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { TaskClass task = new TaskClass(); task.id = (int)reader["task_id"]; task.name = (string)reader["task_name"]; task.description = (string)reader["task_description"]; task.start_time = reader.GetDateTime(3); task.end_time = reader.GetDateTime(4); task.id_project = (int)reader["task_project_id"]; task.id_employee = (int)reader["task_employee_id"]; task.status = (string)reader["task_status"]; task.project_name = (string)reader["project_name"]; task.employee_name = (string)reader["employee_name"]; tasklist.Add(task); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FinishTaskBtn_MouseClick(object sender, MouseEventArgs e) { TaskClass task = new TaskClass(); task.name = TaskNameTextbox.Text; task.start_time = Convert.ToDateTime(startTime.Text); task.end_time = Convert.ToDateTime(EndTime.Text); task.description = ProjDescription.Text; for (int i = 0; i < prolist.Count; i++) { if (prolist[i].name == projectnamecompo.Text) { task.id_project = prolist[i].id; break; } } for (int i = 0; i < emplist.Count; i++) { if (emplist[i].name == empNameBox.Text) { task.id_employee = emplist[i].id; break; } } empnow.AssignTask(task); empNameBox.Text = ""; ProjDescription.Clear(); MessageBox.Show("Task Assigned Successfully"); }
public ViewTasksUC(TaskClass task, EmployeeClass empnow) { InitializeComponent(); // Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20)); Task = task; employee = empnow; }
public void edittask(TaskClass task) { SqlConnection connect = new SqlConnection(connectstr); SqlCommand cmd = new SqlCommand("execute edit_task '" + task.id + "','" + task.name + "','" + task.description + "','" + task.start_time + "','" + task.end_time + "','" + task.id_project + "','" + task.id_employee + "','" + task.status + "','" + task.assign_employee + "','" + task.comment + "'", connect); try { connect.Open(); cmd.ExecuteNonQuery(); connect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void displaytasks(ref List <TaskClass> list, int id) { SqlConnection connect = new SqlConnection(connectstr); SqlCommand cmd = new SqlCommand("select * from task inner join employee on task.task_employee_id = employee.employee_id inner join project on project.project_id=task.task_project_id where task.task_employee_id='" + id + "' ", connect); try { connect.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { TaskClass task = new TaskClass(); task.id = (int)reader["task_id"]; task.name = (string)reader["task_name"]; task.description = (string)reader["task_description"]; task.start_time = reader.GetDateTime(3); task.end_time = reader.GetDateTime(4); task.id_project = (int)reader["task_project_id"]; task.id_employee = (int)reader["task_employee_id"]; try { task.comment = (string)reader["task_comment"]; } catch (Exception ex) { } task.status = (string)reader["task_status"]; if (task.status == "Waitting") { task.assign_employee = (int)reader["assign_employee"]; } task.employee_name = (string)reader["employee_name"]; task.project_name = (string)reader["project_name"]; list.Add(task); } reader.Close(); connect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void calculatehour(TaskClass task, EmployeeClass employee) { double time = Convert.ToDouble((5 * Math.Abs((task.end_time.Day - task.start_time.Day) + 1)) / 7); employee.hours += 8 * Convert.ToInt32(Math.Ceiling(time)); SqlConnection connect = new SqlConnection(connectstr); SqlCommand cmd = new SqlCommand("execute edit_employee '" + employee.id + "','" + employee.name + "','" + employee.gender + "','" + employee.password + "','" + employee.address + "','" + employee.phone + "','" + employee.mail + "','" + employee.join_date + "','" + employee.rank + "','" + employee.manager_id + "','" + employee.salary + "','" + employee.hours + "'", connect); try { connect.Open(); cmd.ExecuteNonQuery(); connect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void AssignTask(TaskClass emptask) { SqlConnection connect = new SqlConnection(connectstr); SqlCommand cmd = new SqlCommand("select dbo.start_task('" + emptask.start_time + "','" + emptask.status + "')", connect); try { connect.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { emptask.status = reader.GetString(0); } reader.Close(); SqlCommand cmd2 = new SqlCommand("execute insert_task '" + emptask.name + "','" + emptask.description + "','" + emptask.start_time + "','" + emptask.end_time + "','" + emptask.id_project + "','" + emptask.id_employee + "','" + emptask.status + "','" + emptask.assign_employee + "','" + emptask.comment + "'", connect); cmd2.ExecuteNonQuery(); connect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public AcceptRejectAssignedTask(TaskClass task) { InitializeComponent(); // Region = System.Drawing.Region.FromHrgn(CreateRoundRectRgn(0, 0, Width, Height, 20, 20)); Task = task; }