Example #1
0
        public void insertarDescuentos()
        {
            descuentos                      = new Descuento();
            descuentos.txtNombre            = txtNombre.Text;
            descuentos.dateFechaInicio      = Convert.ToDateTime(txtFechaInicio.Text);
            descuentos.dateFechaFin         = Convert.ToDateTime(txtFechaFin.Text);
            descuentos.descuento            = Convert.ToInt16(txtDescuento.Text);
            descuentos.descripcion          = txtDescripcion.Text;
            descuentos.intIdUsuarioCreacion = IdUsuario.IdUsuarioConectado;
            if (tipoInsercion == 0)
            {
                DescuentoBLL.InsertObjetoDescuento(descuentos);
                MessageBox.Show("El registro se ha guardado correctamente");
            }

            if (tipoInsercion == 1)
            {
                descuentos.pkDescuento = Convert.ToInt16(txtPkDescuento.Text);
                DescuentoBLL.UpdateDescuento(descuentos);
                MessageBox.Show("El registro se ha actualizado correctamente");
                frmDescuentos frm = new frmDescuentos();
                frm.MdiParent   = this.MdiParent;
                frm.WindowState = FormWindowState.Maximized;
                frm.Show();
                this.Dispose();
            }
        }
Example #2
0
        public void tipoBoton(DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == btnUpdate.Index)
            {
                frmInsertarDescuentos frm = new frmInsertarDescuentos();
                frm.MdiParent   = this.MdiParent;
                frm.WindowState = FormWindowState.Maximized;
                frm.Show();
                frm.TipoInsercion = 1;
                frm.pkDescuento   = tblDescuentos.Rows[e.RowIndex].Cells[0].Value.ToString();
                frm.Nombre        = tblDescuentos.Rows[e.RowIndex].Cells[1].Value.ToString();
                frm.FechaInicio   = tblDescuentos.Rows[e.RowIndex].Cells[2].Value.ToString();
                frm.FechaFin      = tblDescuentos.Rows[e.RowIndex].Cells[3].Value.ToString();
                frm.Descuento     = tblDescuentos.Rows[e.RowIndex].Cells[4].Value.ToString();
                frm.Descripcion   = tblDescuentos.Rows[e.RowIndex].Cells[5].Value.ToString();
                this.Dispose();
            }

            if (e.ColumnIndex == btnEliminar.Index)
            {
                if (MessageBox.Show("Esta seguro de eliminar este registro?", "Eliminar Registro", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (MessageBox.Show("Esta totalmente seguro?", "Eliminar Registro", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        int pkDescuento = Convert.ToInt16(tblDescuentos.Rows[e.RowIndex].Cells[0].Value.ToString());
                        DescuentoBLL.DeleteDescuento(pkDescuento);
                        MessageBox.Show("Registro eliminado satisfactoriamente");
                        this.cargarDatos();
                    }
                }
            }
        }
Example #3
0
        public double getDescuento(decimal monto)
        {
            int    pkD  = Convert.ToInt32(boxDescuentos.SelectedValue);
            double desc = (100 - (DescuentoBLL.GetDescuentoById(pkD).descuento));

            return((double)monto * (desc / 100));
        }
Example #4
0
 public void cargarDatos()
 {
     tblDescuentos.DataSource = DescuentoBLL.SelectAll();
 }
Example #5
0
 private void cargarBoxDescuentos()
 {
     boxDescuentos.DataSource    = DescuentoBLL.SelectAll();
     boxDescuentos.DisplayMember = "txtNombre";
     boxDescuentos.ValueMember   = "pkDescuento";
 }