示例#1
0
    protected void btnsearchArticulo_Click(object sender, EventArgs e)
    {
        var preciosGroupRepository = new PreciosGroupRepository();

        GridViewGroupFamily.SearchPanelFilter = "";
        GridViewArtículo.SearchPanelFilter    = "";
        GridViewGroup.FocusedRowIndex         = 0;
        GridViewGroup.DataSource = preciosGroupRepository.GetAllPreciosGroup();
        GridViewGroup.DataBind();
        GridViewGroup.Selection.SelectRow(0);
        GridViewGroup.MakeRowVisible(0);
        GridViewGroupFamily.FocusedRowIndex = 0;
        GridViewGroupFamily.DataSource      = FamiliasRepository.GetFamiliaByGroup();
        GridViewGroupFamily.DataBind();
        GridViewGroupFamily.MakeRowVisible(0);
        GridViewGroupFamily.Selection.SelectRow(0);
        GridViewArtículo.DataSource = ArticulosRepository.GetSelectedArticulos();
        GridViewArtículo.DataBind();
    }
示例#2
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");
            }
        }
        Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "$(document).ready(function () { SetSize();});", true);

        var preciosGroupRepository = new PreciosGroupRepository();
        int grupo     = 0;
        int familiaId = 0;

        if (!Page.IsPostBack)
        {
            Session["SelectedArticle"] = null;
            if (!string.IsNullOrEmpty(Request.QueryString["sp"]))
            {
                var articulosList = ArticulosRepository.GetAllArticuloDetail(Request.QueryString["sp"]);
                foreach (var articulos in articulosList)
                {
                    if (articulos.Dto == -1)
                    {
                        articulos.Dto = 0;
                    }

                    articulos.Neto       = CommonFunction.Redondear(articulos.Precio - (articulos.Precio * articulos.Dto / 100), 2);
                    articulos.PrecioIgic = CommonFunction.Redondear(articulos.Precio + (articulos.Precio * articulos.PercenImpuesto / 100), 2);
                    articulos.NetoIgic   = CommonFunction.Redondear(articulos.Neto + (articulos.Neto * articulos.PercenImpuesto / 100), 2);
                }

                Session["SelectedArticle"]           = articulosList;
                GridViewPresupuestoActual.DataSource = articulosList;
                GridViewPresupuestoActual.DataBind();
            }
            pcHTMLEditor.ShowOnPageLoad = false;
        }

        GridViewGroup.DataSource = preciosGroupRepository.GetAllPreciosGroup();
        GridViewGroup.DataBind();

        if (GridViewGroup.FocusedRowIndex > 0 && GridViewGroup.GetSelectedFieldValues("Grupo").Count > 0)
        {
            grupo = (int)GridViewGroup.GetSelectedFieldValues("Grupo").Select(c => c).FirstOrDefault();
        }

        GridViewGroupFamily.DataSource = FamiliasRepository.GetFamiliaByGroup(grupo);
        GridViewGroupFamily.DataBind();

        //if (GridViewGroupFamily.FocusedRowIndex > -1 && GridViewGroupFamily.GetSelectedFieldValues("Autofamilia").Count > 0)
        if (GridViewGroupFamily.FocusedRowIndex > -1 && GridViewGroupFamily.GetRow(GridViewGroupFamily.FocusedRowIndex) != null)
        {
            var rowLvalue = (Familias)GridViewGroupFamily.GetRow(GridViewGroupFamily.FocusedRowIndex);
            familiaId = rowLvalue.Autofamilia;
        }
        GridViewArtículo.DataSource = ArticulosRepository.GetSelectedArticulos(FamiliaId: familiaId);
        GridViewArtículo.DataBind();
    }