private void btnSalvar_Click(object sender, EventArgs e)
        {
            if (!ValidarCampos())
            {
                MessageBox.Show("Existem campos não preenchidos");
                return;
            }

            DialogResult dialogResult = MessageBox.Show("Deseja salvar?", "Salvando...", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.No)
            {
                return;
            }
            List <GastosTO> gastoListaTO = new List <GastosTO>();

            if (gastosTO != null)
            {
                PreencherValoresSalvar();
                gastoListaTO.Add(gastosTO);
            }

            try
            {
                GastosBLL gastosBLL = new GastosBLL();
                gastosBLL.Save(gastoListaTO);

                VerificarProcessoDepoisSalvar();
            }
            catch (Exception ex)
            {
                LoggerUtil.ErrorLog(ex.Message, ex);
                MessageBox.Show("Erro ao salvar os dados.");
            }
        }
        private bool ValidarBuscar()
        {
            if (GastosBLL.Buscar(String(BuscarTextBox.Text)) == null)
            {
                base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('No Existe');</script>");
                return(false);
            }

            return(true);
        }
Beispiel #3
0
 protected void BusquedaButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text == "")
     {
         Utilidades.ShowToastr(this, "Debes Llenar el Campo Id  ", "Advertencia", "Warning");
     }
     else
     {
         BuscarGastos(GastosBLL.Buscarbtn(Utilidades.TOINT(IdTextBox.Text)));
     }
 }
 protected void BuscarButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text == "")
     {
         base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debes llenar el campo Id para realizar la busqueda!');</script>");
     }
     else
     {
         BuscarGasto(GastosBLL.Buscar(String(IdTextBox.Text)));
     }
 }
Beispiel #5
0
 public void BuscarGastos(Gastos gt)
 {
     if (GastosBLL.Buscarbtn(Utilidades.TOINT(IdTextBox.Text)) == null)
     {
         Utilidades.ShowToastr(this, "No Existe", "Que Mal", "Error");
     }
     else
     {
         ConceptoTextBox.Text = gt.Concepto;
         MontoTextBox.Text    = Convert.ToString(gt.Monto);
     }
 }
 public void BuscarGasto(Entidades.Gastos g)
 {
     if (GastosBLL.Buscar(String(IdTextBox.Text)) == null)
     {
         base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('No Existe');</script>");
     }
     else
     {
         VendedorIdTextBox.Text = Convert.ToString(g.VendedorId);
         ConceptoTextBox.Text   = g.Concepto;
         g.Fecha           = Convert.ToDateTime(FechaTextBox.Text);
         MontoTextBox.Text = Convert.ToString(g.Monto);
     }
 }
        /*
         * Alteração de gastos
         */
        public void Alterar(GastosTO objGastosTO)
        {
            GastosBLL gastoBLL = new GastosBLL();

            this.gastosTO = gastoBLL.SelectScalar(objGastosTO.ID_GASTOS);

            if (gastosTO != null)
            {
                PreencherValoresTela(gastosTO);
                gastosTO.StatusBD = StatusTransacao.Update;
            }

            this.ShowDialog();
        }
 protected void GuardarButton_Click(object sender, EventArgs e)
 {
     if (ConceptoTextBox.Text == "" || MontoTextBox.Text == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debes Llenar Todos los Campos');</script>");
     }
     else
     {
         Entidades.Gastos gasto = new Entidades.Gastos();
         LlenarClase(gasto);
         GastosBLL.Insertar(gasto);
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Proceso Completado');</script>");
         Limpiar();
     }
 }
        public void Excluir(GastosTO objGastosTO)
        {
            GastosBLL gastoBLL = new GastosBLL();

            this.gastosTO = gastoBLL.SelectScalar(objGastosTO.ID_GASTOS);

            if (gastosTO != null)
            {
                PreencherValoresTela(gastosTO);
                gastosTO.StatusBD = StatusTransacao.Delete;
            }

            DesabilitarComponentes();
            this.ShowDialog();
        }
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            List <GastosTO> listaGastosSalvar = new List <GastosTO>();

            ControlarTelaSalvar();

            foreach (DataGridViewRow row in dgvGrid.Rows)
            {
                if (row == null)
                {
                    continue;
                }

                GastosTO gasto = new GastosTO();

                string local     = String.Empty;
                string valor     = String.Empty;
                string data      = String.Empty;
                string tipoGasto = String.Empty;

                local     = row.Cells["colLocal"].Value.ToString();
                valor     = row.Cells["colValor"].Value.ToString();
                data      = row.Cells["colData"].Value.ToString();
                tipoGasto = row.Cells["colTipoGasto"].Value.ToString();

                gasto.LOCAL          = local;
                gasto.VALOR          = Convert.ToDecimal(valor);
                gasto.DATA           = OutrosUtil.StringToDate(data);
                gasto.ID_TIPO_GASTOS = Convert.ToInt32(tipoGasto);
                gasto.StatusBD       = StatusTransacao.Insert;

                listaGastosSalvar.Add(gasto);
            }

            try
            {
                GastosBLL gastosBLL = new GastosBLL();
                gastosBLL.Save(listaGastosSalvar);


                MessageBox.Show("Dados Salvos com Sucesso!");
                IniciarTela();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        protected void GuardarButton_Click(object sender, EventArgs e)
        {
            if (ConceptoTextBox.Text == "" || MontoTextBox.Text == "")
            {
                Utilidades.ShowToastr(this, "Completar Campos (*)  ", "Advertencia", "Warning");
            }
            else
            {
                Entidades.Gastos gasto = new Entidades.Gastos();
                LlenarClase(gasto);
                GastosBLL.Insertar(gasto);

                Utilidades.ShowToastr(this, "Guardado con Exitos", "Exito", "success");
                Limpiar();
            }
        }
 protected void AnularButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text == "")
     {
         Utilidades.ShowToastr(this, "Debes Llenar el Campo Id  ", "Advertencia", "Warning");
     }
     else
     {
         if (GastosBLL.Buscarbtn(Utilidades.TOINT(IdTextBox.Text)) == null)
         {
             Utilidades.ShowToastr(this, "No Existe", "Que Mal", "Error");
         }
         else
         {
             GastosBLL.Eliminar(Utilidades.TOINT(IdTextBox.Text));
             Utilidades.ShowToastr(this, "Proceso Completado", "Exito", "success");
         }
     }
 }
 protected void AnularButton_Click(object sender, EventArgs e)
 {
     if (IdTextBox.Text == "")
     {
         Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debes Llenar el Campo Id');</script>");
     }
     else
     {
         if (GastosBLL.Buscar(String(IdTextBox.Text)) == null)
         {
             Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('No existe ');</script>");
         }
         else
         {
             GastosBLL.Eliminar(String(IdTextBox.Text));
             Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Proceso Completado');</script>");
         }
     }
 }
Beispiel #14
0
        private void BuscarDados()
        {
            GastosBLL gastosBLL = new GastosBLL();
            var       filtro    = Filtro();

            try
            {
                var listaGastos = gastosBLL.SelectAll(filtro);

                if (listaGastos.Count == 0)
                {
                    MessageBox.Show("Nenhum gasto encontrado nesse período");
                    return;
                }

                preencherGrid(listaGastos);
            }
            catch (Exception ex)
            {
                LoggerUtil.ErrorLog(ex.Message, ex);
                MessageBox.Show("Erro ao buscar os dados.");
            }
        }
        /*
         * Inicia a comunicação com o banco de dados
         */
        private void BuscarDados()
        {
            //Se houver dados na grid de detlhes, limpa
            if (listaGastosDetalhe != null)
            {
                listaGastosDetalhe.Clear();
            }

            //Verifica os filtros de tela
            var filtro = Filtro();


            GastosBLL gastosBLL = new GastosBLL();
            //Busca os dados agrupados por tipo do gasto
            var listaGastosMaster = gastosBLL.getSomatorioPorTipo(filtro);

            if (listaGastosMaster.Count == 0)
            {
                MessageBox.Show("Nenhum gasto encontrado nesse período");
                return;
            }

            try
            {
                //Busca dos dados da grid de detalhes com o filtro de tela, para permanecer em memória
                listaGastosDetalhe = gastosBLL.SelectAll(filtro);
            }
            catch (Exception ex)
            {
                LoggerUtil.ErrorLog(ex.Message, ex);
                MessageBox.Show("Erro ao buscar os dados.");
            }

            //Popula a grid master
            PreencherGridMaster(listaGastosMaster);
        }
        private void BuscarSelecCombo()
        {
            Listas = null;

            if (FiltrarDropDownList.SelectedIndex == 0)
            {
                Listas = BLL.GastosBLL.GetListTodo();
            }
            else if (FiltrarDropDownList.SelectedIndex == 1)
            {
                if (BuscarTextBox.Text == "")
                {
                    base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debe de Insertar la descripcion');</script>");
                }
                else
                {
                    int Busqueda = Utilidades.TOINT(BuscarTextBox.Text);
                    Listas = GastosBLL.GetList(p => p.GastoId == Busqueda);
                    ConsultaClienteGridView.DataSource = Listas;
                    ConsultaClienteGridView.DataBind();
                }
            }
            else if (FiltrarDropDownList.SelectedIndex == 2)
            {
                if (BuscarTextBox.Text == "")
                {
                    base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debe de Insertar la descripcion');</script>");
                }
                else
                {
                    int Busqueda = Utilidades.TOINT(BuscarTextBox.Text);
                    Listas = GastosBLL.GetList(p => p.VendedorId == Busqueda);
                    ConsultaClienteGridView.DataSource = Listas;
                    ConsultaClienteGridView.DataBind();
                }
            }
            else if (FiltrarDropDownList.SelectedIndex == 3)
            {
                if (DesdeTextBox.Text != "" && HastaTextBox.Text != "")
                {
                    DateTime desde = Convert.ToDateTime(DesdeTextBox.Text);
                    DateTime hasta = Convert.ToDateTime(HastaTextBox.Text);
                    if (desde <= hasta)
                    {
                        Listas = BLL.GastosBLL.GetList(p => p.Fecha >= desde && p.Fecha <= hasta);
                    }
                    else
                    {
                        base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Orden Cronologico mal seleccionado, la primera fecha debe ser menor que la segunda.');</script>");
                        Listas = null;
                    }
                }
                else
                {
                    base.Page.ClientScript.RegisterStartupScript(this.GetType(), "scripts", "<script>alert('Debes insertar la fecha');</script>");
                    Listas = null;
                }
            }
            ConsultaClienteGridView.DataSource = Listas;
            ConsultaClienteGridView.DataBind();
        }