Exemple #1
0
        private async void LoadControls()
        {
            _guest = await BRGuests.GetGuest(_guestId);

            cboguum.ItemsSource = await BRUnavailableMotives.GetUnavailableMotives(1);

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

            if (_guest.guPRAvail != null)
            {
                cboguPRAvail.SelectedValue = _guest.guPRAvail;
            }
            if (_guest.guum != 0)
            {
                cboguum.SelectedValue = _guest.guum;
                txtguum.Text          = _guest.guum.ToString();
            }
            chkguOriginAvail.IsChecked         = _guest.guOriginAvail;
            chkguAvail.IsChecked               = _guest.guAvail;
            chkguAvailBySystem.IsChecked       = _guest.guAvailBySystem;
            txtguum.IsEnabled                  = cboguum.IsEnabled = cboguPRAvail.IsEnabled = btnCancel.IsEnabled =
                btnSave.IsEnabled              =
                    chkguOriginAvail.IsEnabled = chkguAvail.IsEnabled = txtguum.IsEnabled = cboguum.IsEnabled = false;
            btnEdit.IsEnabled                  = true;
        }
        /// <summary>
        /// Carga el combobox de unavailable motives
        /// </summary>
        /// <history>
        /// [emoguel] created 15/03/2016
        /// </history>
        private async void loadUnavailableMotives()
        {
            try
            {
                List <UnavailableMotive> lstUnavailableMotives = await BRUnavailableMotives.GetUnavailableMotives();

                cmbUnvMot.ItemsSource = lstUnavailableMotives;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
        /// <summary>
        /// Llena el combobox de Unavailable Motive
        /// </summary>
        /// <history>
        /// [emoguel] created 11/03/2016
        /// [emoguel] modified 30/05/2016 sel volvió async
        /// </history>
        protected async void LoadUnavailableMotives()
        {
            try
            {
                List <UnavailableMotive> lstUnavailableMotive = await BRUnavailableMotives.GetUnavailableMotives();

                cmbagum.ItemsSource = lstUnavailableMotive;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
        /// <summary>
        /// Llena el grid de unavailableMotives
        /// </summary>
        /// <param name="unavailableMotive">Objeto a seleccionar</param>
        /// <history>
        /// [emogue] created 06/06/2016
        /// </history>
        private async void LoadUnavailableMotives(UnavailableMotive unavailableMotive = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int nIndex = 0;
                List <UnavailableMotive> lstUnavailableMotives = await BRUnavailableMotives.GetUnavailableMotives(_nStatus, _unavailableMotive);

                dgrUnavailableMotives.ItemsSource = lstUnavailableMotives;
                if (lstUnavailableMotives.Count > 0 && unavailableMotive != null)
                {
                    unavailableMotive = lstUnavailableMotives.Where(um => um.umID == unavailableMotive.umID).FirstOrDefault();
                    nIndex            = lstUnavailableMotives.IndexOf(unavailableMotive);
                }
                GridHelper.SelectRow(dgrUnavailableMotives, nIndex);
                StatusBarReg.Content = lstUnavailableMotives.Count + " Unavailable Motives.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }