コード例 #1
0
        private void TxtCodigo_LostFocus(object sender, RoutedEventArgs e)
        {
            if (!ZMX_EjecutoBusqueda && !txtCodigo.Text.Equals("") && !ZMX_EsExpresionContable)
            {
                DataRow drSeleccionado = BuscarPorCodigo();

                if (drSeleccionado == null)
                {
                    ZMX_Limpiar();
                    return;
                }

                DataRow drCuenta       = drSeleccionado;
                Boolean estatusID      = Convert.ToBoolean(drCuenta[ZMX_ContabilidadEstatusIDPath]);
                Boolean cuentaRegistro = Convert.ToBoolean(drCuenta[ZMX_ContabilidadCuentaRegistroPath]);

                if (!estatusID)
                {
                    ZMX_Limpiar();
                    ZMXUC_MessageBoxERP.Show("Cuenta contable Inactiva.", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                if (!cuentaRegistro)
                {
                    ZMX_Limpiar();
                    ZMXUC_MessageBoxERP.Show("Cuenta contable no es de registro.", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                if (ZMX_ValorCambiadoRow != null)
                {
                    ZMX_ValorCambiadoRow(drSeleccionado);
                }
            }
        }
コード例 #2
0
 public void ZMX_ValidarNoExiste(DataRow drSeleccionado)
 {
     if (!string.IsNullOrEmpty(ZMX_MensajeNoExiste))
     {
         if (drSeleccionado == null)
         {
             ZMXUC_MessageBoxERP.Show(ZMX_MensajeNoExiste, "", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
 }
コード例 #3
0
 public void ZMX_ValidarInactivo(DataRow drSeleccionado)
 {
     if (drSeleccionado != null && string.IsNullOrEmpty(ZMX_MensajeInactivo) && string.IsNullOrEmpty(ZMX_PathEstatusId))
     {
         try
         {
             if (ZMX_PathEstatusId != null)
             {
                 Convert.ToInt32(drSeleccionado[ZMX_PathEstatusId]);
             }
         }
         catch
         {
             throw new Exception("La columna 'ZMX_PathEstatusId' no se encuentra en la consulta.");
         }
         if (ZMX_PathEstatusId != null && Convert.ToInt32(drSeleccionado[ZMX_PathEstatusId]) == 2)
         {
             ZMXUC_MessageBoxERP.Show(ZMX_MensajeInactivo, "", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
 }
コード例 #4
0
        private void RadGridView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (rgvElementos.SelectedItem != null)
            {
                //validando lo de cuentas contables
                if (ZMX_ModoCuentaContable)
                {
                    DataRow drCuenta = (DataRow)rgvElementos.SelectedItem;

                    if (string.IsNullOrEmpty(ZMX_ContabilidadEstatusIDPath))
                    {
                        throw new Exception("Es necesario indicar 'ZMX_ContabilidadEstatusIDPath' en el prompt de cuentas contables.");
                    }

                    if (string.IsNullOrEmpty(ZMX_ContabilidadCuentaRegistroPath))
                    {
                        throw new Exception("Es necesario indicar 'ZMX_ContabilidadCuentaRegistroPath' en el prompt de cuentas contables.");
                    }
                    int     estatusID      = 0;
                    Boolean cuentaRegistro = false;
                    try
                    {
                        estatusID = Convert.ToInt32(drCuenta[ZMX_ContabilidadEstatusIDPath]);
                    }
                    catch
                    {
                        throw new Exception("El path 'ZMX_ContabilidadEstatusIDPath' con valor '" + ZMX_ContabilidadEstatusIDPath + "' no se encuentra en el resultado de la consulta.");
                    }
                    try
                    {
                        cuentaRegistro = Convert.ToBoolean(drCuenta[ZMX_ContabilidadCuentaRegistroPath]);
                    }
                    catch
                    {
                        throw new Exception("El path 'ZMX_ContabilidadCuentaRegistroPath' con valor '" + ZMX_ContabilidadCuentaRegistroPath + "' no se encuentra en el resultado de la consulta.");
                    }

                    if (estatusID == 2)
                    {
                        ZMXUC_MessageBoxERP.Show("Cuenta contable Inactiva.", "", MessageBoxButton.OK, MessageBoxImage.Information);
                        return;
                    }
                    if (!cuentaRegistro)
                    {
                        ZMXUC_MessageBoxERP.Show("Cuenta contable no es de registro.", "", MessageBoxButton.OK, MessageBoxImage.Information);
                        return;
                    }
                }
                else
                {
                    //se aplican validaciones para catalogos genericos de acuerdo a las banderas
                    DataRow drSeleccionado = (DataRow)rgvElementos.SelectedItem;
                    ZMX_PromptGenerico.ZMX_ValidarInactivo(drSeleccionado);
                    ZMX_PromptGenerico.ZMX_ValidarNoExiste(drSeleccionado);
                }
                //termina validacion de cuentas contables
                if (ZMX_SeleccionoRow != null)
                {
                    ZMX_SeleccionoRow((DataRow)rgvElementos.SelectedItem);
                }
            }
        }
コード例 #5
0
        private void TxtCodigo_KeyDown(object sender, KeyEventArgs e)
        {
            //verificando si contiene un & el codigo, y cambiando la configuración a expresión contable
            if (txtCodigo.Text.Contains("&"))
            {
                ZMX_EsExpresionContable = true;
                txtDescripcion.Text     = "Expresión contable";
            }
            else
            {
                ZMX_EsExpresionContable = false;
            }

            if (e.Key == Key.Tab && (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)))
            {
                if (ZMX_ActivarAnteriorControl != null)
                {
                    e.Handled = true;
                    ZMX_ActivarAnteriorControl(this);
                }
            }
            else if ((e.Key == Key.Enter || e.Key == Key.Tab) && !ZMX_EsExpresionContable && !string.IsNullOrEmpty(txtCodigo.Text))
            {
                DataRow drSeleccionado = BuscarPorCodigo();

                DataRow drCuenta = drSeleccionado;

                if (drCuenta == null)
                {
                    ZMXUC_MessageBoxERP.Show("Cuenta contable no existe.", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                Boolean estatusID      = false;
                Boolean cuentaRegistro = false;

                try
                {
                    estatusID = Convert.ToBoolean(drCuenta[ZMX_ContabilidadEstatusIDPath]);
                }
                catch (Exception ex) { new Exception("Ocurrió un error al evaluar el estatus de la cuenta contable, favor de verificar que la fuente de datos (DataTable) contenga la columna: '" + ZMX_ContabilidadEstatusIDPath + "'.", ex); return; }
                try
                {
                    cuentaRegistro = Convert.ToBoolean(drCuenta[ZMX_ContabilidadCuentaRegistroPath]);
                }
                catch (Exception ex) { new Exception("Ocurrió un error al evaluar el si la cuenta es de registro, favor de verificar que la fuente de datos (DataTable) contenga la columna: '" + ZMX_ContabilidadCuentaRegistroPath + "'.", ex); return; }

                if (!estatusID)
                {
                    ZMX_Limpiar();
                    ZMXUC_MessageBoxERP.Show("Cuenta contable Inactiva.", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }
                if (!cuentaRegistro)
                {
                    ZMX_Limpiar();
                    ZMXUC_MessageBoxERP.Show("Cuenta contable no es de registro.", "", MessageBoxButton.OK, MessageBoxImage.Information);
                    return;
                }

                if (ZMX_ValorCambiadoRow != null)
                {
                    ZMX_ValorCambiadoRow(drSeleccionado);
                }

                txtCodigo.SelectionStart = txtCodigo.Text.Length;
            }
            else if ((e.Key == Key.Enter || e.Key == Key.Tab) && ZMX_EsExpresionContable)
            {
                ZMX_ID = txtCodigo.Text;
                if (ZMX_EsRequerido)
                {
                    ZMX_MarcarRequerido = false;
                }
                if (e.Key == Key.Tab)
                {
                    e.Handled = true;
                }
                if (ZMX_ActivarSiguienteControl != null)
                {
                    ZMX_ActivarSiguienteControl(this);
                }
            }
            else if (e.Key == Key.F5 && !ZMX_EsExpresionContable)
            {
                ToolbarBtn_toolbarBtnClick(null);
            }
            else if ((e.Key == Key.Enter || e.Key == Key.Tab) && string.IsNullOrEmpty(txtCodigo.Text) && ZMX_EsRequerido)
            {
                if (e.Key == Key.Tab)
                {
                    e.Handled = true;
                }
                if (ZMX_ActivarSiguienteControl != null)
                {
                    ZMX_ActivarSiguienteControl(this);
                }
            }
            else if ((e.Key == Key.Enter || e.Key == Key.Tab) && string.IsNullOrEmpty(txtCodigo.Text) && !ZMX_EsRequerido)
            {
                e.Handled = true;
                if (ZMX_ActivarSiguienteControl != null)
                {
                    ZMX_ActivarSiguienteControl(this);
                }
            }
            if (string.IsNullOrEmpty(txtCodigo.Text) && ZMX_SeLimpioControl != null)
            {
                ZMX_SeLimpioControl(this);
            }
        }