private void dataGridViewZmanProject_CellClick(object sender, DataGridViewCellEventArgs e) { if (cu.is_out_of_dataGridView_range(e.RowIndex, e.ColumnIndex, cu.get_dgv_last_row(dataGridViewZmanProject))) { dataGridViewZmanProject.ClearSelection(); return; } if (!cu.is_dataGridView_colored(dataGridViewMorimProject)) { dataGridViewZmanProject.ClearSelection(); return; } PanuiProject ct = new PanuiProject(); string id = cu.GetID(dataGridViewMorimProject); if (dataGridViewZmanProject.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor == Color.Empty) { dataGridViewZmanProject.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.MediumPurple; ct.Add(id, e.ColumnIndex, e.RowIndex); } else if (dataGridViewZmanProject.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor == Color.MediumPurple) { dataGridViewZmanProject.Rows[e.RowIndex].Cells[e.ColumnIndex].Style.BackColor = Color.Empty; ct.Delete(id, e.ColumnIndex, e.RowIndex); } dataGridViewZmanProject.ClearSelection(); }
public void panui_create_test_data() { MorimProject mp = new MorimProject(); DataTable morim = mp.GetMorim(); Random ran = new Random(); int top_morim = morim.Rows.Count; PanuiProject pa = new PanuiProject(); for (int i = 0; i < 800; i++) { int morim_row = ran.Next(0, top_morim); string code_more = morim.Rows[morim_row]["id"].ToString(); int day = ran.Next(1, 7); int hour = ran.Next(0, 40); try { pa.Add(code_more, day, hour); } catch { } } }