Esempio n. 1
0
        private void TBConfirm_Click(object sender, EventArgs e)
        {
            if (SelectedButton == 1 || SelectedButton == 3)
            {
                Guest GuestToSave = null;

                if (SelectedButton == 1)
                {
                    GuestToSave = new Guest();
                    contextDB.Guest.InsertOnSubmit(GuestToSave);
                }
                else
                {
                    GuestToSave = GuestLB.SelectedItem as Guest;
                }
                GuestToSave.LastName    = Text1.Text;
                GuestToSave.FirstName   = Text2.Text;
                GuestToSave.Nationality = Text3.Text;
                GuestToSave.IdProof     = Text4.Text;
                GuestToSave.DateOfBirth = TPDateOfBirth.Value;

                SelectGuest.Enabled = false;
                contextDB.SubmitChanges();
                LoadGuest();
            }
            else if (SelectedButton == 4 || SelectedButton == 6)
            {
                Payer PayerToSave = null;

                if (SelectedButton == 4)
                {
                    PayerToSave = new Payer();
                    contextDB.Payer.InsertOnSubmit(PayerToSave);
                }
                else
                {
                    PayerToSave = PayerLB.SelectedItem as Payer;
                }
                PayerToSave.Name            = Text1.Text;
                PayerToSave.Address         = Text2.Text;
                PayerToSave.AccountNumber   = Text3.Text;
                PayerToSave.MethodOfPayment = CBPayment.SelectedItem.ToString();

                contextDB.SubmitChanges();
                LoadPayer();
            }

            TableLP.Visible = false;
        }
Esempio n. 2
0
 private void DeletePB_Click(object sender, EventArgs e)
 {
     if (GuestLB.SelectedItems.Count > 0)
     {
         Payer ToCheck = PayerLB.SelectedItem as Payer;
         contextDB.Payer.DeleteOnSubmit(ToCheck);
         contextDB.SubmitChanges();
         PayerLB.Items.RemoveAt(PayerLB.SelectedIndex);
     }
     else if (GuestLB.SelectedItems.Count == 0)
     {
         string       Error1 = "Please select a payer";
         CustomDialog Error  = new CustomDialog(Error1, 1);
         Error.ShowDialog();
     }
 }