Example #1
0
        /// <summary>
        /// Abre la ventana detalle en modo Add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 07/06/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmPermissionDetail frmPermissionDetail = new frmPermissionDetail();

            frmPermissionDetail.Owner    = this;
            frmPermissionDetail.enumMode = EnumMode.Add;
            if (frmPermissionDetail.ShowDialog() == true)
            {
                Permission permission = frmPermissionDetail.permission;
                if (validateFilter(permission))//Verificamos si cumple con los filtros actuales
                {
                    List <Permission> lstPermissions = (List <Permission>)dgrPermissions.ItemsSource;
                    lstPermissions.Add(permission);                              //Agregamos el registro a la lista
                    lstPermissions.Sort((x, y) => string.Compare(x.pmN, y.pmN)); //ordenamos la lista
                    int nIndex = lstPermissions.IndexOf(permission);             //obtenemos la posiciĆ³n del permiso
                    dgrPermissions.Items.Refresh();                              //Actualizamos la vista
                    GridHelper.SelectRow(dgrPermissions, nIndex);                //Seleccionamos un registro
                    StatusBarReg.Content = lstPermissions.Count + " Permissions.";
                }
            }
        }
Example #2
0
        /// <summary>
        /// Muestra la ventada detalle
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 07/04/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            Permission          permission          = (Permission)dgrPermissions.SelectedItem;
            frmPermissionDetail frmPermissionDetail = new frmPermissionDetail();

            frmPermissionDetail.Owner         = this;
            frmPermissionDetail.oldPermission = permission;
            frmPermissionDetail.enumMode      = EnumMode.Edit;
            if (frmPermissionDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <Permission> lstPermissions = (List <Permission>)dgrPermissions.ItemsSource;
                if (validateFilter(frmPermissionDetail.permission))                          //verificamos si cumple con los filtros actuales
                {
                    ObjectHelper.CopyProperties(permission, frmPermissionDetail.permission); //Actualizamos los datos del permiso
                    lstPermissions.Sort((x, y) => string.Compare(x.pmN, y.pmN));             //ordenamos la lista
                    nIndex = lstPermissions.IndexOf(permission);                             //obtenemos la posiciĆ³n del permiso
                }
                dgrPermissions.Items.Refresh();                                              //Actualizamos la vista del grid
                GridHelper.SelectRow(dgrPermissions, nIndex);                                //Seleccionamos un registro
                StatusBarReg.Content = lstPermissions.Count + " Permissions.";
            }
        }