private void buttonModify_Click(object sender, EventArgs e) { ModifyForm modifyForm = new ModifyForm(); modifyForm.ShowDialog(); labelNotice.Text = "修改成功"; }
/// <summary> /// When double-clicking a cell, either trigger a New Booking form or Modify Booking form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1 && e.ColumnIndex > 0) { string facName; DateTime date; int hour = 0; facName = listFacilityAvailabiltyByDay[e.RowIndex].FacName.ToString(); date = selectedDate; // get the correct timing // look at the column, and pass an Hour object // can we create an Enum to help with the mapping? //switch (e.ColumnIndex) //{ // case 1: // hour = 7; // break; // case 2: // hour = 8; // break; // case 3: // hour = 9; // break; // case 4: // hour = 10; // break; // case 5: // hour = 11; // break; // case 6: // default: // break; //} if (e.ColumnIndex >= 1 && e.ColumnIndex <= 14) { hour = e.ColumnIndex + 6; } // trigger correct type of form if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString() == "True") { // Trigger Modify Booking //bookingType = "Modify Booking"; ModifyForm form1 = new ModifyForm(facName, date, hour); form1.refToAvailabiltyForm = this; form1.ShowDialog(); } else { // Trigger New Booking //bookingType = "New Booking"; MakeBookingForm form2 = new MakeBookingForm(facName, date, hour); form2.refToAvailabiltyForm = this; form2.ShowDialog(); } //MessageBox.Show("Type of form triggerred: " + bookingType); //MessageBox.Show("Date: " + selectedDate.ToShortDateString()); //MessageBox.Show("Facility Name: " + listFacilityAvailabiltyByDay[e.RowIndex].FacName.ToString()); //MessageBox.Show("Time: " + hour.ToString() + "AM"); } }
public MemberForm(ModifyForm f) { InitializeComponent(); mdyform = f; i = 1; }