internal override List <ButtonCallback> GetButtons() { List <ButtonCallback> buttons = new List <ButtonCallback>(); ButtonCallback create = new ButtonCallback("Crear nuevo", Create_callback); buttons.Add(create); return(buttons); }
public PanelController(IRepo repo, DataLister view) { this.repo = repo; this.view = view; panel = new Panel(); buttonPanel = new Panel(); buttonsList = new List <ButtonCallback>(); panel.Size = new Size(700, 90); //esta funcion arma los paneles BuildPanel(); List <IFilter> filters = GetFilters(); int ypos = 10; int xpos = 10; for (int i = 0; i < filters.Count; i++) { Panel filterInput = filters[i].GetFilter(); filterInput.Location = new Point(xpos, ypos); panel.Controls.Add(filterInput); ypos = ypos + filterInput.Size.Height + 25; if (ypos > 70) { ypos = 10; xpos = xpos + 250; } } ButtonCallback searchButton = new ButtonCallback("Buscar", SearchCallback); ButtonCallback clearButton = new ButtonCallback("Limpiar", ClearCallback); buttonsList.Add(searchButton); buttonsList.Add(clearButton); foreach (ButtonCallback button in GetButtons()) { buttonsList.Add(button); } this.view.SetPanelController(this); SqlCommand cmd = Database.BeginTransaction(); try { view.UpdateDataList(cmd); Database.CommitTransaction(cmd); }catch (Exception e) { Database.RollbackTransaction(cmd); PopUpDialog dialog = new PopUpDialog("Error", "Hubo un error obteniendo listado."); throw e; } }