示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utilidades.SCritpValidacion();
            Lista = BLL.FacturaBLL.GetListodo();
            FacturaGrid.DataSource = Lista;
            FacturaGrid.DataBind();

            buscaText.Focus();

            buscaText.Focus();
            calcular();
            if (!Page.IsPostBack)
            {
                LlenarDrop();
            }
        }
 protected void BindGrid()
 {
     FacturaGrid.DataSource = (DataTable)ViewState["Detalle"];
     FacturaGrid.DataBind();
 }
示例#3
0
        public void Selecionar(int id)
        {
            if (DropFiltro.SelectedIndex == 0)
            {
                buscaText.Text = "";
                if (Lista.Count == 0)
                {
                    Utilidades.ShowToastr(this, "No se ha registrado Factura", "Resultados", "error");

                    buscaText.Text = "";
                    buscaText.Focus();
                }
                else
                {
                    Lista = BLL.FacturaBLL.GetListodo();
                    FacturaGrid.DataSource = Lista;
                    Utilidades.ShowToastr(this, "Sus Resultados", "Resultados", "success");
                    calcular();
                }
            }
            else if (DropFiltro.SelectedIndex == 1)
            {
                Lista = BLL.FacturaBLL.GetList(p => p.IdFactura == id);

                if (Lista.Count == 0)
                {
                    Utilidades.ShowToastr(this, "No existe categoria con este ID", "Resultados", "error");

                    buscaText.Text = "";
                    buscaText.Focus();
                }
                else
                {
                    FacturaGrid.DataSource = Lista;
                    FacturaGrid.DataBind();
                    Utilidades.ShowToastr(this, "Sus Resultados", "Resultados", "success");
                    calcular();
                }
            }


            else if (DropFiltro.SelectedIndex == 2)
            {
                if (desdeFecha.Text == "" && desdeFecha.Text == "")
                {
                    Utilidades.ShowToastr(this, "Fecha Invalidad", "Error", "warning");

                    hastaFecha.Text = "";
                    desdeFecha.Text = "";
                    desdeFecha.Focus();
                }
                else
                {
                    DateTime desde = DateTime.Now;
                    DateTime hasta = DateTime.Now;
                    if (desdeFecha.Text == "")
                    {
                        Utilidades.ShowToastr(this, "Fecha Invalidad", "Error", "warning");
                        hastaFecha.Text = "";
                        desdeFecha.Text = "";
                        desdeFecha.Focus();
                    }
                    else
                    {
                        desde = Convert.ToDateTime(desdeFecha.Text);
                        hasta = Convert.ToDateTime(hastaFecha.Text);
                    }


                    if (desdeFecha.Text != "" && hastaFecha.Text != "")
                    {
                        if (desde <= hasta)
                        {
                            Lista = BLL.FacturaBLL.GetList(p => p.FechaVenta >= desde.Date && p.FechaVenta <= hasta.Date);
                            FacturaGrid.DataSource = Lista;
                            FacturaGrid.DataBind();
                            Utilidades.ShowToastr(this, "Sus Resultados", "Resultados", "success");
                            calcular();
                        }
                        else
                        {
                            Utilidades.ShowToastr(this, "Fecha Debe ser menor", "Consejo", "info");
                            desdeFecha.Text = "";
                            hastaFecha.Text = "";
                            desdeFecha.Focus();
                        }
                    }
                    else
                    {
                        Utilidades.ShowToastr(this, "Ingrese Fecha", "Consejo", "info");
                        desdeFecha.Focus();
                    }
                }
            }



            else if (DropFiltro.SelectedIndex == 3)
            {
                Lista = BLL.FacturaBLL.GetList(p => p.Cliente == DropUsuario.Text);


                if (Lista.Count == 0)
                {
                    Utilidades.ShowToastr(this, "No existe factura realizada por ese usuario", "Resultados", "error");

                    buscaText.Text = "";
                    buscaText.Focus();
                }
                else
                {
                    FacturaGrid.DataSource = Lista;
                    FacturaGrid.DataBind();
                    Utilidades.ShowToastr(this, "Sus Resultados", "Resultados", "success");
                    calcular();
                }
            }
        }