Beispiel #1
0
        /// <summary>
        /// Muestra la ventana detalle en modo ReadOnly|edicion
        /// </summary>
        /// <history>
        /// [emoguel] 04/04/2016
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            MealTicketType          mealTicketType = (MealTicketType)dgrMealTkTypes.SelectedItem;
            frmMealTicketTypeDetail frmMealTkType  = new frmMealTicketTypeDetail();

            frmMealTkType.Owner             = this;
            frmMealTkType.oldMealTicketType = mealTicketType;
            frmMealTkType.enumMode          = EnumMode.Edit;
            if (frmMealTkType.ShowDialog() == true)
            {
                int nIndex = 0;
                List <MealTicketType> lstMealTkTypes = (List <MealTicketType>)dgrMealTkTypes.ItemsSource;
                if (!ValidateFilter(frmMealTkType.mealTicketType)) //verificamos si no cumple con los filtros
                {
                    lstMealTkTypes.Remove(mealTicketType);         //Quitamos el registro de la lista
                }
                else
                {
                    ObjectHelper.CopyProperties(mealTicketType, frmMealTkType.mealTicketType); //Copiamos las nuevas propiedades
                    lstMealTkTypes.Sort((x, y) => string.Compare(x.myN, y.myN));               //ordenamos la lista
                    nIndex = lstMealTkTypes.IndexOf(mealTicketType);                           //obtenemos la posicion del registro
                }
                dgrMealTkTypes.Items.Refresh();                                                //Actualizamos la vista
                GridHelper.SelectRow(dgrMealTkTypes, nIndex);                                  //Selecionamos el registro
                StatusBarReg.Content = lstMealTkTypes.Count + " Meal Ticket Types.";
            }
        }
Beispiel #2
0
        /// <summary>
        /// Abre la ventana de detalle en modo Add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 04/04/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmMealTicketTypeDetail frmMealTkTypeDetail = new frmMealTicketTypeDetail();

            frmMealTkTypeDetail.Owner    = this;
            frmMealTkTypeDetail.enumMode = EnumMode.Add;
            if (frmMealTkTypeDetail.ShowDialog() == true)
            {
                if (ValidateFilter(frmMealTkTypeDetail.mealTicketType))//validamos si cumple con los filtros
                {
                    MealTicketType        mealTicketType = frmMealTkTypeDetail.mealTicketType;
                    List <MealTicketType> lstMealTkTypes = (List <MealTicketType>)dgrMealTkTypes.ItemsSource;
                    lstMealTkTypes.Add(mealTicketType);                                  //Agregamos el objeto
                    lstMealTkTypes.Sort((x, y) => string.Compare(x.myN, y.myN));         //ordenamos la lista
                    int nIndex = lstMealTkTypes.IndexOf(mealTicketType);                 //buscamos la posicion del nuevo registro
                    dgrMealTkTypes.Items.Refresh();                                      //actualizamos la vista del grid
                    GridHelper.SelectRow(dgrMealTkTypes, nIndex);                        //Seleccionamo el nuevo registro
                    StatusBarReg.Content = lstMealTkTypes.Count + " Meal Ticket Types."; //Actualizamos el contador
                }
            }
        }