Esempio n. 1
0
        /// <summary>
        /// Listar todas las causas de gestiones.
        /// </summary>
        /// <returns>Lista de causas de gestiones registradas en el sistema</returns>
        public BindingList <CausaGestion> listarCausasGestion()
        {
            BindingList <CausaGestion> causas = new BindingList <CausaGestion>();

            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectCausasGestion");
            SqlDataReader datareader = null;

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                while (datareader.Read())
                {
                    byte      id          = (byte)datareader["pk_ID"];
                    string    descripcion = (string)datareader["Descripcion"];
                    Causantes causante    = (Causantes)datareader["Causante"];

                    CausaGestion causa = new CausaGestion(id, descripcion, causante);
                    causas.Add(causa);
                }

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorDatosConexion");
            }

            return(causas);
        }
Esempio n. 2
0
        /// <summary>
        /// Clic en el botón de guardar.
        /// </summary>
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            // Verificar que se hayan seleccionado los datos

            if (txtDescripcion.Text.Equals(string.Empty))
            {
                Excepcion.mostrarMensaje("ErrorCausaGestionDatosRegistro");
                return;
            }

            try
            {
                string    descripcion = txtDescripcion.Text;
                Causantes causante    = (Causantes)cboCausante.SelectedIndex;

                frmAdministracionCausasGestion padre = (frmAdministracionCausasGestion)this.Owner;

                // Verificar si la causa de gestión ya está registrada

                if (_causa == null)
                {
                    // Agregar los datos de la causa de gestión

                    if (Mensaje.mostrarMensajeConfirmacion("MensajeCausaGestionRegistro") == DialogResult.Yes)
                    {
                        CausaGestion nueva = new CausaGestion(descripcion, causante);

                        _mantenimiento.agregarCausaGestion(ref nueva);
                        padre.agregarCausaGestion(nueva);

                        Mensaje.mostrarMensaje("MensajeCausaGestionConfirmacionRegistro");
                        this.Close();
                    }
                }
                else
                {
                    // Actualizar los datos de la causa de gestión

                    CausaGestion copia = new CausaGestion(_causa.Id, descripcion, causante);

                    _mantenimiento.actualizarCausaGestion(copia);

                    _causa.Descripcion = descripcion;
                    _causa.Causante    = causante;

                    padre.actualizarLista();
                    Mensaje.mostrarMensaje("MensajeCausaGestionConfirmacionActualizacion");
                    this.Close();
                }
            }
            catch (Excepcion ex)
            {
                ex.mostrarMensaje();
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Listar todas las gestiones terminadas registradas en el sistema en un periodo de tiempo.
        /// </summary>
        /// <param name="i">Fecha inicial del periodo de tiempo</param>
        /// <param name="i">Fecha final del periodo de tiempo</param>
        /// <returns>Lista de las gestiones registradas en el sistema</returns>
        public BindingList <Gestion> listarGestionesTerminadas(DateTime i, DateTime f)
        {
            BindingList <Gestion> gestiones = new BindingList <Gestion>();

            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectGestionesTerminadas");
            SqlDataReader datareader = null;

            _manejador.agregarParametro(comando, "@fecha_inicio", i, SqlDbType.DateTime);
            _manejador.agregarParametro(comando, "@fecha_fin", f, SqlDbType.DateTime);

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                while (datareader.Read())
                {
                    int      id_gestion                  = (int)datareader["ID_Gestion"];
                    DateTime fecha                       = (DateTime)datareader["Fecha"];
                    DateTime fecha_finalizacion          = (DateTime)datareader["Fecha_Finalizacion"];
                    string   comentario                  = (string)datareader["Comentario"];
                    decimal  monto                       = (decimal)datareader["Monto"];
                    ClasificacionesGestion clasificacion = (ClasificacionesGestion)datareader["Clasificacion"];

                    short  id_cliente     = (short)datareader["ID_Cliente"];
                    string nombre_cliente = (string)datareader["Nombre_Cliente"];

                    short  id_punto_venta     = (short)datareader["ID_Punto_Venta"];
                    string nombre_punto_venta = (string)datareader["Nombre_Punto_Venta"];

                    byte   id_tipo         = (byte)datareader["ID_Tipo"];
                    string nombre_tipo     = (string)datareader["Nombre_Tipo"];
                    short  tiempo_esperado = (short)datareader["Tiempo"];

                    byte      id_causa         = (byte)datareader["ID_Causa"];
                    string    descripcion      = (string)datareader["Descripcion"];
                    Causantes causante         = (Causantes)datareader["Causante"];
                    string    comentario_causa = (string)datareader["Comentario_Causa"];

                    Cliente      cliente     = new Cliente(id_cliente, nombre_cliente);
                    PuntoVenta   punto_venta = new PuntoVenta(id_punto_venta, nombre_punto_venta, cliente);
                    TipoGestion  tipo        = new TipoGestion(id_tipo, nombre_tipo, tiempo_esperado);
                    CausaGestion causa       = new CausaGestion(id_causa, descripcion, causante);

                    Gestion gestion = new Gestion(id: id_gestion, punto_venta: punto_venta, monto: monto, tipo: tipo,
                                                  causa: causa, comentario_causa: comentario_causa, fecha: fecha,
                                                  fecha_finalizacion: fecha_finalizacion, clasificacion: clasificacion,
                                                  comentario: comentario);

                    gestiones.Add(gestion);
                }

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorDatosConexion");
            }

            return(gestiones);
        }
Esempio n. 4
0
 public CausaGestion(string descripcion, Causantes causante)
 {
     _descripcion = descripcion;
     _causante    = causante;
 }
Esempio n. 5
0
 public CausaGestion(byte id, string descripcion, Causantes causante)
 {
     _id          = id;
     _descripcion = descripcion;
     _causante    = causante;
 }
Esempio n. 6
0
        /// <summary>
        /// Seleccion de un causante.
        /// </summary>
        private void cboCausante_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblCajero.Visible = false;
            cboCajero.Visible = false;

            lblDigitador.Visible = false;
            cboDigitador.Visible = false;

            lblCoordinador.Visible = false;
            cboCoordinador.Visible = false;

            lblReceptor.Visible = false;
            cboReceptor.Visible = false;

            lblEmpresa.Visible = false;
            cboEmpresa.Visible = false;

            lblDetalleCliente.Visible = false;
            txtDetalleCliente.Visible = false;

            Causantes causante = (Causantes)cboCausante.SelectedIndex;

            switch (causante)
            {
            case Causantes.Cajero:
                lblCajero.Visible = true;
                cboCajero.Visible = true;
                break;

            case Causantes.Digitador:
                lblDigitador.Visible = true;
                cboDigitador.Visible = true;
                break;

            case Causantes.Coordinador:
                lblCoordinador.Visible = true;
                cboCoordinador.Visible = true;
                break;

            case Causantes.Receptor:
                lblReceptor.Visible = true;
                cboReceptor.Visible = true;
                break;

            case Causantes.Transportadora:
                lblEmpresa.Visible = true;
                cboEmpresa.Visible = true;
                break;

            case Causantes.Cliente:
            case Causantes.Otro:
                lblDetalleCliente.Visible = true;
                txtDetalleCliente.Visible = true;
                break;
            }

            // Restringir las causas según el causante

            BindingList <CausaGestion> causas_causante = new BindingList <CausaGestion>();

            foreach (CausaGestion causa in _causas)
            {
                if (causa.Causante == causante)
                {
                    causas_causante.Add(causa);
                }
            }

            cboCausa.ListaMostrada = causas_causante;

            if (cboCausa.Items.Count > 0)
            {
                cboCausa.SelectedIndex = 0;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Clic en el botón de guardar.
        /// </summary>
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            // Verificar que se hayan seleccionado los datos

            Causantes causante = (Causantes)cboCausante.SelectedIndex;

            if ((causante == Causantes.Cajero && cboCajero.SelectedItem == null) ||
                (causante == Causantes.Digitador && cboDigitador.SelectedItem == null) ||
                (causante == Causantes.Coordinador && cboCoordinador.SelectedItem == null) ||
                (causante == Causantes.Receptor && cboReceptor.SelectedItem == null) ||
                (causante == Causantes.Transportadora && cboEmpresa.SelectedItem == null) ||
                cboCausa.SelectedItem == null ||
                cboClasificacion.SelectedItem == null)
            {
                Excepcion.mostrarMensaje("ErrorGestionDatosTerminacion");
                return;
            }

            try
            {
                CausaGestion           causa          = (CausaGestion)cboCausa.SelectedItem;
                Colaborador            colaborador    = null;
                EmpresaTransporte      transportadora = null;
                ClasificacionesGestion clasificacion  = (ClasificacionesGestion)cboClasificacion.SelectedIndex;
                string comentario_causa = txtComentarioCausa.Text;

                switch (causante)
                {
                case Causantes.Cajero:
                    colaborador = (Colaborador)cboCajero.SelectedItem;
                    break;

                case Causantes.Digitador:
                    colaborador = (Colaborador)cboDigitador.SelectedItem;
                    break;

                case Causantes.Coordinador:
                    colaborador = (Colaborador)cboCoordinador.SelectedItem;
                    break;

                case Causantes.Receptor:
                    colaborador = (Colaborador)cboReceptor.SelectedItem;
                    break;

                case Causantes.Transportadora:
                    transportadora = (EmpresaTransporte)cboEmpresa.SelectedItem;
                    break;
                }

                if (Mensaje.mostrarMensajeConfirmacion("MensajeGestionTerminacion") == DialogResult.Yes)
                {
                    // Actualizar los datos de la gestión

                    _gestion.Causa            = causa;
                    _gestion.Colaborador      = colaborador;
                    _gestion.Transportadora   = transportadora;
                    _gestion.Comentario_causa = comentario_causa;
                    _gestion.Clasificacion    = clasificacion;

                    _coordinacion.actualizarGestionTerminar(_gestion);

                    if (this.Owner is frmAdministracionGestiones)
                    {
                        ((frmAdministracionGestiones)this.Owner).eliminarGestion(_gestion);
                    }
                    else if (this.Owner is frmRecordatorioGestiones)
                    {
                        ((frmRecordatorioGestiones)this.Owner).eliminarGestion(_gestion);
                    }
                    else if (this.Owner is frmGestionesTeminadas)
                    {
                        ((frmGestionesTeminadas)this.Owner).actualizarLista();
                    }

                    Mensaje.mostrarMensaje("MensajeGestionConfirmacionTerminacion");
                    this.Close();
                }
            }
            catch (Excepcion ex)
            {
                ex.mostrarMensaje();
            }
        }