コード例 #1
0
ファイル: frmPlaceTypes.xaml.cs プロジェクト: jackjet870/IM-2
        /// <summary>
        /// Muestra la ventana detalle
        /// </summary>
        /// <history>
        /// [emoguel] 11/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            PlaceType          placeType          = (PlaceType)dgrPlaceTypes.SelectedItem;
            frmPlaceTypeDetail frmPlaceTypeDetail = new frmPlaceTypeDetail();

            frmPlaceTypeDetail.Owner        = this;
            frmPlaceTypeDetail.enumMode     = EnumMode.Edit;
            frmPlaceTypeDetail.oldPlaceType = placeType;
            if (frmPlaceTypeDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <PlaceType> lstPlaceTypes = (List <PlaceType>)dgrPlaceTypes.ItemsSource;
                if (ValidateFilter(frmPlaceTypeDetail.placeType))                         //Verificar si cumple con los filtros
                {
                    ObjectHelper.CopyProperties(placeType, frmPlaceTypeDetail.placeType); //Actualizamos los datos del registro
                    lstPlaceTypes.Sort((x, y) => string.Compare(x.pyN, y.pyN));           //ornedamos los registros
                    nIndex = lstPlaceTypes.IndexOf(placeType);                            //Buscamos la posicion del registro
                }
                else
                {
                    lstPlaceTypes.Remove(frmPlaceTypeDetail.placeType);
                }
                dgrPlaceTypes.Items.Refresh();               //Actualizamos la vista
                GridHelper.SelectRow(dgrPlaceTypes, nIndex); //Seleccionamos el registros
                StatusBarReg.Content = lstPlaceTypes.Count + " Place Types.";
            }
        }
コード例 #2
0
ファイル: frmPlaceTypes.xaml.cs プロジェクト: jackjet870/IM-2
        /// <summary>
        /// Abre la ventana detalle en modo Add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 11/04/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmPlaceTypeDetail frmPlaceTypeDetail = new frmPlaceTypeDetail();

            frmPlaceTypeDetail.Owner    = this;
            frmPlaceTypeDetail.enumMode = EnumMode.Add;
            if (frmPlaceTypeDetail.ShowDialog() == true)
            {
                PlaceType placeType = frmPlaceTypeDetail.placeType;
                if (ValidateFilter(placeType))//verificamos si cumple con los filtros actuales
                {
                    List <PlaceType> lstPlacesTypes = (List <PlaceType>)dgrPlaceTypes.ItemsSource;
                    lstPlacesTypes.Add(placeType);                                 //Agregamos el registro a la lista
                    lstPlacesTypes.Sort((x, y) => string.Compare(x.pyN, y.pyN));   //ordenamos la lista
                    int nIndex = lstPlacesTypes.IndexOf(placeType);                //obtenemos la posición del registro
                    dgrPlaceTypes.Items.Refresh();                                 //Actualizamos la vista
                    GridHelper.SelectRow(dgrPlaceTypes, nIndex);                   //Seleccionamos el registro
                    StatusBarReg.Content = lstPlacesTypes.Count + " Place Types."; //Actualizamos el contador
                }
            }
        }