Ejemplo n.º 1
0
        /// <summary>
        /// Guarda/Actualiza los datos de un Guest.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (!Validate())
            {
                return;
            }
            try
            {
                var agency = (cmbOtherInfoAgency.SelectedItem as AgencyShort);
                ((GuestInvitation)DataContext).Guest.gumk = (await BRAgencies.GetAgenciesByIds(new List <string> {
                    agency.agID
                })).FirstOrDefault()?.agmk;
                _catObj.Guest.guCheckOutHotelD            = (DateTime)dtpDeparture.Value;
                var result = await BRGuests.SaveGuest((GuestInvitation)DataContext);

                if (result > 0)
                {
                    ((GuestInvitation)DataContext).Guest = await BRGuests.GetGuest(result);

                    UIHelper.ShowMessage("Guest saved successfully.");
                }
                DialogResult = true;
                Close();
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }