private void Function_Get_ATS(string Location) { int[] RowValue = new int[10]; int Row_Count = 0; string sql = "select * from Auto_Test_Script"; // ATS_Table.Rows.Clear(); Box_ATS.Rows.Clear(); DataTable dt = (DataTable)Box_ATS.DataSource; ATS_Table = AccessOperation.ExecuteQuery(sql, Location).Tables[0]; foreach (DataRow row in ATS_Table.Rows) { Box_ATS.Rows.Add(); DataGridViewRow box_row = Box_ATS.Rows[Row_Count]; if (Convert.ToInt32(row["Drive_Front"].ToString()) == 0) { box_row.Cells[0].Value = false; } else { box_row.Cells[0].Value = true; } if (Convert.ToInt32(row["Passenger_Front"].ToString()) == 0) { box_row.Cells[1].Value = false; } else { box_row.Cells[1].Value = true; } if (Convert.ToInt32(row["Left_Rear"].ToString()) == 0) { box_row.Cells[2].Value = false; } else { box_row.Cells[2].Value = true; } if (Convert.ToInt32(row["Right_Rear"].ToString()) == 0) { box_row.Cells[3].Value = false; } else { box_row.Cells[3].Value = true; } box_row.Cells[4].Value = row["Sound_Priority"].ToString(); box_row.Cells[5].Value = row["Sound_Duty_Cycle"].ToString(); box_row.Cells[6].Value = row["Sound_Cadence_Period"].ToString(); box_row.Cells[7].Value = row["Number_of_Repetitions"].ToString(); box_row.Cells[8].Value = this.Tone.Items[Convert.ToInt32(row["Sound_Tone"].ToString())]; box_row.Cells[9].Value = row["Sleep"].ToString(); Row_Count++; } Box_ATS.DataSource = dt; }
private void Btn_Save_Click(object sender, EventArgs e) { SaveFileDialog SaveDlg = new SaveFileDialog(); SaveDlg.Title = "Save The Test Script"; SaveDlg.Filter = "Auto Test Script|*.ats"; //SaveDlg.RestoreDirectory = true; if (SaveDlg.ShowDialog() == DialogResult.OK) { Location = SaveDlg.FileName.ToString(); AccessOperation.CreatAccessDatabase(Location); for (int i = 0; i < Box_ATS.RowCount - 1; i++) { int[] Chime_Info = Function_Get_ChimeInfo(i); AccessOperation.ExecuteInsert(Chime_Info); } } Box_ATS.AllowUserToAddRows = false; Btn_Modify.Enabled = true; Btn_Save.Enabled = false; Btn_Delete.Enabled = false; Btn_Run.Enabled = true; Btn_Load.Enabled = true; }