Esempio n. 1
0
        /// <summary>
        /// Carga e inicializa las variables
        /// </summary>
        /// <history>
        /// [jorcanche]  created 11/08/2016
        /// </history>
        private async void FrmNotBookingMotive_OnLoaded(object sender, RoutedEventArgs e)
        {
            Invit            = false;
            Save             = false;
            lblUserName.Text = Context.User.User.peN;
            //Cargamos los Controles y el Guest
            _guest = await BRGuests.GetGuest(_guestId);

            cbmgunb.ItemsSource = await BRNotBookingMotives.GetNotBookingMotives(1);

            cbmguPRNoBook.ItemsSource = await BRPersonnel.GetPersonnel(Context.User.Location.loID, "ALL", "PR");

            //Asignar valores
            if (_guest.guNoBookD != null)
            {
                txtguNoBookD.Text = _guest.guNoBookD.Value.ToShortDateString();
            }
            cbmgunb.SelectedValue       = _guest.gunb;
            cbmguPRNoBook.SelectedValue = _guest.guPRNoBook;

            // establecemos el modo lectura
            SetMode(EnumMode.ReadOnly);
        }
        /// <summary>
        /// llena el grid de Not Booking Motives
        /// </summary>
        /// <param name="notBookingMotive">Objeto a seleccionar</param>
        /// <history>
        /// [emoguel] created 05/04/2016
        /// </history>
        private async void LoadNotBookingMotives(NotBookingMotive notBookingMotive = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int nIndex = 0;
                List <NotBookingMotive> lstNotBokMotives = await BRNotBookingMotives.GetNotBookingMotives(_nStatus, _notBookingMotFilter);

                dgrNotBokMotives.ItemsSource = lstNotBokMotives;
                if (lstNotBokMotives.Count > 0 && notBookingMotive != null)
                {
                    notBookingMotive = lstNotBokMotives.Where(nb => nb.nbID == notBookingMotive.nbID).FirstOrDefault();
                    nIndex           = lstNotBokMotives.IndexOf(notBookingMotive);
                }
                GridHelper.SelectRow(dgrNotBokMotives, nIndex);
                StatusBarReg.Content = lstNotBokMotives.Count + " Not Booking Motives.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }