public A_1_AddEmployee(DataRow input_row, A_1_EmployeesUC a_1_EmployeesUC) { this.edit_form = true; this.parent = a_1_EmployeesUC; InitializeComponent(); //buttons this.input_row = input_row; this.nameTB.Text = input_row["Employee_Name"].ToString(); this.employee_id = int.Parse(input_row["Employee_ID"].ToString()); this.groupCB.FindStringExact(input_row["Group_Name"].ToString()); //Fill DGV1 (Salaries) DataTable salaries = a.runQuery("select change_date, salary from Salary inner join Employees on Salary.Employee_ID=Employees.Employee_ID where Salary.Employee_ID=" + input_row["Employee_ID"].ToString() + " order by Change_Date asc"); for (int i = 0; i < salaries.Rows.Count; i++) { dataGridView1.Rows.Add(salaries.Rows[i][0], salaries.Rows[i][1]); } //Fill DGV2 (Session) DataTable session = a.runQuery("select * from Employee_Session where Employee_ID = " + this.employee_id + " order by Begin_Date asc"); for (int i = 0; i < session.Rows.Count; i++) { dataGridView2.Rows.Add(session.Rows[i]["Session_ID"], session.Rows[i]["Begin_Date"], session.Rows[i]["End_Date"]); if (string.IsNullOrEmpty(session.Rows[i]["End_Date"].ToString())) { dataGridView2.Rows[i].DefaultCellStyle.BackColor = Color.LawnGreen; dataGridView2.Rows[i].DefaultCellStyle.SelectionBackColor = Color.Green; dataGridView2.Rows[i].Cells["End_Date"].Value = "Active Session"; } } }
public A_1_AddEmployee(A_1_EmployeesUC a_1_EmployeesUC) { this.parent = a_1_EmployeesUC; InitializeComponent(); //DGV setup this.dataGridView1.Rows.Add(DateTime.Now, ""); this.dataGridView2.Rows.Add("Session Added", DateTime.Now, ""); //Buttons this.addButton.Enabled = false; this.startSessionButton.Enabled = false; this.endSessionButton.Enabled = false; this.deleteSessionButton.Enabled = false; }