private void CreateEventTypeButton_Click(object sender, RoutedEventArgs e) { if (CheckInputs() == true) { dbman = new DBConnectionManager(); pmsutil = new PMSUtil(); using (conn = new MySqlConnection(dbman.GetConnStr())) { conn.Open(); if (conn.State == ConnectionState.Open) { string eid = pmsutil.GenEventTypeID(); MySqlCommand cmd = conn.CreateCommand(); cmd.CommandText = "INSERT INTO appointment_types(type_id, appointment_type, custom, fee, status)" + "VALUES(@eid, @appointment_type, @custom, @fee, @status)"; cmd.Prepare(); cmd.Parameters.AddWithValue("@eid", eid); cmd.Parameters.AddWithValue("@appointment_type", EType.Text); cmd.Parameters.AddWithValue("@custom", Status.SelectedIndex + 1); cmd.Parameters.AddWithValue("@fee", Fee.Value); cmd.Parameters.AddWithValue("@status", Active.SelectedIndex + 1); int stat_code = cmd.ExecuteNonQuery(); conn.Close(); if (stat_code > 0) { _caller.SyncEventTypes(); pmsutil.LogAccount("Added event type - Type: " + EType.Text + " Fee: " + Fee.Value); MsgSuccess(); this.Close(); } else { MsgFail(); } } else { } } } else { } }