private void LoadUsername() { dgvUsername.DataSource = ""; TimeSheetAccess objTimeSheetAccess = new TimeSheetAccess(); cboUsername.DataSource = objTimeSheetAccess.DSLActive(cboSearch.SelectedValue.ToString(), txtSearch.Text); cboUsername.DisplayMember = "ptext"; cboUsername.ValueMember = "pvalue"; cboUsername.SelectedIndex = 0; }
private void LoadDepartmentEmployees() { try { TimeSheetAccess objTimesheetAccess = new TimeSheetAccess(); dgvDepartment.DataSource = objTimesheetAccess.DSLDepartmentEmployees(cboDepartment.SelectedValue.ToString(), cboUsername.SelectedValue.ToString()); dgvDepartment.AutoGenerateColumns = false; dgvDepartment.Columns[1].DataPropertyName = "ptext"; dgvDepartment.Columns[2].DataPropertyName = "pvalue"; foreach (DataGridViewRow dgRow in dgvDepartment.Rows) { dgRow.Cells[0].Value = false; } } catch (Exception) { throw; } }
private void btnMoveRight_Click(object sender, EventArgs e) { TimeSheetAccess objTimesheet = new TimeSheetAccess(); DataRow drw; DataTable tblSource = new DataTable(); tblSource.Columns.Add("username"); tblSource.Columns.Add("approver"); foreach (DataGridViewRow dgRow in dgvUsername.Rows) { if (bool.Parse(dgRow.Cells[0].Value.ToString()) == true) { drw = tblSource.NewRow(); drw["approver"] = cboUsername.SelectedValue.ToString(); drw["username"] = dgRow.Cells[2].Value.ToString(); tblSource.Rows.Add(drw); } } objTimesheet.TimesheetRemoveAccess(tblSource); LoadUsernameAccess(); LoadDepartmentEmployees(); }