コード例 #1
0
        /// <summary>
        /// Valida que un TourTimeSchema cumpla con los filtros actuales
        /// </summary>
        /// <param name="tourTimeSchema">Objeto a validar</param>
        /// <returns>True. Si cumple | False. no cumple</returns>
        /// <history>
        /// [emoguel] created 28/04/2016
        /// </history>
        private bool ValidateFilter(TourTimesSchema tourTimeSchema)
        {
            if (_nStatus != -1)//Filtro por estatus
            {
                if (tourTimeSchema.tcA != Convert.ToBoolean(_nStatus))
                {
                    return(false);
                }
            }

            if (_tourTimeSchemaFilter.tcID > 0)//Filtro por ID
            {
                if (tourTimeSchema.tcID != _tourTimeSchemaFilter.tcID)
                {
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(_tourTimeSchemaFilter.tcN))//Filtro por descripción
            {
                if (!tourTimeSchema.tcN.Contains(_tourTimeSchemaFilter.tcN, StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Muestra la ventana detalle en modo edit
        /// </summary>
        /// <history>
        /// [emoguel] 28/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            TourTimesSchema         tourTimeSchema          = (TourTimesSchema)dgrTourTimesSchemas.SelectedItem;
            frmTourTimeSchemaDetail frmTourTimeSchemaDetail = new frmTourTimeSchemaDetail();

            frmTourTimeSchemaDetail.Owner             = this;
            frmTourTimeSchemaDetail.oldTourTimeSchema = tourTimeSchema;
            frmTourTimeSchemaDetail.enumMode          = (_blnEdit) ? EnumMode.Edit : EnumMode.Add;
            if (frmTourTimeSchemaDetail.ShowDialog() == true)
            {
                List <TourTimesSchema> lstTourTimesSchemas = (List <TourTimesSchema>)dgrTourTimesSchemas.ItemsSource;
                int nIndex = 0;
                if (ValidateFilter(frmTourTimeSchemaDetail.tourTimeSchema))                              //Verificamos que cumpla con los filtros actuales
                {
                    ObjectHelper.CopyProperties(tourTimeSchema, frmTourTimeSchemaDetail.tourTimeSchema); //Actualizamos los datos del objeto
                    lstTourTimesSchemas.Sort((x, Y) => string.Compare(x.tcN, Y.tcN));                    //Reordenamos la lista
                    nIndex = lstTourTimesSchemas.IndexOf(tourTimeSchema);                                //Obtenemos la posición del registro
                }
                else
                {
                    lstTourTimesSchemas.Remove(tourTimeSchema);                 //Quitamos el registro
                }
                dgrTourTimesSchemas.Items.Refresh();                            //Actualizamos la vista
                GridHelper.SelectRow(dgrTourTimesSchemas, nIndex);              //Seleccionamos el registro
                StatusBarReg.Content = lstTourTimesSchemas.Count + " Schemas."; //Actualizamos el contador
            }
        }
コード例 #3
0
        /// <summary>
        /// Llena el grid de Schemas
        /// </summary>
        /// <param name="tourTimeSchema">Objeto a seleccionar</param>
        /// <history>
        /// [emoguel] created 28/04/2016
        /// </history>
        private async void LoadSchemas(TourTimesSchema tourTimeSchema = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                List <TourTimesSchema> lstTourTimesSchemas = await BRTourTimesSchemas.GetTourTimesSchemas(_nStatus, _tourTimeSchemaFilter);

                dgrTourTimesSchemas.ItemsSource = lstTourTimesSchemas;
                int nIndex = 0;
                if (lstTourTimesSchemas.Count > 0 && tourTimeSchema != null)
                {
                    tourTimeSchema = lstTourTimesSchemas.Where(tc => tc.tcID == tourTimeSchema.tcID).FirstOrDefault();
                    nIndex         = lstTourTimesSchemas.IndexOf(tourTimeSchema);
                }
                GridHelper.SelectRow(dgrTourTimesSchemas, nIndex);
                StatusBarReg.Content = lstTourTimesSchemas.Count + " Schemas.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
コード例 #4
0
ファイル: BRTourTimesSchemas.cs プロジェクト: jackjet870/IM-2
        /// <summary>
        /// Obtiene registros del catalogo TourTimesSchemas
        /// </summary>
        /// <param name="nStatus">-1. Todos | 0. Inactivos | 1. Activos</param>
        /// <param name="tourTimeSchema">Objeto con filtros adicionales</param>
        /// <returns>Lista de tipo TourTimesSchema</returns>
        /// <history>
        /// [emoguel] created 28/04/2016
        /// [emoguel] modified 28/06/2016---> Se volvió async
        /// </history>
        public async static Task <List <TourTimesSchema> > GetTourTimesSchemas(int nStatus = -1, TourTimesSchema tourTimeSchema = null)
        {
            return(await Task.Run(() =>
            {
                using (var dbContext = new IMEntities(ConnectionHelper.ConnectionString()))
                {
                    var query = from tc in dbContext.TourTimesSchemas
                                select tc;

                    if (nStatus != -1)//Filtro por estatus
                    {
                        bool blnStatus = Convert.ToBoolean(nStatus);
                        query = query.Where(tc => tc.tcA == blnStatus);
                    }

                    if (tourTimeSchema != null)
                    {
                        if (tourTimeSchema.tcID > 0)//filtro por ID
                        {
                            query = query.Where(tc => tc.tcID == tourTimeSchema.tcID);
                        }

                        if (!string.IsNullOrWhiteSpace(tourTimeSchema.tcN))//Filtro por Descripción
                        {
                            query = query.Where(tc => tc.tcN.Contains(tourTimeSchema.tcN));
                        }
                    }
                    return query.OrderBy(tc => tc.tcN).ToList();
                }
            }));
        }
コード例 #5
0
        /// <summary>
        /// Actualiza los datos del grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 28/04/2016
        /// </history>
        private void btnRef_Click(object sender, RoutedEventArgs e)
        {
            TourTimesSchema tourTimesSchema = (TourTimesSchema)dgrTourTimesSchemas.SelectedItem;

            LoadSchemas(tourTimesSchema);
        }