예제 #1
0
        /// <summary>
        /// Muestra la ventada detalle
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 06/04/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            PaymentType          paymentType          = (PaymentType)dgrPaymentTypes.SelectedItem;
            frmPaymentTypeDetail frmPaymentTypeDetail = new frmPaymentTypeDetail();

            frmPaymentTypeDetail.Owner          = this;
            frmPaymentTypeDetail.enumMode       = EnumMode.Edit;
            frmPaymentTypeDetail.oldPaymentType = paymentType;
            if (frmPaymentTypeDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <PaymentType> lstPaymentType = (List <PaymentType>)dgrPaymentTypes.ItemsSource;
                if (ValidateFilter(frmPaymentTypeDetail.paymentType))                           //Verificamos si cumple con los filtros
                {
                    ObjectHelper.CopyProperties(paymentType, frmPaymentTypeDetail.paymentType); //Actualizamos los datos del registro
                    lstPaymentType.Sort((x, y) => string.Compare(x.ptN, y.ptN));                //ordenamos la lista
                    nIndex = lstPaymentType.IndexOf(paymentType);                               //Obtenemos la posición del registro
                }
                else
                {
                    lstPaymentType.Remove(paymentType);
                }
                dgrPaymentTypes.Items.Refresh();               //Actualizamos la vista
                GridHelper.SelectRow(dgrPaymentTypes, nIndex); //Seleccionamos el registro
                StatusBarReg.Content = lstPaymentType.Count + " Payment Types.";
            }
        }
예제 #2
0
        /// <summary>
        /// Abre la ventana en modo Add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 06/04/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmPaymentTypeDetail frmPaymentTypeDetail = new frmPaymentTypeDetail();

            frmPaymentTypeDetail.Owner    = this;
            frmPaymentTypeDetail.enumMode = EnumMode.Add;
            if (frmPaymentTypeDetail.ShowDialog() == true)
            {
                PaymentType paymentType = frmPaymentTypeDetail.paymentType;
                if (ValidateFilter(paymentType))//Validamos si cumple con los filtros actuales
                {
                    List <PaymentType> lstPaymentTypes = (List <PaymentType>)dgrPaymentTypes.ItemsSource;
                    lstPaymentTypes.Add(paymentType);                                 //Agregamos a la lista
                    lstPaymentTypes.Sort((x, y) => string.Compare(x.ptN, y.ptN));     //ordenamos la lista
                    int nIndex = lstPaymentTypes.IndexOf(paymentType);                //obtenemos la posicion del registro
                    dgrPaymentTypes.Items.Refresh();                                  //Actualizamos la vista
                    GridHelper.SelectRow(dgrPaymentTypes, nIndex);                    //Seleccionamos el registro
                    StatusBarReg.Content = lstPaymentTypes.Count + " Payment Types."; //Actualizamos el contador
                }
            }
        }