Пример #1
0
        /// <summary>
        /// Muestra la ventada detalle
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 05/04/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            PaymentPlace          paymentPlace          = (PaymentPlace)dgrPaymentPlace.SelectedItem;
            frmPaymentPlaceDetail frmPaymentPlaceDetail = new frmPaymentPlaceDetail();

            frmPaymentPlaceDetail.Owner           = this;
            frmPaymentPlaceDetail.enumMode        = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly;
            frmPaymentPlaceDetail.oldPaymentPlace = paymentPlace;
            if (frmPaymentPlaceDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <PaymentPlace> lstPaymentPlaces = (List <PaymentPlace>)dgrPaymentPlace.ItemsSource;
                if (!ValidateFIlter(frmPaymentPlaceDetail.paymentPlace)) //Validamos que cumpla con los filtros
                {
                    lstPaymentPlaces.Remove(paymentPlace);               //removemos de la lista
                }
                else
                {
                    ObjectHelper.CopyProperties(paymentPlace, frmPaymentPlaceDetail.paymentPlace); //Actualizamos los datos del registro
                    lstPaymentPlaces.Sort((x, y) => string.Compare(x.pcN, y.pcN));                 //Ordenamos la lista
                    nIndex = lstPaymentPlaces.IndexOf(paymentPlace);                               //Obtenemos la posicion del registro
                }
                dgrPaymentPlace.Items.Refresh();
                GridHelper.SelectRow(dgrPaymentPlace, nIndex);
                StatusBarReg.Content = lstPaymentPlaces.Count + " Payment Places.";
            }
        }
Пример #2
0
        /// <summary>
        /// Abre la ventana detalle en modo Add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 06/05/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmPaymentPlaceDetail frmPaymentPlaceDetail = new frmPaymentPlaceDetail();

            frmPaymentPlaceDetail.Owner    = this;
            frmPaymentPlaceDetail.enumMode = EnumMode.Add;
            if (frmPaymentPlaceDetail.ShowDialog() == true)
            {
                PaymentPlace paymentPlace = frmPaymentPlaceDetail.paymentPlace;
                if (ValidateFIlter(paymentPlace))//Validamos si cumple con el filtro
                {
                    List <PaymentPlace> lstPaymentPlaces = (List <PaymentPlace>)dgrPaymentPlace.ItemsSource;
                    lstPaymentPlaces.Add(paymentPlace);                            //Agregamos el registro
                    lstPaymentPlaces.Sort((x, y) => string.Compare(x.pcN, y.pcN)); //Ordenamos la lista
                    int nIndex = lstPaymentPlaces.IndexOf(paymentPlace);           //Obtenemos el index
                    dgrPaymentPlace.Items.Refresh();                               //Actualizamos la vista
                    GridHelper.SelectRow(dgrPaymentPlace, nIndex);                 //Seleccionamos el registro
                    StatusBarReg.Content = lstPaymentPlaces.Count + " Payment Places.";
                }
            }
        }