Пример #1
0
        /// <summary>
        /// Abre la ventana detalle en modo "detalle" o "edición" dependiendo de sus permisos
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 19/05/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            MembershipGroup          membershipGroup    = (MembershipGroup)dgrMembershipGroup.SelectedItem;
            frmMembershipGroupDetail frmMembershipGroup = new frmMembershipGroupDetail();

            frmMembershipGroup.Owner = this;
            frmMembershipGroup.oldMembershipGroup = membershipGroup;
            frmMembershipGroup.enumMode           = EnumMode.Edit;
            if (frmMembershipGroup.ShowDialog() == true)
            {
                List <MembershipGroup> lstMembershipGroups = (List <MembershipGroup>)dgrMembershipGroup.ItemsSource;
                int nIndex = 0;
                if (ValidateFilter(frmMembershipGroup.membershipGroup))                               //Verificamos que cumpla con los filtros
                {
                    ObjectHelper.CopyProperties(membershipGroup, frmMembershipGroup.membershipGroup); //Actualizamos los datos del registro
                    lstMembershipGroups.Sort((x, y) => string.Compare(x.mgN, y.mgN));                 //Ordenamos la lista
                    nIndex = lstMembershipGroups.IndexOf(membershipGroup);                            //Obtenemos la posición del registro
                }
                else
                {
                    lstMembershipGroups.Remove(membershipGroup);                         //Quitamos el registro
                }
                dgrMembershipGroup.Items.Refresh();                                      //Actualizamos la vista
                GridHelper.SelectRow(dgrMembershipGroup, nIndex);                        //Seleccionamos el registro
                StatusBarReg.Content = lstMembershipGroups.Count + " Membership Groups"; //Actualizamos el contador
            }
        }