private async void OnLoad(object sender)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Espere un momento...");
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    CargarAlmacen_Grupo(_usuario.Almacen_Grupo, true);
                    LlenarEstatusDisponibles();
                    CargaCatalogo("S", true);
                })
                .ContinueWith((prevTask) => {
                    SelectedEstatus = Lista_Estatus.LISTA_ESTATUS.First(w => w.CLAVE == "S");
                    if (string.IsNullOrWhiteSpace(_usuario.Almacen_Grupo))
                    {
                        IsGrupoEnabled = true;
                    }
                });

                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
예제 #2
0
        public async Task CargarAlmacen_Tipos_CatAwaitable(string id_almacen_grupo, List <ALMACEN_TIPO_CAT> preseleccionados = null)
        {
            var _error = false;

            try
            {
                StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento");
                var temp = new ObservableCollection <EXT_Almacen_Tipo_Cat>(new cAlmacen_Tipo_Cat().Seleccionar_EXT(id_almacen_grupo, "S").ToList());
                if (preseleccionados != null && preseleccionados.Count > 0)
                {
                    foreach (var item in preseleccionados)
                    {
                        var encontro = temp.FirstOrDefault(f => f.ID_ALMACEN_TIPO == item.ID_ALMACEN_TIPO);
                        if (encontro != null)
                        {
                            encontro.IS_SELECTED = true;
                        }
                    }
                }
                Almacen_Tipos_Cat = temp;
                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los tipos catalogos. Favor de contactar al administrador");
            }
        }
        private async Task Cargar_Incidente_Tipos()
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento...");
            try
            {
                Incidencia_Tipos = new ObservableCollection <INCIDENCIA_TIPO>(new cIncidencia_Tipo().Seleccionar(SelectedAlmacen.ALMACEN_TIPO_CAT.ID_ALMACEN_GRUPO, "S").ToList());
                var dummy = new INCIDENCIA_TIPO
                {
                    ACTIVO             = "S",
                    ID_ALMACEN_GRUPO   = _usuario.Almacen_Grupo,
                    DESCR              = "SELECCIONA UNA",
                    ID_TIPO_INCIDENCIA = -1
                };
                Incidencia_Tipos.Add(dummy);
                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar el catalogo. Favor de contactar al administrador");
            }
        }
        private async void MunicipioCambio(int id_municipio)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento...");
            try
            {
                CargarCentros(id_municipio);
                CargarAlmacenes(selectedCentro.ID_CENTRO);
                if (SelectedAlmacen != null)
                {
                    SeleccionarFechasAgenda(SelectedAlmacen.ID_ALMACEN, SelectedMes, SelectedAnio);
                }
                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
        private async void OnLoad(object sender)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Espere un momento...");
            try
            {
                await Task.Factory.StartNew(() => CargarMunicipios());

                await Task.Factory.StartNew(() => CargarCentros(selectedMunicipio.ID_MUNICIPIO));

                await Task.Factory.StartNew(() => CargarAlmacenes(selectedCentro.ID_CENTRO));

                await Task.Factory.StartNew(() => {
                    if (SelectedAlmacen != null)
                    {
                        SeleccionarFechasAgenda(SelectedAlmacen.ID_ALMACEN, DateTime.Now.Month, DateTime.Now.Year);
                    }
                });

                setBuscarCalendarizacion();
                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
        private async void OnLoad(object sender)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Espere un momento...");
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    LlenarEstatusDisponibles();
                    CargaCatalogo("S", true);
                    CargarProducto_Categorias(true);
                    CargarProducto_CategoriasVistaDetalle(true);
                })
                .ContinueWith((prevTask) => {
                    SelectedEstatus                        = Lista_Estatus.LISTA_ESTATUS.First(w => w.CLAVE == "S");
                    SelectedProducto_Categoria             = Producto_Categorias.First(w => w.ID_CATEGORIA == -1);
                    SelectedProducto_CategoriaVistaDetalle = Pop_Up_Producto_Categorias.First(w => w.ID_CATEGORIA == -1);
                });

                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
        private async void BuscarOrdenes()
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento...");
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    Ordenes_Compra = new ObservableCollection <ORDEN_COMPRA>(new cOrden_Compra().SeleccionarPorAlmacenparaCalendarizar(SelectedAlmacen.ID_ALMACEN));
                    if (!string.IsNullOrWhiteSpace(BuscarOrdenParametro))
                    {
                        Ordenes_Compra = new ObservableCollection <ORDEN_COMPRA>(Ordenes_Compra.Where(w => w.NUM_ORDEN.Value.ToString().Contains(BuscarOrdenParametro)));
                    }
                });

                StaticSourcesViewModel.CloseProgressLoading();
                SelectedOrden_CompraPopUp = null;
                Ordenes_Compra_Detalle    = null;
                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA_ORDENES_COMPRA_TRANSITO_DETALLE);
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar la agenda. Favor de contactar al administrador");
            }
        }
        public async void OnLoad(object sender)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento...");
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    CargarAlmacen_TipoCatOrigen();
                    CargarMunicipiosOrigen();
                    CargarCentrosOrigen(SelectedMunicipioOrigen.ID_MUNICIPIO);
                    CargarAlmacenesPrincipalesOrigen(SelectedAlmacen_Tipo_CatOrigen.ID_ALMACEN_TIPO, SelectedCentroOrigen.ID_CENTRO);
                    CargarAlmacen_TipoCat();
                    CargarMunicipios();
                    CargarCentros(SelectedMunicipio.ID_MUNICIPIO);
                    CargarAlmacenesPrincipales(SelectedAlmacen_Tipo_Cat.ID_ALMACEN_TIPO, SelectedCentro.ID_CENTRO);
                });

                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
        private async void AbrirAgenda(Object parametro)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento...");
            try
            {
                FechaAgenda         = Convert.ToDateTime(parametro);
                FechaAgendaOriginal = Convert.ToDateTime(parametro);
                CondicionesInicialesAgenda();
                CargaAgenda(SelectedAlmacen.ID_ALMACEN, FechaAgenda.Value);
                StaticSourcesViewModel.CloseProgressLoading();
                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.AGENDA);

                setAgendarProductos();
            }
            catch (Exception ex)
            {
                _error = true;
            }

            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar la agenda. Favor de contactar al administrador");
            }
        }
예제 #10
0
        public async void ChangeViewModel(object param)
        {
            if (param != null)
            {
                if (StaticSourcesViewModel.SourceChanged)
                {
                    if (await(_dialogCoordinator.ShowMessageAsync(this, "Advertencia", "Hay cambios sin guardar, ¿Seguro que desea salir sin guardar?", MahApps.Metro.Controls.Dialogs.MessageDialogStyle.AffirmativeAndNegative)) == MahApps.Metro.Controls.Dialogs.MessageDialogResult.Affirmative)
                    {
                        StaticSourcesViewModel.SourceChanged = false;
                    }
                    else
                    {
                        return;
                    }
                }

                var params1 = (object[])param;
                var model   = Type.GetType((params1[0]).ToString());
                var view    = Type.GetType((params1[1]).ToString());
                if (model == null || view == null)
                {
                    return;
                }
                object vistamodelo = null;
                switch (model.Name)
                {
                case "CatAlmacenViewModel":
                case "CatProducto_CategoriaViewModel":
                case "CatProducto_SubCategoriaViewModel":
                case "CatProducto_TipoViewModel":
                case "CatProductoViewModel":
                case "CapturaOCViewModel":
                case "CalendarizacionViewModel":
                case "EntradasAlmacenesViewModel":
                case "RegistroTraspasosExternosViewModel":
                case "RequisicionExtraordinariaPrincipalViewModel":
                    //var controller = await _dialogCoordinator.ShowProgressAsync(this, "Por favor espere un momento", string.Empty);
                    StaticSourcesViewModel.ShowProgressLoading();
                    await Task.Factory.StartNew(() => {
                        vistamodelo = Activator.CreateInstance(model, new object[] { DialogCoordinator.Instance, Usuario });
                    });

                    StaticSourcesViewModel.CloseProgressLoading();
                    ContentControlBag = new ContentControlBag(Activator.CreateInstance(view), vistamodelo);
                    break;

                default:
                    StaticSourcesViewModel.ShowProgressLoading();
                    await Task.Factory.StartNew(() => {
                        vistamodelo = Activator.CreateInstance(model, new object[] { DialogCoordinator.Instance });
                    });

                    StaticSourcesViewModel.CloseProgressLoading();
                    ContentControlBag = new ContentControlBag(Activator.CreateInstance(view), vistamodelo);
                    break;
                }
            }
        }
예제 #11
0
        private async void CambiarSubCategoria(object parametro)
        {
            var _error = false;
            var isProductoPopUpVisible = false;

            if (PopUpsViewModels.VisibleProductoPopUp == Visibility.Visible)
            {
                isProductoPopUpVisible = true;
                PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.PRODUCTOPOPUP);
            }
            try
            {
                StaticSourcesViewModel.ShowProgressLoading("Por favor espere...");
                await Task.Factory.StartNew(() =>
                {
                    CargarSubCategoria(selectedProducto_Categoria.ID_CATEGORIA);
                })
                .ContinueWith((prevTask) => {
                    if (Producto_Subcategorias.Count > 0)
                    {
                        if (IsSubcategoriaVisible != true)
                        {
                            IsSubcategoriaVisible = true;
                        }

                        selectedProducto_SubcategoriaValue = -1;
                        RaisePropertyChanged("SelectedProducto_SubcategoriaValue");
                        //setValidationRules(true);
                    }
                    else
                    {
                        IsSubcategoriaVisible = false;
                        setValidationRules(false);
                    }
                });

                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar las subcategorias. Favor de contactar al administrador");
            }
            if (isProductoPopUpVisible)
            {
                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.PRODUCTOPOPUP);
            }
        }
예제 #12
0
        private async void OnLoad(object sender)
        {
            PopUpsViewModels.MainWindow = (Views.Principal.PrincipalView)(sender);
            object vistamodelo = null;
            var    model       = Type.GetType("GESAL.ViewModels.BandejaEntradaViewModel");
            var    view        = Type.GetType("GESAL.Views.BandejaEntradaView");

            StaticSourcesViewModel.ShowProgressLoading();
            await Task.Factory.StartNew(() =>
            {
                vistamodelo = Activator.CreateInstance(model, new object[] { Usuario });
            });

            StaticSourcesViewModel.CloseProgressLoading();
            ContentControlBag = new ContentControlBag(Activator.CreateInstance(view), vistamodelo);
        }
예제 #13
0
        private async void OnLoad(object sender)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Espere un momento..");
            try
            {
                await Task.Factory.StartNew(() =>
                {
                    LlenarEstatusDisponibles();
                    CargarBusquedaAlmacen_Tipos_Cat(true);
                    CargaCatalogo(BusquedaAlmacen_Tipos_Cat.First(w => w.ID_ALMACEN_TIPO == -1).ID_ALMACEN_TIPO, Lista_Estatus.LISTA_ESTATUS.First(w => w.CLAVE == "S").CLAVE, true);
                    CargarAlmacen_Grupos(true);
                    CargarProducto_Categorias(true);
                    CargarProducto_Presentaciones(true);
                    CargarProducto_Unidad_Medida(true);
                }).ContinueWith((prevTask) => {
                    SelectedEstatus = Lista_Estatus.LISTA_ESTATUS.First(w => w.CLAVE == "S");
                    SelectedBusquedaAlmacen_Tipo_Cat = BusquedaAlmacen_Tipos_Cat.First(w => w.ID_ALMACEN_TIPO == -1);
                    if (string.IsNullOrWhiteSpace(_usuario.Almacen_Grupo))
                    {
                        SelectedAlmacen_Grupo = Almacen_Grupos.First(w => w.ID_ALMACEN_GRUPO == "");
                    }
                    else
                    {
                        selectedAlmacen_Grupo = Almacen_Grupos.FirstOrDefault();
                        RaisePropertyChanged("SelectedAlmacen_Grupo");
                    }
                    SelectedProducto_Categoria     = Producto_Categorias.First(w => w.ID_CATEGORIA == -1);
                    SelectedProducto_Presentacion  = Producto_Presentaciones.First(w => w.ID_PRESENTACION == -1);
                    SelectedProducto_Unidad_Medida = Producto_Unidades_Medida.First(w => w.ID_UNIDAD_MEDIDA == -1);
                });

                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
        private async void Almacen_TipoCambio(short id_almacen_tipo_cat)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento...");
            try
            {
                CargarAlmacenesPrincipales(id_almacen_tipo_cat, SelectedCentro.ID_CENTRO);
                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
        private async void AlmacenPrincipalCambioOrigen(int id_almacen)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento...");
            try
            {
                CargarInventario(id_almacen);
                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
예제 #16
0
        public async void CargarAlmacen_Tipos_Cat(string id_almacen_grupo)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento");
            try
            {
                Almacen_Tipos_Cat = new ObservableCollection <EXT_Almacen_Tipo_Cat>(new cAlmacen_Tipo_Cat().Seleccionar_EXT(id_almacen_grupo, "S").ToList());
                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los tipos catalogos. Favor de contactar al administrador");
            }
        }
        private async void MunicipioCambioOrigen(int id_municipio)
        {
            var _error = false;

            StaticSourcesViewModel.ShowProgressLoading("Por favor espere un momento...");
            try
            {
                CargarCentrosOrigen(id_municipio);
                CargarAlmacenesPrincipalesOrigen(SelectedAlmacen_Tipo_CatOrigen.ID_ALMACEN_TIPO, selectedCentroOrigen.ID_CENTRO);
                StaticSourcesViewModel.CloseProgressLoading();
            }
            catch (Exception ex)
            {
                _error = true;
            }
            if (_error)
            {
                StaticSourcesViewModel.CloseProgressLoading();
                await _dialogCoordinator.ShowMessageAsync(this, "Error", "Hubo un error al cargar los catalogos. Favor de contactar al administrador");
            }
        }
예제 #18
0
        private async Task CargarInformacionAwaitable()
        {
            //Vacia datos a propiedades
            limpiarCampos();


            ID          = SelectedProducto.ID_PRODUCTO;
            Nombre      = SelectedProducto.NOMBRE;
            Descripcion = SelectedProducto.DESCRIPCION;
            if (SelectedProducto.PRODUCTO_IMAGEN != null)
            {
                ImagenData = SelectedProducto.PRODUCTO_IMAGEN.IMAGEN;
            }
            Activo = (SelectedProducto.ACTIVO == "S") ? true : false;

            if (SelectedProducto.ID_CATEGORIA.HasValue)
            {
                SelectedProducto_Categoria = Producto_Categorias.FirstOrDefault(f => f.ID_CATEGORIA == SelectedProducto.ID_CATEGORIA.Value);
            }
            if (SelectedProducto.ID_SUBCATEGORIA.HasValue || SelectedProducto_Categoria.PRODUCTO_SUBCATEGORIA.Count > 0)
            {
                IsSubcategoriaVisible = true;
                StaticSourcesViewModel.ShowProgressLoading("Espere un momento...");
                await Task.Factory.StartNew(() =>
                {
                    CargarSubCategoria(selectedProducto_Categoria.ID_CATEGORIA);
                })
                .ContinueWith((prevTask) => {
                    if (SelectedProducto.ID_SUBCATEGORIA.HasValue)
                    {
                        SelectedProducto_SubcategoriaValue = Producto_Subcategorias.FirstOrDefault(f => f.ID_SUBCATEGORIA == SelectedProducto.ID_SUBCATEGORIA.Value).ID_SUBCATEGORIA;
                    }
                    else
                    {
                        SelectedProducto_SubcategoriaValue = -1;
                    }
                    IsSubcategoriaVisible = true;
                    setValidationRules(true);
                });

                StaticSourcesViewModel.CloseProgressLoading();
            }
            else
            {
                IsSubcategoriaVisible = false;
                setValidationRules(false);
            }
            if (SelectedProducto.ID_PRESENTACION.HasValue)
            {
                SelectedProducto_Presentacion = Producto_Presentaciones.FirstOrDefault(f => f.ID_PRESENTACION == SelectedProducto.ID_PRESENTACION.Value);
            }
            if (SelectedProducto.ID_UNIDAD_MEDIDA.HasValue)
            {
                SelectedProducto_Unidad_Medida = Producto_Unidades_Medida.FirstOrDefault(f => f.ID_UNIDAD_MEDIDA == SelectedProducto.ID_UNIDAD_MEDIDA.Value);
            }
            //hay que cambiar el tipo de llenado porque es asincrono
            selectedAlmacen_Grupo = Almacen_Grupos.FirstOrDefault(w => w.ID_ALMACEN_GRUPO == SelectedProducto.ALMACEN_TIPO_CAT.First().ID_ALMACEN_GRUPO);
            RaisePropertyChanged("SelectedAlmacen_Grupo");
            IsGrupoDefinido = true;
            await CargarAlmacen_Tipos_CatAwaitable(selectedAlmacen_Grupo.ID_ALMACEN_GRUPO, SelectedProducto.ALMACEN_TIPO_CAT.ToList());

            setValidationRules(false);
        }