Ejemplo n.º 1
0
        /// <summary>
        /// Muestra la ventana detalle en modo edit
        /// </summary>
        /// <history>
        /// [emoguel] 28/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            UnderPaymentMotive          underPaymentMotive = (UnderPaymentMotive)dgrUnderPayMentMotive.SelectedItem;
            frmUnderPaymentMotiveDetail frmUndPayMotDetail = new frmUnderPaymentMotiveDetail();

            frmUndPayMotDetail.Owner    = this;
            frmUndPayMotDetail.enumMode = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly;
            frmUndPayMotDetail.oldUnderPaymentMOtive = underPaymentMotive;
            if (frmUndPayMotDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <UnderPaymentMotive> lstUnderPaymentMotive = (List <UnderPaymentMotive>)dgrUnderPayMentMotive.ItemsSource;
                if (ValidateFilter(frmUndPayMotDetail.underPaymentMotive))                                  //Verificamos que cumpla con los filtros
                {
                    ObjectHelper.CopyProperties(underPaymentMotive, frmUndPayMotDetail.underPaymentMotive); //Actualizamos los datos
                    lstUnderPaymentMotive.Sort((x, y) => string.Compare(x.upN, y.upN));                     //Reordenamos la lista
                    nIndex = lstUnderPaymentMotive.IndexOf(underPaymentMotive);                             //Buscamos la posición del registro
                }
                else
                {
                    lstUnderPaymentMotive.Remove(underPaymentMotive);                           //Quitamos el registro de la lista
                }
                dgrUnderPayMentMotive.Items.Refresh();                                          //Actualizamos la vista
                GridHelper.SelectRow(dgrUnderPayMentMotive, nIndex);                            //Seleccionamos el registro
                StatusBarReg.Content = lstUnderPaymentMotive.Count + " Under Payment Motives."; //Actualizamos el contador
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Abre la ventana detalle en modo add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 28/04/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmUnderPaymentMotiveDetail frmUndPayMotDetail = new frmUnderPaymentMotiveDetail();

            frmUndPayMotDetail.Owner    = this;
            frmUndPayMotDetail.enumMode = EnumMode.Add;
            if (frmUndPayMotDetail.ShowDialog() == true)
            {
                UnderPaymentMotive underPaymentMotive = frmUndPayMotDetail.underPaymentMotive;
                if (ValidateFilter(underPaymentMotive))//verificamos que cumpla con los filtros actuales
                {
                    List <UnderPaymentMotive> lstUnderPaymentMotives = (List <UnderPaymentMotive>)dgrUnderPayMentMotive.ItemsSource;
                    lstUnderPaymentMotives.Add(underPaymentMotive);                                  //Agregamos el registro
                    lstUnderPaymentMotives.Sort((x, y) => string.Compare(x.upN, y.upN));             //Reordenamos la lista
                    int nIndex = lstUnderPaymentMotives.IndexOf(underPaymentMotive);                 //Obtenemos la posición del registro
                    dgrUnderPayMentMotive.Items.Refresh();                                           //Actualizamos la vista
                    GridHelper.SelectRow(dgrUnderPayMentMotive, nIndex);                             //Seleccionamos el registro
                    StatusBarReg.Content = lstUnderPaymentMotives.Count + " Under Payment Motives."; //Actualizamos el contador
                }
            }
        }