private void exportData_Click(object sender, EventArgs e) { //if (DataGridView[5].Value != false) List <ShortEmps> selected = new List <ShortEmps>(); try { for (var i = 0; i < ApprovalDataGridView.Rows.Count; i++) { bool needsToSign = (bool)ApprovalDataGridView.Rows[i].Cells[3].Value; if ((bool)ApprovalDataGridView.Rows[i].Cells[3].Value == true) { string employeeNum = Convert.ToString(ApprovalDataGridView.Rows[i].Cells[0].Value); string id = Convert.ToString(ApprovalDataGridView.Rows[i].Cells[1].Value); string fullName = Convert.ToString(ApprovalDataGridView.Rows[i].Cells[2].Value); string mobile = Convert.ToString(ApprovalDataGridView.Rows[i].Cells[4].Value); string email = Convert.ToString(ApprovalDataGridView.Rows[i].Cells[5].Value); string docSelected = EmployeeSysMainForm._DocSelectedAbsulutePath; // ****To Add - Add Document to DB list*** var data = new ShortEmps(); data.EmployeeNum = employeeNum; data.Id = id; data.FullName = fullName; data.Mobile = mobile; data.NeedsToSign = true; data.Email = email; data.DocSelected = docSelected; selected.Add(data); } } } catch (Exception exception) { MessageBox.Show(exception.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); } ExportEmployeeListToCSV(selected); this.Close(); }
public void GenerateSignList() { List <ShortEmps> empSignList = new List <ShortEmps>(); try { for (var i = 0; i < dataGridView.Rows.Count; i++) { string employeeNum = Convert.ToString(dataGridView.Rows[i].Cells[0].Value); string id = Convert.ToString(dataGridView.Rows[i].Cells[1].Value.ToString()); string fullName = Convert.ToString(dataGridView.Rows[i].Cells[2].Value); string mobile = Convert.ToString(dataGridView.Rows[i].Cells[3].Value); string email = Convert.ToString(dataGridView.Rows[i].Cells[4].Value); ShortEmps data = new ShortEmps(); data.EmployeeNum = employeeNum; data.Id = id; data.FullName = fullName; data.Mobile = mobile; data.NeedsToSign = false; data.Email = email; data.DocSelected = _DocSelectedAbsulutePath; empSignList.Add(data); } HealthSignForm Health = new HealthSignForm(empSignList); Health.ShowDialog(); } catch (Exception e) { MessageBox.Show(e.Message, "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); } }