Пример #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] != null)
        {
            TopMenu.Visible    = false; //Login
            LogingMenu.Visible = true;  //Logout
        }
        else
        {
            TopMenu.Visible    = true;  //Login
            LogingMenu.Visible = false; //Logout
            if (!HttpContext.Current.Request.Url.AbsoluteUri.Contains("login"))
            {
                if (Page.IsCallback)
                {
                    ASPxWebControl.RedirectOnCallback("/Account/login.aspx");
                }
                else
                {
                    Response.Redirect("/Account/login.aspx");
                }
            }
        }

        DateTime?defecha = null;
        DateTime?afecha  = null;

        if (!Page.IsPostBack)
        {
            Session["buttonclick"] = "date";
            defecha = Convert.ToDateTime(fechahoy.ToString("01/MMM/yyy"));
            afecha  = Convert.ToDateTime(DateTime.DaysInMonth(fechahoy.Year, fechahoy.Month) + "/" + fechahoy.Month + "/" + fechahoy.Year);
        }

        if ((dtfromDate.Date != null || dttoDate.Date != null) && Convert.ToString(Session["buttonclick"]) == "date")
        {
            defecha = dtfromDate.Date;
            afecha  = dttoDate.Date;
        }

        var Cliente = (Clientes)Session["User"];

        GridViewFacturas.DataSource = FacturasRepository.GetAllFacturas("", Cliente.AutoCliente, defecha, afecha);
        GridViewFacturas.DataBind();

        string SerieFactura = string.Empty;

        if (GridViewFacturas.GetSelectedFieldValues("SerieFactura").Count > 0)
        {
            SerieFactura = Convert.ToString(GridViewFacturas.GetSelectedFieldValues("SerieFactura").Select(c => c).FirstOrDefault());
        }
        else
        {
            SerieFactura = Convert.ToString(GridViewFacturas.GetRowValues(0, "SerieFactura"));
        }
        GridViewFacturasDetail.DataSource = FacturasRepository.GetFacturasDetail(SerieFactura);
        GridViewFacturasDetail.DataBind();
    }
Пример #2
0
    protected void GridViewFacturas_CustomCallback(object sender, DevExpress.Web.ASPxGridViewCustomCallbackEventArgs e)
    {
        var Cliente = (Clientes)Session["User"];

        if (Cliente == null)
        {
            if (Page.IsCallback)
            {
                ASPxWebControl.RedirectOnCallback("/Account/login.aspx");
            }
            else
            {
                Response.Redirect("/Account/login.aspx");
            }
        }
        if (e.Parameters.Contains("searchalbaran"))
        {
            Session["buttonclick"]      = "searchalbaran";
            GridViewFacturas.DataSource = FacturasRepository.GetAllFacturas("", Cliente.AutoCliente, null, null);
        }
        else if (e.Parameters.Contains("searchfectura"))
        {
            Session["buttonclick"]      = "searchfectura";
            GridViewFacturas.DataSource = FacturasRepository.GetAllFacturas(searchfectura.Text, Cliente.AutoCliente, null, null);
        }
        else if (e.Parameters.Contains("date"))
        {
            Session["buttonclick"]      = "date";
            GridViewFacturas.DataSource = FacturasRepository.GetAllFacturas("", Cliente.AutoCliente, dtfromDate.Date, dttoDate.Date);
        }
        else
        {
            Session["buttonclick"]      = "showall";
            GridViewFacturas.DataSource = FacturasRepository.GetAllFacturas("", Cliente.AutoCliente, null, null);
        }
        GridViewFacturas.DataBind();
    }
Пример #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["User"] == null)
        {
            if (Page.IsCallback)
            {
                ASPxWebControl.RedirectOnCallback("/Account/login.aspx");
            }
            else
            {
                Response.Redirect("/Account/login.aspx");
            }
        }


        //       if (Request.Browser.IsMobileDevice)
        //       {
        //           if (Page.IsCallback)
        //           {
        //              ASPxWebControl.RedirectOnCallback("/mobile/Facturas.aspx");
        //          }
        //          else
        //          {
        //              Response.Redirect("/mobile/Facturas.aspx");
        //          }

        //      }
        DateTime?defecha = null;
        DateTime?afecha  = null;

        if (!Page.IsPostBack)
        {
            Session["buttonclick"] = "date";
            defecha = Convert.ToDateTime(fechahoy.ToString("01/MMM/yyy"));
            afecha  = Convert.ToDateTime(DateTime.DaysInMonth(fechahoy.Year, fechahoy.Month) + "/" + fechahoy.Month + "/" + fechahoy.Year);
        }

        if ((dtfromDate.Date != null || dttoDate.Date != null) && Convert.ToString(Session["buttonclick"]) == "date")
        {
            defecha = dtfromDate.Date;
            afecha  = dttoDate.Date;
        }

        var Cliente = (Clientes)Session["User"];

        GridViewFacturas.DataSource = FacturasRepository.GetAllFacturas("", Cliente.AutoCliente, defecha, afecha);
        GridViewFacturas.DataBind();

        string SerieFactura = string.Empty;

        if (GridViewFacturas.GetSelectedFieldValues("SerieFactura").Count > 0)
        {
            SerieFactura = Convert.ToString(GridViewFacturas.GetSelectedFieldValues("SerieFactura").Select(c => c).FirstOrDefault());
        }
        else
        {
            SerieFactura = Convert.ToString(GridViewFacturas.GetRowValues(0, "SerieFactura"));
        }
        GridViewFacturasDetail.DataSource = FacturasRepository.GetFacturasDetail(SerieFactura);
        GridViewFacturasDetail.DataBind();
    }