/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtTipoObjetivoCalidadID.Text)) { resultado = false; mensaje = Properties.Resources.TipoObjetivoCalidadEdicion_MsgTipoObjetivoCalidadIDRequerida; txtTipoObjetivoCalidadID.Focus(); } else if (string.IsNullOrWhiteSpace(txtDescripcion.Text) || Contexto.Descripcion == string.Empty) { resultado = false; mensaje = Properties.Resources.TipoObjetivoCalidadEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else if (cmbActivo.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.TipoObjetivoCalidadEdicion_MsgActivoRequerida; cmbActivo.Focus(); } else { int tipoObjetivoCalidadId = Extensor.ValorEntero(txtTipoObjetivoCalidadID.Text); string descripcion = txtDescripcion.Text; var tipoObjetivoCalidadBL = new TipoObjetivoCalidadBL(); TipoObjetivoCalidadInfo tipoObjetivoCalidad = tipoObjetivoCalidadBL.ObtenerPorDescripcion(descripcion); if (tipoObjetivoCalidad != null && (tipoObjetivoCalidadId == 0 || tipoObjetivoCalidadId != tipoObjetivoCalidad.TipoObjetivoCalidadID)) { resultado = false; mensaje = string.Format(Properties.Resources.TipoObjetivoCalidadEdicion_MsgDescripcionExistente, tipoObjetivoCalidad.TipoObjetivoCalidadID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtGrupoID.Text)) { resultado = false; mensaje = Properties.Resources.GrupoEdicion_MsgGrupoIDRequerida; txtGrupoID.Focus(); } else if (string.IsNullOrWhiteSpace(txtDescripcion.Text)) { resultado = false; mensaje = Properties.Resources.GrupoEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else if (cmbActivo.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.GrupoEdicion_MsgActivoRequerida; cmbActivo.Focus(); } else { int grupoId = Extensor.ValorEntero(txtGrupoID.Text); string descripcion = txtDescripcion.Text; var grupoPL = new GrupoPL(); GrupoInfo grupo = grupoPL.ObtenerPorDescripcion(descripcion); if (grupo != null && (grupoId == 0 || grupoId != grupo.GrupoID)) { resultado = false; mensaje = string.Format(Properties.Resources.GrupoEdicion_MsgDescripcionExistente, grupo.GrupoID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
public CancelacionOrdenSacrificio() { try { listaOrdenDetalle = new List <OrdenSacrificioDetalleInfo>(); organizacionId = Extensor.ValorEntero(Application.Current.Properties["OrganizacionID"].ToString()); usuarioId = AuxConfiguracion.ObtenerUsuarioLogueado(); InitializeComponent(); } catch (Exception ex) { Logger.Error(ex); } }
/// <summary> /// Evento al Cambiar el indice seleccionado /// en combo de Familia /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CboFamilia_OnSelectionChanged(object sender, SelectionChangedEventArgs e) { int familiaId = Extensor.ValorEntero(Convert.ToString(cboFamilia.SelectedValue)); if (familiaId > 0) { AsignarSubFamiliaCombo(familiaId); } else { DeshabilitaComboSubfamilia(); } Contexto.FamiliaId = familiaId; }
public RecepcionProducto() { InitializeComponent(); organizacionId = Extensor.ValorEntero(Application.Current.Properties["OrganizacionID"].ToString()); usuarioId = Extensor.ValorEntero(Application.Current.Properties["UsuarioID"].ToString()); ConsultaAlmacenGeneral(); AgregarAyudaProveedor(); AgregarAyudaProducto(); CargarDatos(); recepcionProducto = new RecepcionProductoInfo(); recepcionProducto.ListaRecepcionProductoDetalle = new List <RecepcionProductoDetalleInfo>(); contador = 0; renglon = -1; }
/// <summary> /// Obtiene los filtros de la consulta /// </summary> /// <returns></returns> private CostoPromedioInfo ObtenerFiltros() { try { Contexto.Organizacion = new OrganizacionInfo { OrganizacionID = Extensor.ValorEntero(skAyudaOrganizacion.Clave) }; return(Contexto); } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } }
public SalidaRecuperacionCorral() { ListaTotal = new List <AnimalInfo>(); listaAnimalesCorraleta = new List <AnimalInfo>(); listaAnimalesCorral = new List <AnimalInfo>(); totalDestino = 0; totalOrigen = 0; banderaRetrocesoOrigen = false; banderaRetrocesoDestino = false; corralIdDestino = 0; InitializeComponent(); organizacionId = Extensor.ValorEntero(Application.Current.Properties["OrganizacionID"].ToString()); usuario = Convert.ToInt32(Application.Current.Properties["UsuarioID"]); EstablecerControles(false); }
/// <summary> /// Inicializa los datos de usuario del formulario /// </summary> private void InicializarDatosUsuario() { _organizacionId = Extensor.ValorEntero(Application.Current.Properties["OrganizacionID"].ToString()); _idUsuario = Convert.ToInt32(Application.Current.Properties["UsuarioID"]); /* Obtener la impresora de la configuracion xml */ ConfiguracionInfo configuracion = AuxConfiguracion.ObtenerConfiguracion(); _nombreImpresora = configuracion.ImpresoraRecepcionGanado; programacionRealizada = false; dtfFecha.SelectedDate = DateTime.Now.AddDays(1); //dtfFecha.IsEnabled = false; CargarCorralesParaReimplante(); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtDescripcion.Text)) { resultado = false; mensaje = Properties.Resources.ZonaEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else if (Contexto.Pais.PaisID == 0) { resultado = false; mensaje = Properties.Resources.ZonaEdicion_MsgPaisRequerida; skAyudaPais.Focus(); } else { int zonaId = Extensor.ValorEntero(txtZonaId.Text); string descripcion = txtDescripcion.Text.Trim(); var zonaBL = new ZonaBL(); ZonaInfo zona = zonaBL.ObtenerPorDescripcion(descripcion); if (zona != null && (zonaId == 0 || zonaId != zona.ZonaID)) { resultado = false; mensaje = string.Format(Properties.Resources.ZonaEdicion_MsgDescripcionExistente, zona.ZonaID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtDescripcion.Text) || Contexto.Descripcion == string.Empty) { resultado = false; mensaje = Properties.Resources.TipoPolizaEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else if (string.IsNullOrWhiteSpace(txtClavePoliza.Text) || Contexto.ClavePoliza == string.Empty) { resultado = false; mensaje = Properties.Resources.TipoPolizaEdicion_MsgClavePolizaRequerida; txtClavePoliza.Focus(); } else { int tipoPolizaId = Extensor.ValorEntero(txtTipoPolizaID.Text); string descripcion = txtDescripcion.Text.Trim(); var tipoPolizaPL = new TipoPolizaPL(); TipoPolizaInfo tipoPoliza = tipoPolizaPL.ObtenerPorDescripcion(descripcion); if (tipoPoliza != null && (tipoPolizaId == 0 || tipoPolizaId != tipoPoliza.TipoPolizaID)) { resultado = false; mensaje = string.Format(Properties.Resources.TipoPolizaEdicion_MsgDescripcionExistente, tipoPoliza.TipoPolizaID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
private void InicializaContexto() { EnvioAlimento = new EnvioAlimentoInfo { Origen = new OrganizacionInfo(), Destino = new OrganizacionInfo(), Producto = new ProductoInfo(), Almacen = new AlmacenInfo(), AlmacenInventario = new AlmacenInventarioInfo(), Cantidad = 0, Importe = 0, Piezas = 0, UsuarioCreacionID = Extensor.ValorEntero(Application.Current.Properties["UsuarioID"].ToString()), UsuarioModificacionID = Extensor.ValorEntero(Application.Current.Properties["UsuarioID"].ToString()) }; this.EnvioAlimento.AlmacenInventario.ListaAlmacenInventarioLote = new List <AlmacenInventarioLoteInfo>(); this.EnvioAlimento.Origen = new OrganizacionPL().ObtenerPorID(Extensor.ValorEntero(Application.Current.Properties["OrganizacionID"].ToString())); }
/// <summary> /// Evento que se ejecuta cuando inicia la pantalla /// </summary> private void Window_Loaded(object sender, RoutedEventArgs e) { try { AgregarAyudaOrganizacion(); CargarComboTipoTratamiento(); CargarComboTipoOrganizacion(); ucPaginacionProducto.DatosDelegado += CargarGridProductos; ucPaginacionProducto.AsignarValoresIniciales(); CargarGridProductos(ucPaginacionProducto.Inicio, ucPaginacionProducto.Limite); usuarioLogueadoID = Extensor.ValorEntero(Application.Current.Properties["UsuarioID"].ToString()); cboTipoOrganizacion.Focus(); } catch (Exception ex) { Logger.Error(ex); SkMessageBox.Show(this, Properties.Resources.TratamientoEdicion_ErrorInicial, MessageBoxButton.OK, MessageImage.Error); } }
/// <summary> /// Constructor por default de la pantalla /// </summary> public Tratamiento() { try { InitializeComponent(); InicializaContexto(); AgregarAyudaOrganizacion(); organizacionIdLogin = Extensor.ValorEntero(Application.Current.Properties["OrganizacionID"].ToString()); CargarComboTipoOrganizacion(); CargarComboTipoTratamiento(); CargarComboEstatus(); ObtenerOrganizacionDefault(); } catch (Exception ex) { Logger.Error(ex); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.Tratamiento_ErrorInicial, MessageBoxButton.OK, MessageImage.Error); } }
/// <summary> /// Obtiene los filtros de la consulta /// </summary> /// <returns></returns> private FiltroEmbarqueInfo ObtenerFiltrosInicial() { try { var tipoOrganizacion = (TipoOrganizacionInfo)CmbTipoOrganizacion.SelectedItem ?? new TipoOrganizacionInfo(); int folioEmbarque = Extensor.ValorEntero(TxtFolioEmbarque.Text); int organizacionOrigenId = Extensor.ValorEntero(skAyudaOrigen.Clave); int organizacionDestinoId = Extensor.ValorEntero(skAyudaDestino.Clave); DateTime?fechaSalida = null; DateTime?fechaLlegada = null; if (DtpFechaSalida.SelectedDate.HasValue) { fechaSalida = DtpFechaSalida.SelectedDate.Value; } if (DtpFechaLlegada.SelectedDate.HasValue) { fechaLlegada = DtpFechaLlegada.SelectedDate.Value; } var filtro = new FiltroEmbarqueInfo { FolioEmbarque = folioEmbarque, OrganizacionOrigenID = organizacionOrigenId, OrganizacionDestinoID = organizacionDestinoId, TipoOrganizacionOrigenID = tipoOrganizacion.TipoOrganizacionID, FechaSalida = fechaSalida, FechaLlegada = fechaLlegada, Estatus = Estatus.Pendiente.GetHashCode(), }; return(filtro); } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } }
/// <summary> /// Obtiene los filtros de la consulta /// </summary> /// <returns></returns> private TrampaInfo ObtenerFiltros() { try { Contexto.Organizacion = new OrganizacionInfo { OrganizacionID = Extensor.ValorEntero(skAyudaOrganizacion.Clave), TipoOrganizacion = new TipoOrganizacionInfo { TipoProceso = new TipoProcesoInfo() } }; return(Contexto); } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtDescripcion.Text)) { resultado = false; mensaje = Properties.Resources.CondicionEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else { int condicionId = Extensor.ValorEntero(txtCondicionId.Text); string descripcion = txtDescripcion.Text; var condicionPL = new CondicionPL(); CondicionInfo condicion = condicionPL.ObtenerPorDescripcion(descripcion); if (condicion != null && (condicionId == 0 || condicionId != condicion.CondicionID)) { resultado = false; mensaje = string.Format(Properties.Resources.CondicionEdicion_MsgDescripcionExistente, condicion.CondicionID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Obtiene los filtros de la consulta /// </summary> /// <returns></returns> private ProductoInfo ObtenerFiltros() { ProductoInfo filtro; try { string descripcion = txtDescripcion.Text; int familiaId = Extensor.ValorEntero(Convert.ToString(cboFamilia.SelectedValue)); int subFamiliaId = Extensor.ValorEntero(Convert.ToString(cboSubFamilia.SelectedValue)); filtro = new ProductoInfo { ProductoDescripcion = descripcion, Activo = (EstatusEnum)cboEstatus.SelectedValue, FamiliaId = familiaId, SubfamiliaId = subFamiliaId, }; } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } return(filtro); }
/// <summary> /// Guarda el envio de alimento /// </summary> /// <param name="sender">Objeto que invoco el evento</param> /// <param name="e">Parametros del evento</param> private void btnGuardar_Click(object sender, RoutedEventArgs e) { try { if (this.ValidarCamposVacios()) { if (EnvioAlimento.Destino != null && skAyudaDestino.Clave != EnvioAlimento.Destino.OrganizacionID.ToString()) { EnvioAlimento.Destino = (OrganizacionInfo)skAyudaDestino.DataContext; EnvioAlimento.Destino.ListaTiposOrganizacion = _tiposOrganizacionDestino; } if (EnvioAlimento.Producto != null && skAyudaProducto.Clave != EnvioAlimento.Producto.ProductoId.ToString()) { EnvioAlimento.Producto.ProductoId = ((ProductoInfo)skAyudaDestino.DataContext).ProductoId; if (EnvioAlimento.Producto != null) { EnvioAlimento.Producto.SubfamiliaId = int.Parse(cmbSubFamilia.SelectedValue.ToString()); } } if (this.ValidarCuentasContables()) { int productoId = this.EnvioAlimento.Producto.ProductoId; FiltroAlmacenProductoEnvio filtro = new FiltroAlmacenProductoEnvio { ProductoID = this.EnvioAlimento.Producto.ProductoId, UsaurioID = Extensor.ValorEntero(Application.Current.Properties["UsuarioID"].ToString()), Cantidad = false, Activo = true }; List <AlmacenInfo> lstAlmacenes = this._envioAlimentoPL.ObtenerAlmacenesProducto(filtro); if (lstAlmacenes == null) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.EnvioDeAlimento_MsgProductoSinAlmacen, MessageBoxButton.OK, MessageImage.Stop); this.EnvioAlimento.Producto = new ProductoInfo { ProductoId = 0, SubfamiliaId = (int)this.cmbSubFamilia.SelectedValue }; lstAlmacenes = new List <AlmacenInfo>(); cmbAlmacen.ItemsSource = lstAlmacenes; this.skAyudaProducto.LimpiarCampos(); cmbAlmacen.IsEnabled = false; return; } string error; if (ValidarSalidaExcede(out error)) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], error, MessageBoxButton.OK, MessageImage.Stop); cmbAlmacen.SelectedIndex = 0; this.EnvioAlimento.Cantidad = 0; this.EnvioAlimento.Importe = 0; this.EnvioAlimento.Piezas = 0; this.txtCantidadEnvio.Text = string.Empty; this.txtImporte.Text = string.Empty; this.txtPiezas.Text = string.Empty; return; } this.EnvioAlimento.Producto.ProductoId = productoId; EnvioAlimentoInfo confirmacionEnvio = this._envioAlimentoPL.RegistrarEnvioAlimento(this.EnvioAlimento); if (confirmacionEnvio.Folio != 0 && confirmacionEnvio.Poliza != null) { if (confirmacionEnvio.Poliza != null) { new ExportarPoliza().ImprimirPoliza(confirmacionEnvio.Poliza, string.Format("{0} {1}", "Poliza", TipoPoliza.SalidaTraspaso)); } SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], string.Format(Properties.Resources.EnvioAlimento_MsgDatosGaurdados, confirmacionEnvio.Folio), MessageBoxButton.OK, MessageImage.Correct); this.LimparPantalla(); this.InicializaContexto(); cmbSubFamilia.SelectedValue = 0; this.EnvioAlimento.Destino.ListaTiposOrganizacion = _tiposOrganizacionDestino; this.skAyudaDestino.txtClave.Focus(); } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.EnvioAlimento_MsgErrorGuardar, MessageBoxButton.OK, MessageImage.Error); } } } } catch (Exception excepcion) { Logger.Error(excepcion); SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.EnvioAlimento_MsgErrorGuardar, MessageBoxButton.OK, MessageImage.Error); } }
/// <summary> /// Metodo que se invoca cuando la ayuda de seleccion de producto se des-selecciona /// </summary> /// <param name="sender">Objeto que invoco el evento</param> /// <param name="e">Parametros del evento</param> private void skAyudaProducto_LostFocus(object sender, RoutedEventArgs e) { this.EnvioAlimento.Producto = (ProductoInfo)this.skAyudaProducto.Contexto; this.EnvioAlimento.Producto.UsuarioModificacionID = int.Parse(Application.Current.Properties["UsuarioID"].ToString()); if (this.EnvioAlimento.Producto.ProductoId > 0) { if (this.EnvioAlimento.Producto.SubFamilia != null) { this.EnvioAlimento.Producto.SubfamiliaId = this.EnvioAlimento.Producto.SubFamilia.SubFamiliaID; } if (this.EnvioAlimento.Producto.SubfamiliaId != int.Parse(this.cmbSubFamilia.SelectedValue.ToString())) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.EnvioDeAlimento_MsgProductoSubFamilia, MessageBoxButton.OK, MessageImage.Warning); this.EnvioAlimento.Producto = new ProductoInfo { ProductoId = 0, UsuarioModificacionID = int.Parse(Application.Current.Properties["UsuarioID"].ToString()) }; skAyudaProducto.Contexto = new ProductoInfo { SubfamiliaId = (int)cmbSubFamilia.SelectedValue, UsuarioModificacionID = int.Parse(Application.Current.Properties["UsuarioID"].ToString()) }; this.skAyudaProducto.LimpiarCampos(); return; } if (this.EnvioAlimento.Producto.ManejaLote) { this.OcultarLote(System.Windows.Visibility.Visible); } FiltroAlmacenProductoEnvio filtro = new FiltroAlmacenProductoEnvio { ProductoID = this.EnvioAlimento.Producto.ProductoId, UsaurioID = Extensor.ValorEntero(Application.Current.Properties["UsuarioID"].ToString()), Cantidad = false, Activo = true }; List <AlmacenInfo> lstAlmacenes = this._envioAlimentoPL.ObtenerAlmacenesProducto(filtro); if (lstAlmacenes == null) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.EnvioDeAlimento_MsgProductoSinAlmacen, MessageBoxButton.OK, MessageImage.Stop); this.EnvioAlimento.Producto = new ProductoInfo { ProductoId = 0, SubfamiliaId = (int)this.cmbSubFamilia.SelectedValue }; lstAlmacenes = new List <AlmacenInfo>(); cmbAlmacen.ItemsSource = lstAlmacenes; this.skAyudaProducto.LimpiarCampos(); cmbAlmacen.IsEnabled = false; return; } filtro.Cantidad = true; lstAlmacenes = this._envioAlimentoPL.ObtenerAlmacenesProducto(filtro); if (lstAlmacenes == null) { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.EnvioDeAlimento_MsgProductoSinInventario, MessageBoxButton.OK, MessageImage.Stop); this.EnvioAlimento.Producto = new ProductoInfo { ProductoId = 0, SubfamiliaId = (int)this.cmbSubFamilia.SelectedValue }; lstAlmacenes = new List <AlmacenInfo>(); cmbAlmacen.ItemsSource = lstAlmacenes; this.skAyudaProducto.LimpiarCampos(); cmbAlmacen.IsEnabled = false; return; } if (lstAlmacenes != null && lstAlmacenes.Count > 0) { if (lstAlmacenes.Count > 1) { lstAlmacenes.Insert(0, new AlmacenInfo { AlmacenID = 0, Descripcion = Properties.Resources.cbo_Seleccione }); } else { this.CargarInformacionProducto(lstAlmacenes.FirstOrDefault().AlmacenID, lstAlmacenes.FirstOrDefault().Descripcion); } this.cmbAlmacen.IsEnabled = true; this.cmbAlmacen.ItemsSource = lstAlmacenes; this.cmbAlmacen.SelectedItem = lstAlmacenes.FirstOrDefault(); if (lstAlmacenes.Count == 1) { this.txtCantidadEnvio.Focus(); } else { this.cmbAlmacen.Focus(); } } else { SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.EnvioAlimento_MsgProductoSinInventario, MessageBoxButton.OK, MessageImage.Stop); this.EnvioAlimento.Producto = new ProductoInfo { ProductoId = 0, SubfamiliaId = (int)this.cmbSubFamilia.SelectedValue }; lstAlmacenes = new List <AlmacenInfo>(); cmbAlmacen.ItemsSource = lstAlmacenes; this.skAyudaProducto.LimpiarCampos(); cmbAlmacen.IsEnabled = false; this.skAyudaProducto.LimpiarCampos(); this.skAyudaProducto.txtClave.Focus(); } } else { cmbAlmacen.ItemsSource = new List <AlmacenInfo>(); cmbAlmacen.IsEnabled = false; skAyudaProducto.LimpiarCampos(); } }
/// <summary> /// Evento para exportar la configuracion de las formulas a excel /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnExportar_Click(object sender, RoutedEventArgs e) { try { if (!String.IsNullOrEmpty(skAyudaOrganizacion.Clave)) { var dlg = new Microsoft.Win32.SaveFileDialog { FileName = "ConfiguracionFormulas", DefaultExt = ".xlsx", Filter = "Excel files (.xlsx)|*.xlsx" }; // Show save file dialog box var result = dlg.ShowDialog(); // Process save file dialog box results if (result != true) { return; } // Save document string nombreArchivo = dlg.FileName; var configuracionFormulaPL = new ConfiguracionFormulaPL(); var configuracionImportar = new ConfiguracionFormulaInfo { NombreArchivo = nombreArchivo, OrganizacionID = Extensor.ValorEntero(skAyudaOrganizacion.Clave) }; bool configuracionFormulaInfo = configuracionFormulaPL.ExportarArchivo(configuracionImportar); if (!configuracionFormulaInfo) { return; } //Guardado correctamente SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ConfigurarFormula_ExportoCorrectamente, MessageBoxButton.OK, MessageImage.Correct); LimpiarControles(); } else { //Favor de seleccionar una organizacion SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ConfigurarFormula_SeleccionarOrganizacion, MessageBoxButton.OK, MessageImage.Stop); } } catch (ExcepcionDesconocida ex) { Logger.Error(ex); //Favor de seleccionar una organizacion SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], (ex.InnerException == null ? ex.Message : ex.InnerException.Message), MessageBoxButton.OK, MessageImage.Stop); } catch (Exception ex) { Logger.Error(ex); //Favor de seleccionar una organizacion SkMessageBox.Show(Application.Current.Windows[ConstantesVista.WindowPrincipal], Properties.Resources.ConfigurarFormula_ExportarError, MessageBoxButton.OK, MessageImage.Stop); } }
private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtDescripcion.Text) || txtDescripcion.Text == "0") { resultado = false; mensaje = Properties.Resources.MesesPorVencer_DescripcionRequerida; txtDescripcion.Focus(); } else { int mesTemporal = 0; bool valido = int.TryParse(txtDescripcion.Text.Trim(), out mesTemporal); if (valido == false || (valido && mesTemporal <= 0)) { resultado = false; mensaje = Properties.Resources.MesesPorVencer_DescripcionNoEntero; txtDescripcion.Focus(); } else if (cmbActivo.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.MesesPorVencer_ActivoRequerida; cmbActivo.Focus(); } else { int id = Extensor.ValorEntero(txtID.Text); string descripcion = txtDescripcion.Text.Trim(); var pl = new PlazoCreditoPL(); PlazoCreditoInfo info = pl.PlazoCredito_ObtenerPorDescripcion(Convert.ToInt32(descripcion).ToString()); if (info != null && (id == 0 || id != info.PlazoCreditoID)) { resultado = false; mensaje = string.Format(Properties.Resources.MesesPorVencer_DescripcionExistente, info.PlazoCreditoID); txtDescripcion.Text = string.Empty; txtDescripcion.Focus(); } else { var config = pl.PlazoCredito_ValidarConfiguracion(id); if (config.ConfiguracionCreditoID > 0) { resultado = false; mensaje = string.Format(Properties.Resources.MesesPorVencer_MesConfigurado, config.ConfiguracionCreditoID); } else { Contexto.Descripcion = Convert.ToInt32(descripcion).ToString(); } } } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtSupervisorEnfermeriaID.Text)) { resultado = false; mensaje = Properties.Resources.SupervisorEnfermeriaEdicion_MsgSupervisorEnfermeriaIDRequerida; txtSupervisorEnfermeriaID.Focus(); } else if (Contexto.Organizacion.OrganizacionID == 0) { resultado = false; mensaje = Properties.Resources.SupervisorEnfermeriaEdicion_MsgOrganizacicionRequerida; skAyudaOrganizacion.AsignarFoco(); } else if (Contexto.Enfermeria.EnfermeriaID == 0) { resultado = false; mensaje = Properties.Resources.SupervisorEnfermeriaEdicion_MsgEnfermeriaIDRequerida; skAyudaEnfermeria.AsignarFoco(); } else if (Contexto.Operador.OperadorID == 0) { resultado = false; mensaje = Properties.Resources.SupervisorEnfermeriaEdicion_MsgOperadorIDRequerida; skAyudaOperador.AsignarFoco(); } else if (cmbActivo.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.SupervisorEnfermeriaEdicion_MsgActivoRequerida; cmbActivo.Focus(); } else { int supervisorEnfermeriaId = Extensor.ValorEntero(txtSupervisorEnfermeriaID.Text); var supervisorEnfermeriaBL = new SupervisorEnfermeriaBL(); SupervisorEnfermeriaInfo supervisorEnfermeria = supervisorEnfermeriaBL.ObtenerPorEnfermeriaOperador(Contexto); if (supervisorEnfermeria != null && (supervisorEnfermeriaId == 0 || supervisorEnfermeriaId != supervisorEnfermeria.SupervisorEnfermeriaID)) { resultado = false; mensaje = string.Format(Properties.Resources.SupervisorEnfermeriaEdicion_MsgDescripcionExistente, supervisorEnfermeria.SupervisorEnfermeriaID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtTrampaID.Text)) { resultado = false; mensaje = Properties.Resources.TrampaEdicion_MsgTrampaIDRequerida; txtTrampaID.Focus(); } else if (string.IsNullOrWhiteSpace(txtDescripcion.Text) || Contexto.Descripcion == string.Empty) { resultado = false; mensaje = Properties.Resources.TrampaEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else if (Contexto.Organizacion == null || Contexto.Organizacion.OrganizacionID == 0) { resultado = false; mensaje = Properties.Resources.TrampaEdicion_MsgOrganizacionIDRequerida; skAyudaOrganizacion.AsignarFoco(); } else if (cmbTipoTrampa.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.TrampaEdicion_MsgTipoTrampaRequerida; cmbTipoTrampa.Focus(); } else if (string.IsNullOrWhiteSpace(txtHostName.Text) || Contexto.HostName == string.Empty) { resultado = false; mensaje = Properties.Resources.TrampaEdicion_MsgHostNameRequerida; txtHostName.Focus(); } else if (cmbActivo.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.TrampaEdicion_MsgActivoRequerida; cmbActivo.Focus(); } else { int trampaId = Extensor.ValorEntero(txtTrampaID.Text); string descripcion = txtDescripcion.Text.TrimEnd(); var trampaPL = new TrampaPL(); TrampaInfo trampa = trampaPL.ObtenerPorDescripcion(descripcion); if (trampa != null && (trampaId == 0 || trampaId != trampa.TrampaID)) { resultado = false; mensaje = string.Format(Properties.Resources.TrampaEdicion_MsgDescripcionExistente, trampa.TrampaID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtAlmacenID.Text)) { resultado = false; mensaje = Properties.Resources.AlmacenEdicion_MsgAlmacenIDRequerida; txtAlmacenID.Focus(); } else if (string.IsNullOrWhiteSpace(Contexto.Descripcion)) { resultado = false; mensaje = Properties.Resources.AlmacenEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else if (string.IsNullOrWhiteSpace(Contexto.CodigoAlmacen)) { resultado = false; mensaje = Properties.Resources.AlmacenEdicion_MsgCodigoAlmacenRequerida; txtCodigoAlmacen.Focus(); } else if (Contexto.Organizacion == null || Contexto.Organizacion.OrganizacionID == 0) { resultado = false; mensaje = Properties.Resources.AlmacenEdicion_MsgOrganizacionIDRequerida; skAyudaOrganizacion.AsignarFoco(); } else if (Contexto.TipoAlmacen.TipoAlmacenID == 0) { resultado = false; mensaje = Properties.Resources.AlmacenEdicion_MsgTipoAlmacenIDRequerida; cmbTipoAlmacen.Focus(); } else if (validaProveedor && (Contexto.Proveedor == null || Contexto.Proveedor.ProveedorID == 0)) { resultado = false; mensaje = Properties.Resources.AlmacenEdicion_MsgProveedorRequerido; skAyudaProveedor.AsignarFoco(); } else if (cmbActivo.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.AlmacenEdicion_MsgActivoRequerida; cmbActivo.Focus(); } else if (validaProveedor) { if (Contexto.AlmacenID == 0 && Contexto.Proveedor != null && Contexto.Proveedor.ProveedorID > 0) { var proveedorAlmacenPL = new ProveedorAlmacenPL(); var proveedorAlmacenInfo = new ProveedorAlmacenInfo { Proveedor = Contexto.Proveedor, Almacen = new AlmacenInfo { TipoAlmacenID = Contexto.TipoAlmacen.TipoAlmacenID }, Activo = EstatusEnum.Activo }; ProveedorAlmacenInfo proveedorAlmacen = proveedorAlmacenPL.ObtenerPorProveedorTipoAlmacen(proveedorAlmacenInfo); if (proveedorAlmacen != null) { resultado = false; mensaje = Properties.Resources.AlmacenEdicion_MsgProveedorAlmacenExistente; skAyudaProveedor.AsignarFoco(); } } } else { int almacenId = Extensor.ValorEntero(txtAlmacenID.Text); string descripcion = txtDescripcion.Text; var almacenPL = new AlmacenPL(); AlmacenInfo almacen = almacenPL.ObtenerPorDescripcion(descripcion); if (almacen == null) { return(true); } if (almacen.TipoAlmacen.TipoAlmacenID != Contexto.TipoAlmacen.TipoAlmacenID && almacen.Organizacion.OrganizacionID == Contexto.Organizacion.OrganizacionID) { bool tieneProductos = almacenPL.ValidarProductosEnAlmacen(almacen); if (tieneProductos) { mensaje = Properties.Resources.AlmacenEdicion_MsgTipoAlmacenCambio; resultado = false; } } if ((almacenId == 0 || almacenId != almacen.AlmacenID) && almacen.Organizacion.OrganizacionID == Contexto.Organizacion.OrganizacionID) { resultado = false; mensaje = string.Format( Properties.Resources.AlmacenEdicion_MsgDescripcionExistente, almacen.AlmacenID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Valida que los campos requeridos contengan valor /// </summary> /// <returns></returns> private bool ValidaCamposGuardar() { var guardar = true; var mensaje = string.Empty; if (Contexto.ProductoId == 0) { guardar = false; txtProductoId.Focus(); mensaje = Properties.Resources.ProductoEdicion_CodigoMayorCero; } else if (string.IsNullOrWhiteSpace(Contexto.ProductoDescripcion)) { guardar = false; txtDescripcion.Focus(); mensaje = Properties.Resources.ProductoEdicion_Descripcion_Requerida; } else { int familiaId = Extensor.ValorEntero(Convert.ToString(cboFamilia.SelectedValue)); if (familiaId == 0) { guardar = false; cboFamilia.Focus(); mensaje = Properties.Resources.ProductoEdicion_Familia_Requerida; } else { int subFamiliaId = Extensor.ValorEntero(Convert.ToString(cboSubFamilia.SelectedValue)); if (subFamiliaId == 0) { guardar = false; cboSubFamilia.Focus(); mensaje = Properties.Resources.ProductoEdicion_SubFamilia_Requeria; } else { int unidadId = Extensor.ValorEntero(Convert.ToString(cboUnidad.SelectedValue)); if (unidadId == 0) { guardar = false; cboUnidad.Focus(); mensaje = Properties.Resources.ProductoEdicion_Unidad_Requerida; } } } } if (guardar) { var productoPL = new ProductoPL(); ProductoInfo producto = productoPL.ObtenerPorDescripcion(Contexto.ProductoDescripcion); if (producto != null && Contexto.UsuarioModificacionID == null) { mensaje = string.Format(Properties.Resources.ProductoEdicion_Descripcion_Existente, producto.ProductoId); txtDescripcion.Focus(); guardar = false; } if (producto == null) { producto = productoPL.ObtenerPorIDSinActivo(Contexto); } if (producto != null && Contexto.UsuarioModificacionID == null) { mensaje = string.Format(Properties.Resources.ProductoEdicion_Codigo_Existente, producto.Descripcion); txtProductoId.Focus(); guardar = false; } producto = productoPL.ObtenerPorMaterialSAP(Contexto.MaterialSAP); if (producto != null && Contexto.ProductoId != producto.ProductoId) { mensaje = string.Format(Properties.Resources.ProductoEdicion_Material_Existente, producto.ProductoId); txtMaterialSAP.Focus(); guardar = false; } } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(guardar); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { int numEconomico = 0; int modelo = 0; bool modeloEsNum = int.TryParse(txtModelo.Text, out modelo); bool numEconomicoEsNum = int.TryParse(txtNumEconomico.Text, out numEconomico); if (string.IsNullOrWhiteSpace(txtDescripcion.Text)) { resultado = false; mensaje = Properties.Resources.JaulaEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else if (string.IsNullOrWhiteSpace(txtNumEconomico.Text) || (numEconomicoEsNum && numEconomico == 0)) { resultado = false; mensaje = Properties.Resources.JaulaEdicion_MsgNumEconomicoRequerida; txtNumEconomico.Focus(); } else if (Contexto.Marca == null || Contexto.Marca.MarcaId == 0) { resultado = false; mensaje = Properties.Resources.JaulaEdicion_MsgMarcaRequerida; cmbMarca.Focus(); } else if (string.IsNullOrWhiteSpace(txtModelo.Text) || (modeloEsNum && modelo == 0)) { resultado = false; mensaje = Properties.Resources.JaulaEdicion_MsgModeloRequerida; txtModelo.Focus(); } else if (string.IsNullOrWhiteSpace(skAyudaProveedor.Clave) || string.IsNullOrWhiteSpace(skAyudaProveedor.Descripcion)) { resultado = false; mensaje = Properties.Resources.JaulaEdicion_MsgProveedorNoValido; skAyudaProveedor.AsignarFoco(); } else if (chkBoletinado.IsChecked == true && (string.IsNullOrWhiteSpace(txtObservacionesRegistro.Text) && string.IsNullOrWhiteSpace(txtObservacionesConsulta.Text))) { resultado = false; mensaje = Properties.Resources.JaulaEdicion_MsgObservacionesRequeridas; txtObservacionesRegistro.Focus(); } else { int jaulaId = Extensor.ValorEntero(txtJaulaId.Text); string descripcion = txtDescripcion.Text.Trim(); var jaulaPL = new JaulaPL(); JaulaInfo jaula = jaulaPL.ObtenerPorDescripcion(descripcion); if (jaula != null && (jaulaId == 0 || jaulaId != jaula.JaulaID)) { resultado = false; mensaje = string.Format(Properties.Resources.JaulaEdicion_MsgDescripcionExistente, jaula.JaulaID); txtDescripcion.Focus(); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(skAyudaOrganizacion.Clave) || string.IsNullOrWhiteSpace(skAyudaOrganizacion.Descripcion)) { resultado = false; mensaje = Properties.Resources.PrecioGanadoEdicion_MsgOrganizacionIDRequerida; skAyudaOrganizacion.AsignarFoco(); } else if (cmbTipoGanado.SelectedItem == null || Contexto.TipoGanado.TipoGanadoID == 0) { resultado = false; mensaje = Properties.Resources.PrecioGanadoEdicion_MsgTipoGanadoIDRequerida; cmbTipoGanado.Focus(); } else if (!dtuPrecio.Value.HasValue || Contexto.Precio == 0 || Validation.GetErrors(dtuPrecio).Count > 0) //string.IsNullOrWhiteSpace(txtPrecio.Text) || txtPrecio.Text == "0") { resultado = false; mensaje = Validation.GetErrors(dtuPrecio).Count > 0 ? Validation.GetErrors(dtuPrecio)[0].ErrorContent.ToString() : Properties.Resources.PrecioGanadoEdicion_MsgPrecioRequerida; dtuPrecio.Focus(); } else if (!dtpFechaVigencia.SelectedDate.HasValue)//string.IsNullOrWhiteSpace(txtFechaVigencia.Text) || txtFechaVigencia.Text == "0") { resultado = false; mensaje = Properties.Resources.PrecioGanadoEdicion_MsgFechaVigenciaRequerida; dtpFechaVigencia.Focus(); } else if (cmbActivo.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.PrecioGanadoEdicion_MsgActivoRequerida; cmbActivo.Focus(); } else { int precioGanadoId = Extensor.ValorEntero(txtPrecioGanadoID.Text); var precioGanadoPL = new PrecioGanadoPL(); PrecioGanadoInfo precioGanado = precioGanadoPL.ObtenerPorOrganizacionTipoGanado(Contexto); if (precioGanado != null && (precioGanadoId == 0 || precioGanadoId != precioGanado.PrecioGanadoID)) { resultado = false; string organizacion = skAyudaOrganizacion.Descripcion; string tipoGanado = ((TipoGanadoInfo)cmbTipoGanado.SelectedItem).Descripcion; mensaje = string.Format(Properties.Resources.PrecioGanadoEdicion_MsgDescripcionExistente, organizacion, tipoGanado, precioGanado.PrecioGanadoID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtDescripcion.Text)) { resultado = false; mensaje = Properties.Resources.OrganizacionEdicion_MsgDescripcionRequerida; txtDescripcion.Focus(); } else if (cmbTipoOrganizacion.SelectedItem == null || Contexto.TipoOrganizacion.TipoOrganizacionID == 0) { resultado = false; mensaje = Properties.Resources.OrganizacionEdicion_MsgTipoOrganizacionRequerida; cmbTipoOrganizacion.Focus(); } else if (cmbIva.SelectedItem == null || Contexto.Iva.IvaID == 0) { resultado = false; mensaje = Properties.Resources.OrganizacionEdicion_MsgIvaRequerida; cmbIva.Focus(); } else { int organizacionId = Extensor.ValorEntero(txtOrganizacionId.Text); string descripcion = txtDescripcion.Text.Trim(); if (skAyudaZona.Clave != string.Empty && !skAyudaZona.Clave.Equals("0")) { Contexto.Zona.ZonaID = Convert.ToInt32(skAyudaZona.Clave); } else { Contexto.Zona.ZonaID = null; } var organizacionPL = new OrganizacionPL(); OrganizacionInfo organizacion = organizacionPL.ObtenerPorDescripcion(descripcion); if (organizacion != null && (organizacionId == 0 || organizacionId != organizacion.OrganizacionID)) { resultado = false; mensaje = string.Format(Properties.Resources.OrganizacionEdicion_MsgDescripcionExistente, organizacion.OrganizacionID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }
public CierrreDiaInventario() { InitializeComponent(); usuarioID = Convert.ToInt32(Application.Current.Properties["UsuarioID"]); organizacionId = Extensor.ValorEntero(Application.Current.Properties["OrganizacionID"].ToString()); }
/// <summary> /// Metodo que valida los datos para guardar /// </summary> /// <returns></returns> private bool ValidaGuardar() { bool resultado = true; string mensaje = string.Empty; try { if (string.IsNullOrWhiteSpace(txtCuentaAlmacenSubFamiliaID.Text)) { resultado = false; mensaje = Properties.Resources.CuentaAlmacenSubFamiliaEdicion_MsgCuentaAlmacenSubFamiliaIDRequerida; txtCuentaAlmacenSubFamiliaID.Focus(); } else if (Contexto.Almacen == null || Contexto.Almacen.AlmacenID == 0) { resultado = false; mensaje = Properties.Resources.CuentaAlmacenSubFamiliaEdicion_MsgAlmacenIDRequerida; skAyudaAlmacen.AsignarFoco(); } else if (Contexto.SubFamilia == null || Contexto.SubFamilia.SubFamiliaID == 0) { resultado = false; mensaje = Properties.Resources.CuentaAlmacenSubFamiliaEdicion_MsgSubFamiliaIDRequerida; skAyudaSubFamilia.AsignarFoco(); } else if (Contexto.CuentaSAP == null || Contexto.CuentaSAP.CuentaSAPID == 0) { resultado = false; mensaje = Properties.Resources.CuentaAlmacenSubFamiliaEdicion_MsgCuentaSAPIDRequerida; skAyudaCuentaSAP.AsignarFoco(); } else if (cmbActivo.SelectedItem == null) { resultado = false; mensaje = Properties.Resources.CuentaAlmacenSubFamiliaEdicion_MsgActivoRequerida; cmbActivo.Focus(); } else { int cuentaAlmacenSubFamiliaId = Extensor.ValorEntero(txtCuentaAlmacenSubFamiliaID.Text); var cuentaAlmacenSubFamiliaBL = new CuentaAlmacenSubFamiliaBL(); IList <CuentaAlmacenSubFamiliaInfo> cuentasAlmacen = cuentaAlmacenSubFamiliaBL.ObtenerCostosSubFamilia(Contexto.Almacen.AlmacenID); CuentaAlmacenSubFamiliaInfo cuentaAlmacenSubFamilia = cuentasAlmacen.FirstOrDefault( cuenta => cuenta.SubFamilia.SubFamiliaID == Contexto.SubFamilia.SubFamiliaID); if (cuentaAlmacenSubFamilia != null && (cuentaAlmacenSubFamiliaId == 0 || cuentaAlmacenSubFamiliaId != cuentaAlmacenSubFamilia.CuentaAlmacenSubFamiliaID)) { resultado = false; mensaje = string.Format(Properties.Resources.CuentaAlmacenSubFamiliaEdicion_MsgDescripcionExistente, cuentaAlmacenSubFamilia.CuentaAlmacenSubFamiliaID); } } } catch (Exception ex) { throw new ExcepcionDesconocida(MethodBase.GetCurrentMethod(), ex); } if (!string.IsNullOrWhiteSpace(mensaje)) { SkMessageBox.Show(this, mensaje, MessageBoxButton.OK, MessageImage.Warning); } return(resultado); }