private void dgv_Busqueda_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex.Equals(this.dgv_Busqueda.Columns["Facturar"].Index) && e.RowIndex != -1)
            {
                this.dgv_Busqueda.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = !(bool)this.dgv_Busqueda.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;

                if (itemEsUnaCompra(dgv_Busqueda.Rows[e.RowIndex]))
                {
                    if (!ValidarComprasAnteriores(this.dgv_Busqueda.Rows[e.RowIndex]))
                    {
                        this.dgv_Busqueda.Rows[e.RowIndex].Cells["Facturar"].Value = false;
                        MessageDialog.MensajeInformativo(this, "Debe pagar las compras mas antiguas primero");
                        this.dgv_Busqueda.RefreshEdit();
                    }
                }
                if (itemEsUnaBonificacion(dgv_Busqueda.Rows[e.RowIndex]))
                {
                    this.dgv_Busqueda.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = true;
                    this.dgv_Busqueda.RefreshEdit();
                }

                this.Cada10PublicacionesSeDebeBonificarLaDecima(dgv_Busqueda.Rows[e.RowIndex]);

                this.CalcularCostos();
            }
        }
 private void CargarRespuestasHechas()
 {
     try
     {
         this.preguntaRespondidas = this.preguntasDB.getPreguntasYaRespondidas(this.usuarioActual);
         if (this.preguntaRespondidas.Count > 0)
         {
             this.dgv_Busqueda.DataSource = this.preparaLista(this.preguntaRespondidas);
             this.PreparaGrilla();
             this.ModoVerPreguntasPendientes = false;
             this.btn_Seleccionar.Enabled    = true;
         }
         else
         {
             this.btn_Seleccionar.Enabled = false;
             MessageDialog.MensajeInformativo(this, "No respondió ninguna pregunta aún!");
         }
     }
     catch (SqlException ex)
     {
         MessageDialog.MensajeError(ex.Message);
     }
     catch (Exception e)
     {
         MessageDialog.MensajeError(e.Message);
     }
 }
 private void CargarPreguntasPendientes()
 {
     try
     {
         this.preguntasPendientes = this.preguntasDB.getPreguntasSinResponder(this.usuarioActual);
         if (this.preguntasPendientes.Count > 0)
         {
             this.dgv_Busqueda.DataSource = this.preparaLista(this.preguntasPendientes);
             this.PreparaGrilla();
             this.ModoVerPreguntasPendientes = true;
             this.btn_Seleccionar.Enabled    = true;
         }
         else
         {
             this.dgv_Busqueda.DataSource = null;
             this.btn_Seleccionar.Enabled = false;
             this.dgv_Busqueda.Refresh();
             MessageDialog.MensajeInformativo(this, "No tiene preguntas pendientes para responder!");
         }
     }
     catch (SqlException ex)
     {
         MessageDialog.MensajeError(ex.Message);
     }
     catch (Exception e)
     {
         MessageDialog.MensajeError(e.Message);
     }
 }
Esempio n. 4
0
 protected override void AccionAceptar()
 {
     bool resultado = this.OfertarDB();
     if (resultado) 
     {
         MessageDialog.MensajeInformativo(this, "La oferta se realizó con exito");
     }
 }
Esempio n. 5
0
 protected override void AccionAceptar()
 {
     this.armarCalificacion();
     if (this.CalificarDB())
     {
         MessageDialog.MensajeInformativo(this, "Se calificó la compra correctamente!");
         this.Close();
     }
 }
Esempio n. 6
0
        protected void Limpiar()
        {
            DialogResult dr = MessageDialog.MensajeInformativo(this, "¿Esta seguro que desea limpiar los campos?", MessageBoxButtons.YesNo);

            if (dr == DialogResult.Yes)
            {
                this.AccionLimpiar();
            }
        }
Esempio n. 7
0
        private void AltaCliente(Cliente clienteAlta)
        {
            bool insertSalioBien = this.CrearClienteDB(clienteAlta);

            if (insertSalioBien == true)
            {
                MessageDialog.MensajeInformativo(this, "Se registro correctamente");
                this.Close();
            }
        }
Esempio n. 8
0
        private void AltaUsuario(Usuario empresaAlta)
        {
            bool insertSalioBien = this.CrearUsuario(empresaAlta);

            if (insertSalioBien == true)
            {
                MessageDialog.MensajeInformativo(this, "Se registro correctamente");
                this.Close();
            }
        }
        private void AltaPublicacion(Publicacion publicacionAlta)
        {
            bool insertSalioBien = this.CrearPublicacionDB(publicacionAlta);

            if (insertSalioBien == true)
            {
                MessageDialog.MensajeInformativo(this, "Se registro correctamente");
                this.Close();
            }
        }
Esempio n. 10
0
 protected virtual void Aceptar()
 {
     if (base.Validar())
     {
         DialogResult dr = MessageDialog.MensajeInformativo(this, this.messageAlta, MessageBoxButtons.YesNo);
         if (dr == DialogResult.Yes)
         {
             this.AccionAceptar();
         }
     }
 }
        protected override void AccionAceptar()
        {
            Preguntas preguntaNew = this.ArmarRespuesta();

            if (this.nuevaRespuestaDB(preguntaNew))
            {
                this.pregunta.respuesta = preguntaNew.respuesta;
                MessageDialog.MensajeInformativo(this, "La pregunta se respondió correctamente!");
                this.Close();
            }
        }
Esempio n. 12
0
 protected virtual void Aceptar()
 {
     if (base.Validar())
     {
         DialogResult dr = MessageDialog.MensajeInformativo(this, "¿Confirma la modificación del registro?", MessageBoxButtons.YesNo);
         if (dr == DialogResult.Yes)
         {
             this.AccionAceptar();
         }
     }
 }
Esempio n. 13
0
 private void ValidarUsuarioHabilitadoParaComprar()
 {
     if (!this.usuarioActual.habilitada_comprar && this.compras.Count.Equals(0))
     {
         if (this.habilitarParaComprarDB())
         {
             this.usuarioActual.habilitada_comprar = true;
             MessageDialog.MensajeInformativo(this, "Ya calificó todas sus compras. Ya puede continuar comprando u ofertando!");
             this.Close();
         }
     }
 }
Esempio n. 14
0
        protected override void AccionAceptar()
        {
            this.rolModif.nombre = this.tb_Nombre_nuevo.Text;
            IList <FuncionalidaXRol> funcs = this.armarFuncionalidades();

            if (this.modificarRolDB(funcs))
            {
                this.funcionalidades = funcs;
                MessageDialog.MensajeInformativo(this, "Se modifico el registro correctamente");
                this.Close();
            }
        }
Esempio n. 15
0
        protected override void AccionAceptar()
        {
            this.rol.nombre     = this.tb_Nombre_del_rol.Text;
            this.rol.habilitada = this.ch_Habilitado.Checked;
            IList <FuncionalidaXRol> funcs = this.armarFuncionalidades();

            if (this.crearRolDB(funcs))
            {
                MessageDialog.MensajeInformativo(this, "Se creó el rol correctamente");
                this.Close();
            }
        }
        protected override void AccionMostrarSiguiente(TipoGenerico tipoElegido)
        {
            TipoPublicacion tipo = (TipoPublicacion)tipoElegido;

            if (!string.IsNullOrEmpty(tipo.Nombre))
            {
                this.FormSiguiente = new GenerarPublicacion(tipo, this.usuarioPublicador);
                this.mostrarVentanaSiguiente();
            }
            else
            {
                MessageDialog.MensajeInformativo(this, "Seleccione un tipo de publicacion a crear para continuar");
            }
        }
Esempio n. 17
0
 protected override void AccionAceptar()
 {
     if (this.modificoLaContrasenia())
     {
         Usuario usuarioModif = this.armarUsuario();
         if (actualizarContraseniaPrimerIngresoDB(usuarioModif))
         {
             MessageDialog.MensajeInformativo(this, "Se modifico la contraseña correctamente. Puede continuar!");
             this.DialogResult = DialogResult.OK;
             this.Close();
         }
     }
     else
     {
         MessageDialog.MensajeInformativo(this, "Debe modificar la contraseña");
     }
 }
 private void AccionOfertar()
 {
     if (this.usuarioActual.habilitada)
     {
         AltaOferta   frm    = new AltaOferta(this.publi, this.usuarioActual);
         DialogResult result = frm.ShowDialog(this);
         if (result == DialogResult.OK)
         {
             this.publi.precio = frm.oferta.monto;
         }
         this.AccionIniciar();
     }
     else
     {
         MessageDialog.MensajeInformativo(this, "Usted no esta habilitado para realizar acciones de compra/oferta");
     }
 }
        private void btnBaja_Click(object sender, EventArgs e)
        {
            if (this.EntidadSeleccionada == null)
            {
                MessageDialog.MensajeError(this, "Debe seleccionar un registro primero");
            }
            else
            {
                DialogResult dr = MessageDialog.MensajeInformativo(this, "¿Está seguro que quiere hacer eso?", MessageBoxButtons.YesNo);

                if (dr == DialogResult.Yes)
                {
                    this.AccionBorrar();
                    this.Filtrar();
                }
            }
        }
Esempio n. 20
0
        protected override void AccionBorrar()
        {
            Rol seleccionado = this.EntidadSeleccionada as Rol;

            if (this.habilitacionDelRegistroDB(seleccionado))
            {
                if (seleccionado.habilitada)
                {
                    MessageDialog.MensajeInformativo(this, "Se habilitó el rol correctamente");
                }
                else
                {
                    MessageDialog.MensajeInformativo(this, "Se deshabilitó el rol correctamente");
                }
                this.Filtrar();
            }
        }
Esempio n. 21
0
        private void login()
        {
            try
            {
                if (this.realizar_login())
                {
                    IList <Rol> roles_usuario = this.rolDB.ObtenerRoles(this.textBoxUsername.Text);

                    if (roles_usuario.Count > 1 && rol_seleccionado)
                    {
                        this.textBoxUsername.Enabled   = false;
                        this.textBoxPassword.Enabled   = false;
                        this.labelRol.Visible          = true;
                        this.comboBoxRol.Visible       = true;
                        this.comboBoxRol.DataSource    = roles_usuario;
                        this.comboBoxRol.SelectedIndex = 0;

                        MessageDialog.MensajeInformativo(this, "Debe seleccionar un rol para continuar");
                        rol_seleccionado = false;
                    }
                    else if (roles_usuario.Count > 1 && !rol_seleccionado)
                    {
                        this.RolUsuarioIniciado = (Rol)this.comboBoxRol.SelectedItem;
                        this.obtenerUsuarioLogueadoCorrectamente();
                    }
                    else
                    {
                        if (roles_usuario.Count.Equals(0))
                        {
                            MessageDialog.MensajeInformativo(this, "No puede ingresar al sistema debido a que se encuentra inhabilitado o todos sus roles lo están.");
                            this.Close();
                        }
                        else
                        {
                            this.RolUsuarioIniciado = roles_usuario.First();
                            this.obtenerUsuarioLogueadoCorrectamente();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageDialog.MensajeError(this, ex.Message);
                this.limpiarTextBoxes();
            }
        }
 private void CargarGrilla()
 {
     if (itemsDB())
     {
         if (this.items.Count.Equals(0))
         {
             this.LimpiarSeleccionDeUsuario();
             MessageDialog.MensajeInformativo(this, "El usuario elegido no tiene nada pendiente que facturar");
         }
         else
         {
             this.dgv_Busqueda.DataSource = this.items;
             this.PrepararGrilla();
             this.habilitarControllersDeFacturacion();
             this.CalcularCostos();
         }
     }
 }
 private void AccionComprar()
 {
     if (this.usuarioActual.habilitada_comprar)
     {
         AltaCompra   frm    = new AltaCompra(this.usuarioActual, this.publi);
         DialogResult result = frm.ShowDialog(this);
         if (result == DialogResult.OK)
         {
             this.publi.stock = this.publi.stock - frm.compra.cantidad;
             this.Close();
         }
         this.AccionIniciar();
     }
     else
     {
         MessageDialog.MensajeInformativo(this, "Usted no esta habilitado para realizar acciones de compra/oferta");
     }
 }
 private void btn_Preguntar_Click(object sender, EventArgs e)
 {
     if (this.publi.permite_preguntas)
     {
         if (this.publi.usuario_publicador.id_usuario != this.usuarioActual.id_usuario)
         {
             AltaPregunta frm = new AltaPregunta(this.publi, this.usuarioActual);
             frm.ShowDialog(this);
             this.AccionIniciar();
         }
         else
         {
             MessageDialog.MensajeInformativo(this, "No puede realizar preguntas en su misma publicación");
         }
     }
     else
     {
         MessageDialog.MensajeInformativo(this, "Esta publicacion no permite que se realicen preguntas");
     }
 }
        protected override void AccionAceptar()
        {
            this.factura = null;
            this.factura = this.armarFactura();
            IList <ItemFactura> items = this.armarItems();

            if (items.Count > 0)
            {
                if (this.armarFacturaDB(items))
                {
                    FacturaVista frm = new FacturaVista(this.factura, items);
                    frm.ShowDialog();
                    this.CargarGrilla();
                }
            }
            else
            {
                MessageDialog.MensajeInformativo(this, "Tiene que seleccionar los items para crear la factura!");
            }
        }
Esempio n. 26
0
        private void btn_Ver_publicacion_Click(object sender, EventArgs e)
        {
            PublicacionAMostrar publicacionMostrada = this.EntidadSeleccionada as PublicacionAMostrar;

            if (publicacionMostrada == null)
            {
                MessageDialog.MensajeError(this, "Debe seleccionar una publicacion primero");
            }
            else
            {
                if (this.usuarioActual.habilitada_comprar)
                {
                    Publicacion     publicacion = this.rearmarPublicacion(publicacionMostrada);
                    PublicacionView frmPub      = new PublicacionView(publicacion, this.usuarioActual);
                    frmPub.ShowDialog(this);
                    this.ConfiguracionesLoad();
                    this.Filtrar();
                }
                else
                {
                    MessageDialog.MensajeInformativo(this, "No puede realizar ninguna operación de compra u oferta hasta que califique todas sus operaciones");
                }
            }
        }