示例#1
0
 public ContentController(ApplicationDbContext context)
 {
     data = new DataRetriver(context);
 }
示例#2
0
        private void Create_callback()
        {
            DataRetriver creationDialog = new DataRetriver(repo, null, DataRetriverCancelActions.CLOSE);

            creationDialog.ShowDialog();
        }
示例#3
0
        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);
            }
        }