/// <summary>
 /// Elimina registros nuevos con el boton suprimir
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 /// <history>
 /// [created] 06/05/2016
 /// </history>
 private void Row_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.Key == Key.Delete)
     {
         var item  = dgrAssigned.SelectedItem;
         var item1 = dgrCancelled.SelectedItem;
         #region Assigned
         if (item != null && item.GetType().Name == "FolioCxCPR")
         {
             FolioCxCPR folioCxCPR = (FolioCxCPR)item;
             if (folioCxCPR.fcpID == 0)
             {
                 dgrAssigned.CancelEdit();
                 List <FolioCxCPR> lstFolioCxCPR = (List <FolioCxCPR>)dgrAssigned.ItemsSource;
                 lstFolioCxCPR.Remove(folioCxCPR);
                 dgrAssigned.Items.Refresh();
             }
         }
         #endregion
         #region Cancelled
         else if (item1 != null && item1.GetType().Name == "FolioCxCCancellation")
         {
             FolioCxCCancellation folioCancell = (FolioCxCCancellation)item1;
             if (folioCancell.fccID == 0)
             {
                 dgrCancelled.CancelEdit();
                 List <FolioCxCCancellation> lstFolioCancell = (List <FolioCxCCancellation>)dgrCancelled.ItemsSource;
                 lstFolioCancell.Remove(folioCancell);
                 dgrCancelled.Items.Refresh();
             }
         }
         #endregion
     }
 }
        /// <summary>
        /// Verifica si se realizo algun cambio en la ventana
        /// </summary>
        /// <param name="lstAssigned">Folios Asignados</param>
        /// <param name="lstCancel">Folios Cancelados</param>
        /// <returns>True. Si hubo cambios | False. No hubo cambios</returns>
        /// <history>
        /// [emoguel] created 12/05/2016
        /// </history>
        private bool ValidateChanged(List <FolioCxCPR> lstAssigned, List <FolioCxCCancellation> lstCancel)
        {
            bool blnHasChanged = ((lstCancel != null && lstAssigned != null) && _lstCancellation.Count != lstCancel.Count || lstAssigned.Count != _lstFolios.Count);

            #region Assigend
            if (blnHasChanged == false)
            {
                _lstFolios.ForEach(fi =>
                {
                    FolioCxCPR folioVal = lstAssigned.Where(fi2 => fi2.fcpID == fi.fcpID).FirstOrDefault();
                    if (folioVal != null)
                    {
                        bool blnEquals = ObjectHelper.IsEquals(fi, folioVal);
                        if (!blnEquals)
                        {
                            blnHasChanged = true;
                            return;
                        }
                    }
                });
            }
            #endregion
            #region Canceled
            if (blnHasChanged == false)
            {
                _lstCancellation.ForEach(fi =>
                {
                    FolioCxCCancellation folioVal = lstCancel.Where(fi2 => fi2.fccID == fi.fccID).FirstOrDefault();
                    if (folioVal != null)
                    {
                        bool blnEquals = ObjectHelper.IsEquals(fi, folioVal);
                        if (!blnEquals)
                        {
                            blnHasChanged = true;
                            return;
                        }
                    }
                });
            }
            #endregion

            return(blnHasChanged);
        }
        /// <summary>
        /// Valida que el rango exista en la lista de asignados
        /// </summary>
        /// <param name="lstFolios">Lista de folios asignados</param>
        /// <param name="folioCancell">Folio a validar</param>
        /// <returns>True. si existe el rango | False. No existe el rango</returns>
        /// <history>
        /// [emoguel] created 06/05/2016
        /// </history>
        private bool ValidateFoliosRange(List <FolioCxCPR> lstFolios, FolioCxCCancellation folioCancell)
        {
            var folio = lstFolios.Where(fcp => fcp.fcpFrom >= folioCancell.fccFrom && fcp.fcpTo <= folioCancell.fccTo).FirstOrDefault();

            return(folio != null);
        }