예제 #1
0
        /// <summary>
        /// Actualiza|agrega un registro en Hotels
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 30/03/2016
        /// [erosado] 19/05/2016  Modified. Se agregó Asincronía
        /// </history>
        private async void btnAccept_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                btnAccept.Focus();
                if (enumMode != EnumMode.Search)
                {
                    if (ObjectHelper.IsEquals(hotel, oldHotel) && enumMode != EnumMode.Add)//si no modifico nada
                    {
                        _isClosing = true;
                        Close();
                    }
                    else//si hubo cambios
                    {
                        int    nRes   = 0;
                        string strMsj = ValidateHelper.ValidateForm(this, "Hotel");

                        if (strMsj == "")//Guardar
                        {
                            nRes = await BREntities.OperationEntity(hotel, enumMode);

                            UIHelper.ShowMessageResult("Hotel", nRes);
                            if (nRes > 0)
                            {
                                var r = await BRHotels.GetHotels(hotel, blnInclude : true);

                                hotel        = r.FirstOrDefault();
                                _isClosing   = true;
                                DialogResult = true;
                                Close();
                            }
                        }
                        else
                        {
                            UIHelper.ShowMessage(strMsj);
                        }
                    }
                }
                else
                {
                    _isClosing   = true;
                    nStatus      = Convert.ToInt32(cmbStatus.SelectedValue);
                    DialogResult = true;
                    Close();
                }
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
예제 #2
0
        /// <summary>
        /// Carga el combobox de hotels
        /// </summary>
        /// <history>
        /// [emoguel] created 16/05/2016
        /// [erosado] 19/05/2016  Modified. Se agregó asincronía
        /// </history>
        private async void LoadHotels()
        {
            try
            {
                List <Hotel> lstHotels = await BRHotels.GetHotels(nStatus : 1);

                cmbHotels.ItemsSource = lstHotels;
                skpStatus.Visibility  = Visibility.Hidden;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
예제 #3
0
        /// <summary>
        /// Llena el grid de Hotels y el combobox de hotels
        /// </summary>
        /// <history>
        /// [emoguel] created 12/05/2016
        /// [erosado] 19/05/2016  Modified. Se agregó asincronía
        /// </history>
        private async void LoadHotels()
        {
            try
            {
                List <Hotel> lstAllHotels = await BRHotels.GetHotels(nStatus : 1);

                List <Hotel> lstHotels = (hotelGroup.hgID != null) ? lstAllHotels.Where(ho => ho.hoGroup == hotelGroup.hgID).ToList() : new List <Hotel>();
                _oldHotels            = lstHotels.ToList();
                dgrHotels.ItemsSource = lstHotels;
                cmbHotels.ItemsSource = lstAllHotels;
                skpStatus.Visibility  = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
예제 #4
0
        /// <summary>
        /// Llena el grid de Hotels
        /// </summary>
        /// <param name="nIndex">Index que va a seleccionar</param>
        /// <history>
        /// [emoguel] created 29/03/2016
        /// [erosado] 19/05/2016  Modified. Se agregó asincronía
        /// </history>
        private async void LoadHotels(Hotel hotel = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                List <Hotel> lstHotels = await BRHotels.GetHotels(_hotelFilter, _nStatus, true);

                dgrHotels.ItemsSource = lstHotels;
                int nIndex = 0;
                if (hotel != null && lstHotels.Count > 0)
                {
                    hotel  = lstHotels.Where(ho => ho.hoID == hotel.hoID).FirstOrDefault();
                    nIndex = lstHotels.IndexOf(hotel);
                }
                GridHelper.SelectRow(dgrHotels, nIndex);
                StatusBarReg.Content = lstHotels.Count + " Hotels.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
예제 #5
0
        private async Task LoadHotels()
        {
            var result = await BRHotels.GetHotels(nStatus : 1);

            Hotels = result;
        }