Esempio n. 1
0
        /// <summary>
        /// Despliega el formulario de detalles
        /// </summary>
        /// <history>
        /// [vipacheco] 03/14/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            //Verificamos que este en modo Edición!
            if (!btnEdit.IsEnabled)
            {
                // Construimos el formulario a mostrar
                ExchangeRateData exchangeCurrent = grdExchangeRate.SelectedItem as ExchangeRateData;

                // Verificamos que no sea currency MEX
                if (!exchangeCurrent.excu.Equals("MEX"))
                {
                    frmExchangeRateDetail frmExchangeEdit = new frmExchangeRateDetail(EnumMode.Edit)
                    {
                        Owner = this
                    };
                    // clonamos las propiedades del ExchangeRateData a editar
                    frmExchangeEdit.exchangeDate = ObjectHelper.CopyProperties(exchangeCurrent);

                    if (frmExchangeEdit.ShowDialog().Value)
                    {
                        // Si son diferentes
                        if (!ObjectHelper.IsEquals(frmExchangeEdit.exchangeDate, exchangeCurrent))
                        {
                            //Recargamos el datagrid!
                            calDate_SelectedDatesChanged(null, null);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Funcion que muestra el dialogo para agregar un nuevo currency a la lista de Exchange Rate
        /// </summary>
        /// <history>
        /// [vipacheco] 03/14/2016 Created
        /// </history>
        private void btnAdd_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // Se verifica si esta en modo edicion
            if (!btnEdit.IsEnabled)
            {
                UIHelper.ShowMessage("This form is currently in edit mode. Please save or undo your changes before closing it.", MessageBoxImage.Information);
                return;
            }

            List <Currency> lstDistict = frmHost._lstCurrencies.Where(x => !grdExchangeRate.ItemsSource.OfType <ExchangeRateData>().Select(s => s.excu).ToList().Contains(x.cuID) && x.cuID != "US").ToList();

            if (lstDistict.Any())
            {
                // Mandamos ejecutar el formulario para agregar nuevo Exchange Rate
                ExchangeRateData      exchangeCurrent = grdExchangeRate.SelectedItem as ExchangeRateData;
                frmExchangeRateDetail frmExchangeEdit = new frmExchangeRateDetail(EnumMode.Add)
                {
                    Owner = this
                };
                frmExchangeEdit.lstCurrencies = lstDistict;

                // Si se agregó un nuevo item
                if (frmExchangeEdit.ShowDialog().Value)
                {
                    //Actualizamos el Data Source.
                    calDate_SelectedDatesChanged(null, null);
                }
            }
            // Todos los currency estan agregados
            else
            {
                UIHelper.ShowMessage("All currencies already added", MessageBoxImage.Information);
            }
        }