Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            PresupuestoBLL         bllPres = new PresupuestoBLL();
            ReporteVentasAtrasadas rep     = new ReporteVentasAtrasadas();

            rep.GenerarPresupuestoPdf(bllPres.PresupuestosAtrasados(dateTimePickerDesde.Value, dateTimePickerHasta.Value));
        }
        private void GuardarButton_Click(object sender, EventArgs e)
        {
            repositorio = new RepositorioBase <Presupuesto>();
            Presupuesto presupuesto;
            bool        paso = false;

            presupuesto = LlenaClase();

            if (PresupuestoIDnumericUpDown.Value == 0)
            {
                paso = repositorio.Guardar(presupuesto);
            }
            else
            {
                if (!ExisteEnLaBaseDeDatos())
                {
                    MessageBox.Show("No se puede modificar un Presupuesto que no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                paso = PresupuestoBLL.Modificar(presupuesto);
            }
            if (paso)
            {
                MessageBox.Show("Guardado", "Exito!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Limpiar();
            }
            else
            {
                MessageBox.Show("No se pudo Guardar!!", "Fallo!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #3
0
        protected void ButtonGuardar_Click(object sender, EventArgs e)
        {
            var Presupuesto = new Presupuesto();

            Presupuesto = Llenar();
            PresupuestoBLL.Guardar(Presupuesto);
        }
Beispiel #4
0
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (Validar())
     {
         presupuesto = LlenarCampos();
         PresupuestoBLL.Guardar(presupuesto);
     }
 }
        public void CompletarDatosPresupuesto()
        {
            PresupuestoBLL bllPresup = new PresupuestoBLL();
            ClienteBLL     bllCli    = new ClienteBLL();
            UsuarioBLL     bllUs     = new UsuarioBLL();

            vPresup = bllPresup.SeleccionarPresupuestoPorId(vPresup.Id);
            //vPresup.Cliente = bllCli.SeleccionarPorId(vPresup.Cliente.Id);
            vPresup.Vendedor = bllUs.SeleccionarUsuarioPorId(vPresup.Vendedor.Id);
        }
 protected void EliminarButton_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(PresupuestoIdTextBox.Text))
     {
         int id = Utilidad.ToInt(PresupuestoIdTextBox.Text);
         presupuesto = PresupuestoBLL.Buscar(P => P.PresupuestoId == id);
         PresupuestoBLL.Eliminar(presupuesto);
         Limpiar();
     }
 }
 protected void BuscarButton_Click(object sender, EventArgs e)
 {
     if (idpreTextBox.Text == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Llene el campo Id');</script>");
     }
     else
     {
         Buscarpresupuesto(PresupuestoBLL.Buscar(v.String(idpreTextBox.Text)));
     }
 }
Beispiel #8
0
        protected void ButtonNuevo_Click(object sender, EventArgs e)
        {
            int         id          = Utilidades.ToInt(TextId.Text);
            Presupuesto presupuesto = PresupuestoBLL.Buscar(p => p.IdPresupuesto == id);

            if (presupuesto != null)
            {
                TextDescripcion.Text = presupuesto.Descripcion;
                TextMonto.Text       = presupuesto.Monto.ToString();
            }
        }
Beispiel #9
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            int id = Utilidades.TOINT(PresupuestoIdTextBox.Text);

            if (PresupuestoBLL.Eliminar(PresupuestoBLL.Buscar(p => p.PresupuestoId == id)))
            {
                Limpiar();
            }
            else
            {
            }
        }
Beispiel #10
0
        protected void ButtonEliminar_Click(object sender, EventArgs e)
        {
            int         id          = Utilidades.ToInt(TextId.Text);
            Presupuesto presupuesto = PresupuestoBLL.Buscar(p => p.IdPresupuesto == id);

            if (presupuesto != null)
            {
                if (presupuesto.IdPresupuesto != 1)
                {
                    PresupuestoBLL.Eliminar(presupuesto);
                }
            }
        }
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (DescripcionTextBox.Text == "" || MontoTextBox.Text == "")
     {
         Label1.Text = "Llena el campo Nombre de Categorias";
     }
     else
     {
         Entidades.Presupuestos pre = new Entidades.Presupuestos();
         Llenar(pre);
         PresupuestoBLL.Guardar(pre);
         Label1.Text = "Registro con exito";
     }
 }
        protected void EliminarButton_Click(object sender, EventArgs e)
        {
            int id = Utilidades.TOINT(PresupuestoIdTextBox.Text);

            if (PresupuestoBLL.Eliminar(PresupuestoBLL.Buscar(p => p.PresupuestoId == id)))
            {
                Limpiar();
                //MessageBox.Show("El Presupuesto se elimino con exito.");
            }
            else
            {
                //MessageBox.Show("El Presupuesto no se pudo eliminar.");
            }
        }
        public void CargarHitorial()

        {
            PresupuestoBLL bllPresup = new PresupuestoBLL();
            List <PresupuestoAprobacionBE> Historial = new List <PresupuestoAprobacionBE>();

            Historial = bllPresup.HistorialAnalisis(vPresup);
            BindingList <PresupuestoAprobacionBE> hist = new BindingList <PresupuestoAprobacionBE>(Historial);

            this.dataGridViewAprob.DataSource = null;
            this.dataGridViewAprob.DataSource = hist;

            this.dataGridViewAprob.Columns[0].Visible = false;
        }
        private void buttonConfirmar_Click(object sender, EventArgs e)
        {
            cPresup = bllP.SeleccionarPresupuestoPorId(cPresup.Id);

            DialogResult Respuesta = MessageBox.Show("Confirma Cierre del Presupuesto?", comboBoxTipo.Text, MessageBoxButtons.YesNo);

            if (Respuesta == DialogResult.Yes)

            {
                PresupuestoTipoAprobacionBE Tipo = new PresupuestoTipoAprobacionBE();
                Tipo = bllP.SeleccionarAprobacionTipo("Cliente");
                PresupuestoAprobacionBE nAprob = new PresupuestoAprobacionBE(cPresup, Tipo, SesionSingleton.Instancia.Usuario);

                if (((comboBoxTipo.Text == "Aprobar" && cPresup.Estado.AprobacionCliente() == true)) || ((comboBoxTipo.Text == "Rechazar" && cPresup.Estado.RechazoCliente() == true)))
                {
                    nAprob.Fecha         = DateTime.Now;
                    nAprob.Accion        = comboBoxTipo.Text;
                    nAprob.Observaciones = textBoxObs.Text;
                    PresupuestoBLL bllAp = new PresupuestoBLL();

                    if (nAprob.Accion == "Aprobar")

                    {
                        PresupuestoEstadoBE nEstado = new ApCli();
                        bllAp.ActualizarEstado(cPresup, nEstado);
                    }
                    else
                    {
                        PresupuestoEstadoBE nEstado = new RechCli();
                        bllAp.ActualizarEstado(cPresup, nEstado);
                    }

                    bllAp.Cierre(nAprob);
                    MessageBox.Show("Operación realizada correctamente");
                    this.Close();
                }
                else

                {
                    MessageBox.Show("No es posible realizar el Cierre en el Estado actual");

                    BitacoraActividadBE nActividad = new BitacoraActividadBE();
                    BitacoraBLL         bllAct     = new BitacoraBLL();

                    nActividad.Detalle = "El Cierre no es posible para el Presupuesto N° " + cPresup.Id + " en el estado actual";
                    bllAct.NuevaActividad(nActividad);
                }
            }
        }
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (MontoTextBox.Text == "" || DescripcionTextBox.Text == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debes Llenar Todos los campos Señalado con (*)');</script>");
     }
     else
     {
         Entidades.Presupuestos presu = new Entidades.Presupuestos();
         LlenarClase(presu);
         PresupuestoBLL.Insertar(presu);
         Limpiar();
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Realizado satisfactoriamente');</script>");
     }
 }
Beispiel #16
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            Presupuestos presupuesto = new Presupuestos();
            int          id          = 0;

            presupuesto = Llenar();
            if (id != presupuesto.PresupuestoId)
            {
                PresupuestoBLL.Modificar(presupuesto);
            }
            else
            {
                PresupuestoBLL.Guardar(presupuesto);
            }
            Limpiar();
        }
        private void buttonConfirmar_Click(object sender, EventArgs e)
        {
            oPresup = bllP.SeleccionarPresupuestoPorId(oPresup.Id); // Actualizo datos del presupuesto

            DialogResult Respuesta = MessageBox.Show("Confirma " + comboBoxAccion.Text + "Presupuesto?", comboBoxAccion.Text, MessageBoxButtons.YesNo);

            if (Respuesta == DialogResult.Yes)

            {
                PresupuestoTipoAprobacionBE Tipo = new PresupuestoTipoAprobacionBE();
                Tipo = bllP.SeleccionarAprobacionTipo("Comercial");

                PresupuestoAprobacionBE nAprob = new PresupuestoAprobacionBE(oPresup, Tipo, SesionSingleton.Instancia.Usuario);

                if (((comboBoxAccion.Text == "Aprobar" && oPresup.Estado.AprobacionComercial() == true)) || ((comboBoxAccion.Text == "Rechazar" && oPresup.Estado.RechazoComercial() == true)))
                {
                    nAprob.Fecha         = DateTime.Now;
                    nAprob.Accion        = comboBoxAccion.Text;
                    nAprob.Observaciones = textBoxObs.Text;
                    PresupuestoBLL bllAp = new PresupuestoBLL();


                    if (nAprob.Accion == "Aprobar")

                    {
                        PresupuestoEstadoBE nEstado = new EnviarCli();
                        bllAp.ActualizarEstado(oPresup, nEstado);
                    }
                    else
                    {
                        PresupuestoEstadoBE nEstado = new ApComRech();
                        bllAp.ActualizarEstado(oPresup, nEstado);
                    }


                    bllAp.AnalisisComercial(nAprob);
                    MessageBox.Show("Operación realizada correctamente");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("No es posible realizar la acción en el Estado actual");;
                }
            }
        }
Beispiel #18
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int id          = Utilidades.TOINT(PresupuestoIdTextBox.Text);
            var presupuesto = new Presupuestos();

            presupuesto = PresupuestoBLL.Buscar(p => p.PresupuestoId == id);

            if (presupuesto != null)
            {
                DescripcionTextBox.Text = presupuesto.Descripcion;
                MontoTextBox.Text       = presupuesto.Monto.ToString();
                FechaTextBox.Text       = presupuesto.Fecha.ToString();
            }
            else
            {
                Limpiar();
            }
        }
 protected void BuscarButton_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(PresupuestoIdTextBox.Text))
     {
         int id = Utilidad.ToInt(PresupuestoIdTextBox.Text);
         presupuesto = PresupuestoBLL.Buscar(P => P.PresupuestoId == id);
         if (presupuesto != null)
         {
             CargarDatos();
             NuevoOModificando();
         }
         else
         {
             MensajeAlertaError.Text = "No encontrado";
             AlertaError.Visible     = true;
         }
     }
 }
        protected void FiltrarButton_Click(object sender, EventArgs e)
        {
            PresupuestoGridView.DataSource = PresupuestoBLL.GetListAll();

            DateTime desde = DateTime.Now;
            DateTime hasta = DateTime.Now;



            if (PresupuestoDropDownList.SelectedIndex == 0)
            {
                Lista = PresupuestoBLL.GetListAll();
                PresupuestoGridView.DataSource = Lista;
                PresupuestoGridView.DataBind();
            }
            else
            if (PresupuestoDropDownList.SelectedIndex == 1)
            {
                //FechaunoTextBox.Enabled = true;
                //FechadosTextBox.Enabled = true;


                Lista = PresupuestoBLL.GetList(p => p.Fecha >= desde.Date && p.Fecha <= hasta.Date);

                PresupuestoGridView.DataSource = Lista;
                PresupuestoGridView.DataBind();
            }
            else
            if (PresupuestoDropDownList.SelectedIndex == 2)
            {
                Lista = PresupuestoBLL.GetList(p => p.PresupuestoId == Convert.ToInt32(FiltrarTextBox));

                PresupuestoGridView.DataSource = PresupuestoBLL.GetList(p => p.Descripcion == FiltrarTextBox.Text);
                PresupuestoGridView.DataBind();
            }
            else
            if (PresupuestoDropDownList.SelectedIndex == 3)
            {
                int id = Utilidades.TOINT(FiltrarTextBox.Text);
                Lista = PresupuestoBLL.GetList(p => p.PresupuestoId == id);
                PresupuestoGridView.DataSource = PresupuestoBLL.GetList(p => p.PresupuestoId == id);
                PresupuestoGridView.DataBind();
            }
        }
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (Validar())
     {
         LlenarCamposInstancia();
         List <PresupuestoDetalle> listaRelaciones = (List <PresupuestoDetalle>)Session["ListaRelaciones"];
         if (PresupuestoBLL.Guardar(presupuesto, listaRelaciones))
         {
             PresupuestoIdTextBox.Text       = presupuesto.PresupuestoId.ToString();
             MensajeAlertaGuardadoExito.Text = "¡Guardado con éxito con el ID " + presupuesto.PresupuestoId + "!";
             AlertaGuardadoExito.Visible     = true;
             NuevoOModificando();
         }
         else
         {
             AlertaError.Visible = true;
         }
     }
     else
     {
         AlertaValidar.Visible = true;
     }
 }
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            Presupuestos presupuesto = new Presupuestos();
            int          id          = 0;

            presupuesto = Llenar();
            if (DescripcionTextBox.Text == DescripcionTextBox.Text)
            {
                if (!string.IsNullOrEmpty(DescripcionTextBox.Text))
                {
                    if (id != presupuesto.PresupuestoId)
                    {
                        PresupuestoBLL.Modificar(presupuesto);
                        //Panel1.Visible = true;
                        //MessageBox.Show("Presupuesto modificado con exito");
                    }
                    else
                    {
                        PresupuestoBLL.Guardar(presupuesto);
                        //Panel1.Visible = true;
                        //MessageBox.Show("Nuevo presupuesto agregado!");
                    }
                }
                else
                {
                    //Label5.Text = "llene los campos vacios";
                    //Panel1.Visible = true;
                }
            }
            else
            {
                /*CamposVacioserrorProvider.SetError(ClavetextBox, "Campos no son iguales");
                 * CamposVacioserrorProvider.SetError(ConfirmartextBox, "Campos no son iguales");
                 * MessageBox.Show("CAMPOS No Coinciden");*/
            }
            //UsuariosBLL.Guardar(usuario);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     ConsultaPresupuestoGridView.DataSource = PresupuestoBLL.ListarTodo();
     ConsultaPresupuestoGridView.DataBind();
 }
Beispiel #24
0
 protected void Buscar1Button_Click(object sender, EventArgs e)
 {
     BuscarPresupuesto(PresupuestoBLL.Buscar(v.String(IDTextBox.Text)));
 }