Exemple #1
0
        /// <summary>
        /// Muestra la ventana detalle en modo edit
        /// </summary>
        /// <history>
        /// [emoguel] 14/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            RefundType          refunType           = (RefundType)dgrRefundTypes.SelectedItem;
            frmRefundTypeDetail frmRefundTypeDetail = new frmRefundTypeDetail();

            frmRefundTypeDetail.Owner         = this;
            frmRefundTypeDetail.enumMode      = EnumMode.Edit;
            frmRefundTypeDetail.oldRefundType = refunType;
            if (frmRefundTypeDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <RefundType> lstRefundTypes = (List <RefundType>)dgrRefundTypes.ItemsSource;
                if (ValidateFilter(frmRefundTypeDetail.refundType))                         //Validamos que cumpla con los filtros actuales
                {
                    ObjectHelper.CopyProperties(refunType, frmRefundTypeDetail.refundType); //Actualizamos los datos
                    lstRefundTypes.Sort((x, y) => string.Compare(x.rfN, y.rfN));            //ordenamos la lista
                    nIndex = lstRefundTypes.IndexOf(refunType);                             //Obtenemos la posición del registro
                }
                else
                {
                    lstRefundTypes.Remove(refunType);                           //Quitamos el registro de la lista
                }
                dgrRefundTypes.Items.Refresh();                                 //Actualizamos la lista
                GridHelper.SelectRow(dgrRefundTypes, nIndex);                   //Seleccionamos el registro
                StatusBarReg.Content = lstRefundTypes.Count + " Refund Types."; //Actualizamos el contador
            }
        }
Exemple #2
0
        /// <summary>
        /// Abre la ventana detalle en modo add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 14/04/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmRefundTypeDetail frmRefundTypeDetail = new frmRefundTypeDetail();

            frmRefundTypeDetail.Owner    = this;
            frmRefundTypeDetail.enumMode = EnumMode.Add;
            if (frmRefundTypeDetail.ShowDialog() == true)
            {
                RefundType refundType = frmRefundTypeDetail.refundType;
                if (ValidateFilter(refundType))//Validamos si cumple con los filtros actualess
                {
                    List <RefundType> lstRefundTypes = (List <RefundType>)dgrRefundTypes.ItemsSource;
                    lstRefundTypes.Add(refundType);                                //Agregamos el registro a la lista
                    lstRefundTypes.Sort((x, y) => string.Compare(x.rfN, y.rfN));   //ordenamos la lista
                    int nIndex = lstRefundTypes.IndexOf(refundType);               //Obtenemos la posicion del registro
                    dgrRefundTypes.Items.Refresh();                                //Actualizamos la vista del grid
                    GridHelper.SelectRow(dgrRefundTypes, nIndex);                  //Seleccionamos el registro
                    StatusBarReg.Content = lstRefundTypes.Count + " Refun Types."; //Actualizamos el contador
                }
            }
        }