Esempio n. 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)
        {
            ReasonCancellationFolio          reasonCancellationFolio = (ReasonCancellationFolio)dgrReaCanFols.SelectedItem;
            frmReasonCancellationFolioDetail frmReaCanFolDetail      = new frmReasonCancellationFolioDetail();

            frmReaCanFolDetail.Owner           = this;
            frmReaCanFolDetail.enumMode        = (_blnEdit) ? EnumMode.Edit : EnumMode.ReadOnly;
            frmReaCanFolDetail.oldReasonCanFol = reasonCancellationFolio;
            if (frmReaCanFolDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <ReasonCancellationFolio> lstReaCanFols = (List <ReasonCancellationFolio>)dgrReaCanFols.ItemsSource;
                if (ValidateFilter(frmReaCanFolDetail.reasonCancellationFolio))                                       //Verificamos si cumple con los filtros actuales
                {
                    ObjectHelper.CopyProperties(reasonCancellationFolio, frmReaCanFolDetail.reasonCancellationFolio); //Actualizamos los datos del registro
                    lstReaCanFols.Sort((x, y) => string.Compare(x.rcfN, y.rcfN));                                     //ordenamos la lista
                    nIndex = lstReaCanFols.IndexOf(reasonCancellationFolio);                                          //obtenemos la posicion del registro
                }
                else
                {
                    lstReaCanFols.Remove(reasonCancellationFolio);
                }
                dgrReaCanFols.Items.Refresh();                                                      //Actualizamos los items del grid
                GridHelper.SelectRow(dgrReaCanFols, nIndex);                                        //Seleccionamos el registro
                StatusBarReg.Content = lstReaCanFols.Count + " Reason For Cancellation Of Folios."; //Actualizamos el contador
            }
        }
Esempio n. 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)
        {
            frmReasonCancellationFolioDetail frmResCanFolDetail = new frmReasonCancellationFolioDetail();

            frmResCanFolDetail.Owner    = this;
            frmResCanFolDetail.enumMode = EnumMode.Add;
            if (frmResCanFolDetail.ShowDialog() == true)
            {
                ReasonCancellationFolio reasonCacellationFolio = frmResCanFolDetail.reasonCancellationFolio;
                if (ValidateFilter(reasonCacellationFolio))//Verificamos si cumple con los filtros
                {
                    List <ReasonCancellationFolio> lstReaCanFols = (List <ReasonCancellationFolio>)dgrReaCanFols.ItemsSource;
                    lstReaCanFols.Add(reasonCacellationFolio);                                          //Agregamos el registro a la lista
                    lstReaCanFols.Sort((x, y) => string.Compare(x.rcfN, y.rcfN));                       //Ordenamos la lista
                    int nIndex = lstReaCanFols.IndexOf(reasonCacellationFolio);
                    dgrReaCanFols.Items.Refresh();                                                      //Actualizamos la vista
                    GridHelper.SelectRow(dgrReaCanFols, nIndex);                                        //Seleccionamos el registro
                    StatusBarReg.Content = lstReaCanFols.Count + " Reason For Cancellation Of Folios."; //Actualizamos el contador
                }
            }
        }