protected void GridViewGroupFamily_SelectionChanged(object sender, EventArgs e) { var familiaId = 0; if (GridViewGroupFamily.GetSelectedFieldValues("Autofamilia").Count <= 0) { return; } familiaId = (int)GridViewGroupFamily.GetSelectedFieldValues("Autofamilia").Select(c => c).FirstOrDefault(); GridViewArtículo.DataSource = ArticulosRepository.GetSelectedArticulos(familiaId); GridViewArtículo.DataBind(); }
protected void GridViewGroup_SelectionChanged(object sender, EventArgs e) { int grupo = 0; if (GridViewGroup.GetSelectedFieldValues("Grupo").Count > 0) { grupo = (int)GridViewGroup.GetSelectedFieldValues("Grupo").Select(c => c).FirstOrDefault(); } GridViewGroupFamily.DataSource = FamiliasRepository.GetFamiliaByGroup(grupo); GridViewGroupFamily.DataBind(); }
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(); }
protected void linkfamiliphoto_Init(object sender, EventArgs e) { try { ((ASPxHyperLink)sender).Text = "Foto"; GridViewDataItemTemplateContainer c = ((ASPxHyperLink)sender).NamingContainer as GridViewDataItemTemplateContainer; int rowIndex = c.VisibleIndex; var editorAuto = 0; int.TryParse(Convert.ToString(GridViewGroupFamily.GetRowValues(rowIndex, "AutoEditor")), out editorAuto); if (editorAuto > 0) { var articulosHTML = ArticulosRepository.GetArticulosHTML(editorAuto); if (articulosHTML.Any()) { ((ASPxHyperLink)sender).ClientSideEvents.Click = "function(s,e){ e.processOnServer = false; showHTMLEditor('" + editorAuto + "'); return false;}"; } else { ((ASPxHyperLink)sender).Enabled = false; ((ASPxHyperLink)sender).ClientEnabled = false; ((ASPxHyperLink)sender).Text = "-"; ((ASPxHyperLink)sender).CssClass += " hidehovercursor"; } } else { ((ASPxHyperLink)sender).Enabled = false; ((ASPxHyperLink)sender).ClientEnabled = false; ((ASPxHyperLink)sender).Text = "-"; ((ASPxHyperLink)sender).CssClass += " hidehovercursor"; } } catch (Exception ex) { ((ASPxHyperLink)sender).Enabled = false; ((ASPxHyperLink)sender).ClientEnabled = false; ((ASPxHyperLink)sender).Text = "-"; ((ASPxHyperLink)sender).CssClass += " hidehovercursor"; } }
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(); }