private void bttn_Edit_Click(object sender, EventArgs e) { try { DataTable dt_Selected_ticket_details = new DataTable(); string query = "select * from Passenger_table where Ticket_Name='" + comboBox_SelectedTicket.Text + "' "; dBAccess.ReadDataThroughAdapter(query, dt_Selected_ticket_details); window_new_Ticket window_New_Ticket = new window_new_Ticket(); window_New_Ticket.Show(); window_New_Ticket.dateTimePicker_new_ticket.Format = DateTimePickerFormat.Custom; window_New_Ticket.dateTimePicker_new_ticket.CustomFormat = "dd/MM/yyyy"; window_New_Ticket.dateTimePicker_new_ticket.Text = DateTime.Today.ToString(); //fill old info window_New_Ticket.textBox_From.Text = dt_Selected_ticket_details.Rows[0]["From_st"].ToString(); window_New_Ticket.textBox_To.Text = dt_Selected_ticket_details.Rows[0]["To_st"].ToString(); window_New_Ticket.dateTimePicker_new_ticket.Text = dt_Selected_ticket_details.Rows[0]["Date"].ToString(); window_New_Ticket.comboBox_Quota.Text = dt_Selected_ticket_details.Rows[0]["Quota"].ToString(); window_New_Ticket.comboBox_Class.Text = dt_Selected_ticket_details.Rows[0]["Class"].ToString(); window_New_Ticket.textBox_Boarding.Text = dt_Selected_ticket_details.Rows[0]["Board"].ToString(); window_New_Ticket.textBox_TrainNo.Text = dt_Selected_ticket_details.Rows[0]["TrainNo"].ToString(); window_New_Ticket.textBox_PTFare.Text = dt_Selected_ticket_details.Rows[0]["PT_Fare"].ToString(); window_New_Ticket.comboBox_PaymentMethod.Text = dt_Selected_ticket_details.Rows[0]["PaymentMethod"].ToString(); window_New_Ticket.comboBox_SlotNo.Text = dt_Selected_ticket_details.Rows[0]["Slot_no"].ToString(); window_New_Ticket.comboBox_Irctc_id.Text = dt_Selected_ticket_details.Rows[0]["Irctc_id"].ToString(); window_New_Ticket.textBox_MobileNo.Text = dt_Selected_ticket_details.Rows[0]["Mobile_no"].ToString(); window_New_Ticket.textBox_Ticket_name.Text = dt_Selected_ticket_details.Rows[0]["Ticket_Name"].ToString(); window_New_Ticket.textBox_P1_Name.Text = dt_Selected_ticket_details.Rows[0]["P1_Name"].ToString(); window_New_Ticket.textBox_P1_Age.Text = dt_Selected_ticket_details.Rows[0]["P1_Age"].ToString(); window_New_Ticket.comboBox_P1_Gender.Text = dt_Selected_ticket_details.Rows[0]["P1_Gender"].ToString(); window_New_Ticket.comboBox_P1_Birth.Text = dt_Selected_ticket_details.Rows[0]["P1_Birth"].ToString(); window_New_Ticket.checkBox_P1_Senior.Checked = (dt_Selected_ticket_details.Rows[0]["P1_S_Citizen"].ToString() == "0") ? false : true; window_New_Ticket.checkBox_P1_Child.Checked = (dt_Selected_ticket_details.Rows[0]["P1_Child"].ToString() == "0") ? false : true; window_New_Ticket.textBox_P2_Name.Text = dt_Selected_ticket_details.Rows[0]["P2_Name"].ToString(); window_New_Ticket.textBox_P2_Age.Text = dt_Selected_ticket_details.Rows[0]["P2_Age"].ToString(); window_New_Ticket.comboBox_P2_Gender.Text = dt_Selected_ticket_details.Rows[0]["P2_Gender"].ToString(); window_New_Ticket.comboBox_P2_Birth.Text = dt_Selected_ticket_details.Rows[0]["P2_Birth"].ToString(); window_New_Ticket.checkBox_P2_Senior.Checked = (dt_Selected_ticket_details.Rows[0]["P2_S_Citizen"].ToString() == "0") ? false : true; window_New_Ticket.checkBox_P2_Child.Checked = (dt_Selected_ticket_details.Rows[0]["P2_Child"].ToString() == "0") ? false : true; window_New_Ticket.textBox_P3_Name.Text = dt_Selected_ticket_details.Rows[0]["P3_Name"].ToString(); window_New_Ticket.textBox_P3_Age.Text = dt_Selected_ticket_details.Rows[0]["P3_Age"].ToString(); window_New_Ticket.comboBox_P3_Gender.Text = dt_Selected_ticket_details.Rows[0]["P3_Gender"].ToString(); window_New_Ticket.comboBox_P3_Birth.Text = dt_Selected_ticket_details.Rows[0]["P3_Birth"].ToString(); window_New_Ticket.checkBox_P3_Senior.Checked = (dt_Selected_ticket_details.Rows[0]["P3_S_Citizen"].ToString() == "0") ? false : true; window_New_Ticket.checkBox_P3_Child.Checked = (dt_Selected_ticket_details.Rows[0]["P3_Child"].ToString() == "0") ? false : true; window_New_Ticket.textBox_P4_Name.Text = dt_Selected_ticket_details.Rows[0]["P4_Name"].ToString(); window_New_Ticket.textBox_P4_Age.Text = dt_Selected_ticket_details.Rows[0]["P4_Age"].ToString(); window_New_Ticket.comboBox_P4_Gender.Text = dt_Selected_ticket_details.Rows[0]["P4_Gender"].ToString(); window_New_Ticket.comboBox_P4_Birth.Text = dt_Selected_ticket_details.Rows[0]["P4_Birth"].ToString(); window_New_Ticket.checkBox_P4_Senior.Checked = (dt_Selected_ticket_details.Rows[0]["P4_S_Citizen"].ToString() == "0") ? false : true; window_New_Ticket.checkBox_P4_Child.Checked = (dt_Selected_ticket_details.Rows[0]["P4_Child"].ToString() == "0") ? false : true; window_New_Ticket.textBox_P5_Name.Text = dt_Selected_ticket_details.Rows[0]["P5_Name"].ToString(); window_New_Ticket.textBox_P5_Age.Text = dt_Selected_ticket_details.Rows[0]["P5_Age"].ToString(); window_New_Ticket.comboBox_P5_Gender.Text = dt_Selected_ticket_details.Rows[0]["P5_Gender"].ToString(); window_New_Ticket.comboBox_P5_Birth.Text = dt_Selected_ticket_details.Rows[0]["P5_Birth"].ToString(); window_New_Ticket.checkBox_P5_Senior.Checked = (dt_Selected_ticket_details.Rows[0]["P5_S_Citizen"].ToString() == "0") ? false : true; window_New_Ticket.checkBox_P5_Child.Checked = (dt_Selected_ticket_details.Rows[0]["P5_Child"].ToString() == "0") ? false : true; window_New_Ticket.textBox_P6_Name.Text = dt_Selected_ticket_details.Rows[0]["P6_Name"].ToString(); window_New_Ticket.textBox_P6_Age.Text = dt_Selected_ticket_details.Rows[0]["P6_Age"].ToString(); window_New_Ticket.comboBox_P6_Gender.Text = dt_Selected_ticket_details.Rows[0]["P6_Gender"].ToString(); window_New_Ticket.comboBox_P6_Birth.Text = dt_Selected_ticket_details.Rows[0]["P6_Birth"].ToString(); window_New_Ticket.checkBox_P6_Senior.Checked = (dt_Selected_ticket_details.Rows[0]["P6_S_Citizen"].ToString() == "0") ? false : true; window_New_Ticket.checkBox_P6_Child.Checked = (dt_Selected_ticket_details.Rows[0]["P6_Child"].ToString() == "0") ? false : true; }//end of try catch (Exception ex) { throw ex; } }
private void newTicketToolStripMenuItem_Click(object sender, EventArgs e) { win_new_ticket = new window_new_Ticket(); win_new_ticket.Show(); }