private void btn_finished_form2_Click_1(object sender, EventArgs e) { //try catch --> List_of_cabinets null no cabinet has been created -> NullReferenceException try { if (clearkitlist_flag == true) { order.List_of_cabinetkits.Clear(); } order.List_of_cabinetkits.AddRange(list_of_cabinetkits); if (SudoLogin.current_employee.Editorder_flag == true) { SudoForm4.order.List_of_cabinetkits = order.List_of_cabinetkits; SudoForm4.order.CalculatePrice(); //Set Order in question and return to back-end //SudoForm4.order = order; this.Close(); this.Dispose(); SudoForm4.Current.Show(); } else { this.Hide(); Loginup log_in = new Loginup(db, order); log_in.ShowDialog(); } } catch (NullReferenceException) { MessageBox.Show("Your shopping cart is empty !", "Titre", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
//Event-handlers private void btn_confirm_Click(object sender, EventArgs e) { this.Dispose(); this.Close(); if (update_flag) { db.UpdateClient(newclient); OrderRecap.Current.Show(); } else { db.AddClient(newclient); Loginup login = new Loginup(db, current_order); login.ShowDialog(); } }