Beispiel #1
0
        /// <summary>
        /// Carga y configuracion del grid RateTypes
        /// </summary>
        /// <param name="blnOnlyOneRegister"></param>
        /// <param name="blnRateTypes"></param>
        /// <param name="blnAllRateTypes"></param>
        /// <history>
        /// [edgrodriguez] 21/May/2016 Created
        /// </history>
        private async void LoadRateTypes(bool blnOnlyOneRegister, bool blnRateTypes, bool blnAllRateTypes)
        {
            if (!blnRateTypes)
            {
                return;
            }

            grdRatetypes.SelectionMode = (blnOnlyOneRegister) ? DataGridSelectionMode.Single : DataGridSelectionMode.Extended;
            pnlRateTypes.Visibility    = Visibility.Visible;
            _lstRateTypes = await BRRateTypes.GetRateTypes();

            grdRatetypes.ItemsSource = _lstRateTypes;

            chkAllRatetypes.IsChecked = blnAllRateTypes;
            chkAllRatetypes.IsEnabled = !blnOnlyOneRegister;

            if (!FrmProcGen._clsFilter.LstRateTypes.Any())
            {
                return;
            }

            chkAllRatetypes.IsChecked = (grdRatetypes.SelectionMode == DataGridSelectionMode.Extended) && FrmProcGen._clsFilter.AllRateTypes;
            if (grdRatetypes.ItemsSource != null && !FrmProcGen._clsFilter.AllRateTypes && !blnOnlyOneRegister)
            {
                grdRatetypes.SelectedItem = null;
                FrmProcGen._clsFilter.LstRateTypes.ForEach(c =>
                {
                    grdRatetypes.SelectedItems.Add(_lstRateTypes.FirstOrDefault(r => r.raID == c));
                });
            }
            else
            {
                grdRatetypes.SelectedItem = _lstRateTypes.FirstOrDefault(c => c.raID == FrmProcGen._clsFilter.LstRateTypes[0]);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Llena el grid de Rate Types
        /// </summary>
        /// <param name="ratType">Objeto a seleccionar en el grid</param>
        /// <history>
        /// [emoguel] created 13/04/2016
        /// [edgrodriguez] 21/05/2016 Modified. El método GetRateTypes se volvió asincrónico.
        /// </history>
        private async void LoadRateTypes(RateType rateType = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int             nIndex       = 0;
                List <RateType> lstRateTypes = await BRRateTypes.GetRateTypes(_rateTypeFilter, _nStatus, orderByraN : true);

                dgrRateTypes.ItemsSource = lstRateTypes;
                if (lstRateTypes.Count > 0 && rateType != null)
                {
                    rateType = lstRateTypes.Where(ra => ra.raID == rateType.raID).FirstOrDefault();
                    nIndex   = lstRateTypes.IndexOf(rateType);
                }
                GridHelper.SelectRow(dgrRateTypes, nIndex);
                StatusBarReg.Content = lstRateTypes.Count + " Rate Types.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }