public void HomeBtn_MouseClick(object sender, MouseEventArgs e) { flowLayoutPanel1.Controls.Clear(); flowLayoutPanel1.BringToFront(); OnHome.Visible = true; OnAddMng.Visible = false; OnAddProj.Visible = false; OnViewEmp.Visible = false; OnViewProj.Visible = false; AdminClass projectlist = new AdminClass(); List <ProjectClass> list = new List <ProjectClass>(); projectlist.projectview(ref list); for (int i = 0; i < list.Count; i++) { if (list[i].status != "Finish") { ViewProjUC view = new ViewProjUC(list[i]); view.ProjectName.Text = list[i].name; view.TaskEmpLabel.Text = list[i].manger_name; view.startDuration.Text = "Start on " + list[i].start_time.Day + " / " + list[i].start_time.Month + " / " + list[i].start_time.Year; view.endDuration.Text = "End on " + list[i].end_time.Day + " / " + list[i].end_time.Month + " / " + list[i].end_time.Year; flowLayoutPanel1.Controls.Add(view); } } }
public AdminForm() { InitializeComponent(); flowLayoutPanel1.Controls.Clear(); OnHome.Visible = true; OnAddMng.Visible = false; OnAddProj.Visible = false; OnViewEmp.Visible = false; OnViewProj.Visible = false; AdminClass projectlist = new AdminClass(); List <ProjectClass> list = new List <ProjectClass>(); projectlist.projectview(ref list); for (int i = 0; i < list.Count; i++) { if (list[i].status != "Finish") { ViewProjUC view = new ViewProjUC(list[i]); view.ProjectName.Text = list[i].name; view.TaskEmpLabel.Text = list[i].manger_name; view.startDuration.Text = "Start on " + list[i].start_time.Day + " / " + list[i].start_time.Month + " / " + list[i].start_time.Year; view.endDuration.Text = "End on " + list[i].end_time.Day + " / " + list[i].end_time.Month + " / " + list[i].end_time.Year; flowLayoutPanel1.Controls.Add(view); } } }
private void ViewProjBtn_MouseClick(object sender, MouseEventArgs e) { ViewProjUC.projInfo.Hide(); ViewProjUC.editProj.Hide(); ViewEmpUC.editData.Hide(); ViewProjUC.tasksPanel.Hide(); flowLayoutPanel1.Controls.Clear(); flowLayoutPanel1.BringToFront(); OnHome.Visible = false; OnAddMng.Visible = false; OnAddProj.Visible = false; OnViewEmp.Visible = false; OnViewProj.Visible = true; AdminClass projectlist = new AdminClass(); List <ProjectClass> list = new List <ProjectClass>(); projectlist.projectview(ref list); for (int i = 0; i < list.Count; i++) { if (list[i].status == "Finish") { ViewProjUC view = new ViewProjUC(list[i]); view.EditLabelBtn.Visible = false; view.ProjectName.Text = list[i].name; view.TaskEmpLabel.Text = list[i].manger_name; view.startDuration.Text = "Start on " + list[i].start_time.Day + " / " + list[i].start_time.Month + " / " + list[i].start_time.Year; view.endDuration.Text = "End on " + list[i].end_time.Day + " / " + list[i].end_time.Month + " / " + list[i].end_time.Year; flowLayoutPanel1.Controls.Add(view); } } //ProjectClass pro = new ProjectClass(); //ViewProjUC viewTasks = new ViewProjUC(pro); //viewTasks.EditLabelBtn.Visible = false; //flowLayoutPanel1.Controls.Add(viewTasks); }
public void finishproject(int id) { AdminClass adm = new AdminClass(); ProjectClass pro = new ProjectClass(); adm.projectview(ref list); for (int i = 0; i < list.Count; i++) { if (list[i].id == id) { pro = list[i]; break; } } SqlConnection connect = new SqlConnection(connectstr); SqlCommand cmd = new SqlCommand("select dbo.check_finish('" + pro.id + "')", connect); try { connect.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { pro.status = reader.GetString(0); } reader.Close(); SqlCommand cmd2 = new SqlCommand("execute edit_project '" + pro.id + "', '" + pro.name + "', '" + pro.description + "', '" + pro.start_time + "', '" + pro.end_time + "', '" + pro.status + "'", connect); cmd2.ExecuteNonQuery(); connect.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }