public void Test_List() { var context = GetMockGitDB (); var exampleArticle = new ExampleArticle (); var json = exampleArticle.ToJson (); var filePath = Path.Combine(Environment.CurrentDirectory, exampleArticle.TypeName + "-" + exampleArticle.Id); File.WriteAllText (filePath, json); var idsFilePath = Path.GetFullPath (exampleArticle.TypeName + "-Ids"); File.WriteAllText (idsFilePath, exampleArticle.Id); var typesFilePath = Path.GetFullPath (context.TypeManager.TypesFileName); var typeEntry = exampleArticle.TypeName + ":" + exampleArticle.GetType ().FullName + ", " + exampleArticle.GetType ().Assembly.GetName ().Name; File.WriteAllText (typesFilePath, typeEntry); var lister = new DataLister (context.Settings, context.TypeManager, context.IdManager, context.Reader); var articles = lister.Get<ExampleArticle> (); Assert.AreEqual (1, articles.Length); Assert.IsNotNull (articles [0]); Assert.AreEqual (exampleArticle.Id, articles [0].Id); }
public void SelectCallback() { DataLister r = contoller.view; //r.DisableButtons(); r.ShowDialog(); btn.Text = r.SelectedEntity.GetNaturalIdentifier(); }
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; } }
public BuyController(IRepo repo, DataLister view, Client cliente) : base(repo, view) { this.cli = cliente; this.view = view; string text = "Credito disponible: " + cli.Credit.ToString(); credit.SetText(text); cantidad.SetMin(1); }
public AbmRolController(IRepo repo, DataLister view) : base(repo, view) { this.repo = repo; }
public AbmProvidersContoller(IRepo repo, DataLister view) : base(repo, view) { this.repo = repo; }
public static void ActivatePanels(this UserType u, TabControl tabs, SqlCommand connection, User user) { if (u == UserType.Administrador) { //ABM rol TabPage abmRol = new TabPage("ABM rol"); TabPage abmClients = new TabPage("ABM clientes"); TabPage abmProviders = new TabPage("ABM proveedores"); TabPage facturar = new TabPage("Facturacion Proveedor"); TabPage listado = new TabPage("Listado estadistico"); DataLister d = new DataLister(); DataLister clientList = new DataLister(); DataLister providersList = new DataLister(); FacturacionView facturacionView = new FacturacionView(user); Listado listadoView = new Listado(); d.TopLevel = false; d.Visible = true; d.FormBorderStyle = FormBorderStyle.None; d.Dock = DockStyle.Fill; clientList.TopLevel = false; clientList.Visible = true; clientList.FormBorderStyle = FormBorderStyle.None; clientList.Dock = DockStyle.Fill; providersList.TopLevel = false; providersList.Visible = true; providersList.FormBorderStyle = FormBorderStyle.None; providersList.Dock = DockStyle.Fill; facturacionView.TopLevel = false; facturacionView.Visible = true; facturacionView.FormBorderStyle = FormBorderStyle.None; facturacionView.Dock = DockStyle.Fill; listadoView.Visible = true; listadoView.TopLevel = false; listadoView.FormBorderStyle = FormBorderStyle.None; listadoView.Dock = DockStyle.Fill; AbmRolController filters = new AbmRolController(new RolRepo(), d); AbmClientsController clients = new AbmClientsController(new ClientRepo(), clientList); AbmProvidersContoller providers = new AbmProvidersContoller(new ProviderRepo(), providersList); abmRol.Controls.Add(d); abmClients.Controls.Add(clientList); abmProviders.Controls.Add(providersList); facturar.Controls.Add(facturacionView); listado.Controls.Add(listadoView); tabs.TabPages.Add(abmRol); tabs.TabPages.Add(abmClients); tabs.TabPages.Add(abmProviders); tabs.TabPages.Add(facturar); tabs.TabPages.Add(listado); } if (u == UserType.Cliente) { TabPage credito = new TabPage("Carga credito"); TabPage oferta = new TabPage("Comprar oferta"); CreditCharge d = new CreditCharge(user); DataLister ofertasListado = new DataLister(); d.TopLevel = false; d.Visible = true; d.FormBorderStyle = FormBorderStyle.None; d.Dock = DockStyle.Fill; ofertasListado.TopLevel = false; ofertasListado.Visible = true; ofertasListado.FormBorderStyle = FormBorderStyle.None; ofertasListado.Dock = DockStyle.Fill; credito.Controls.Add(d); void inner(object sender, EventArgs e) { ofertasListado.DataLister_GotFocus(null, null); d.CreditCharge_GotFocus(null, null); } tabs.Selected += inner; oferta.Controls.Add(ofertasListado); BuyController buy = new BuyController(new OfferRepo(), ofertasListado, user.GetClient()); tabs.TabPages.Add(credito); tabs.TabPages.Add(oferta); } if (u == UserType.Proveedor) { TabPage cargar = new TabPage("Carga oferta"); TabPage bajar = new TabPage("Entrega/Consumo cupon"); DataRetriver cargador = new DataRetriver(new OfferRepo(), null, DataRetriverCancelActions.CLEAN); BajaCupon baja = new BajaCupon(user); cargador.TopLevel = false; cargador.Visible = true; cargador.FormBorderStyle = FormBorderStyle.None; cargador.Dock = DockStyle.Fill; baja.TopLevel = false; baja.Visible = true; baja.FormBorderStyle = FormBorderStyle.None; baja.Dock = DockStyle.Fill; cargar.Controls.Add(cargador); bajar.Controls.Add(baja); tabs.TabPages.Add(cargar); tabs.TabPages.Add(bajar); } }