コード例 #1
0
 private void Busqueda()
 {
     db    = new DatosEntities();
     Lista = FactoryIngredientes.getItems(db, this.txtBuscar.Text);
     this.bs.DataSource = Lista;
     this.bs.ResetBindings(true);
 }
コード例 #2
0
 void  FrmIngredientesItem_Load(object sender, EventArgs e)
 {
     this.KeyPreview      = true;
     this.KeyDown        += new KeyEventHandler(Frm_KeyDown);
     this.Aceptar.Click  += new EventHandler(Aceptar_Click);
     this.Cancelar.Click += new EventHandler(Cancelar_Click);
     this.GrupoComboBoxEdit.Properties.Items.AddRange(FactoryIngredientes.getArrayGrupos());
     this.UnidadMedidaTextEdit.Properties.Items.AddRange(FactoryIngredientes.getArrayUnidadesMedida());
 }
コード例 #3
0
        private void Busqueda()
        {
            dc    = new RestaurantEntities();
            Texto = this.txtBuscar.Text;
            switch (myLayout.ToUpper())
            {
            case "CLIENTES":
                this.bindingSource.DataSource = FactoryClientes.getItems(dc, Texto);
                break;

            case "MESONEROS":
                this.bindingSource.DataSource = FactoryUsuarios.getItems(dc, Texto, "MESONERO");
                break;

            case "ADMINISTRADORES":
                this.bindingSource.DataSource = FactoryUsuarios.getItems(dc, Texto, "ADMINISTRADOR");
                break;

            case "CAJEROS":
                this.bindingSource.DataSource = FactoryUsuarios.getItems(dc, Texto, "CAJERO");
                break;

            case "MESAS":
                this.bindingSource.DataSource = FactoryMesas.getItems(dc, Texto);
                break;

            case "PLATOS":
                this.bindingSource.DataSource = FactoryPlatos.getItems(dc, Texto);
                break;

            case "COMPRAS":
                this.bindingSource.DataSource = FactoryCompras.getComprasEspera(dc, Texto);
                break;

            case "FACTURAS":
                this.bindingSource.DataSource = FactoryFacturas.getFacturasPendientes(dc, Texto);
                break;

            case "INGREDIENTES":
                this.bindingSource.DataSource = FactoryIngredientes.getItems(dc, Texto);
                break;

            case "PROVEEDORES":
                this.bindingSource.DataSource = FactoryProveedores.getItems(dc, Texto);
                break;

            case "MESAS DISPONIBLES":
                this.bindingSource.DataSource = FactoryMesas.getMesasDisponibles(dc);
                break;
            }
            this.gridControl1.DataSource = this.bindingSource;
            gridControl1.ForceInitialize();
            gridView1.OptionsLayout.Columns.Reset();
            this.gridControl1.DefaultView.RestoreLayoutFromXml(Application.StartupPath + "\\Layouts\\" + myLayout + ".XML", DevExpress.Utils.OptionsLayoutGrid.FullLayout);
        }
コード例 #4
0
 void btnGuardar_Click(object sender, EventArgs e)
 {
     this.bs.EndEdit();
     foreach (IngredientesInventario i in Lista)
     {
         Ingrediente item = FactoryIngredientes.Item(i.IdIngrediente);
         i.Ajuste        = i.InventarioFisico - i.Final;
         item.Existencia = i.InventarioFisico;
     }
     this.db.SaveChanges();
 }
コード例 #5
0
        private bool UbicarProducto(string Texto)
        {
            List <Ingrediente> T = new List <Ingrediente>();

            T = FactoryIngredientes.getItems(Texto);
            switch (T.Count)
            {
            case 0:
                if (MessageBox.Show("Producto no Encontrado, Desea crear uno nuevo", "Atencion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes)
                {
                    ingrediente = new Ingrediente();
                    return(false);
                }
                FrmIngredientesItem nuevo = new FrmIngredientesItem();
                nuevo.descripcion = Texto;
                nuevo.Incluir();
                if (nuevo.DialogResult == DialogResult.OK)
                {
                    using (var db = new DatosEntities())
                    {
                        nuevo.registro.IdIngrediente = FactoryContadores.GetMax("IdIngrediente");
                        db.Ingredientes.AddObject(nuevo.registro);
                        db.SaveChanges();
                    }
                }
                if (nuevo.DialogResult == DialogResult.OK)
                {
                    ingrediente = nuevo.registro;
                }
                else
                {
                    ingrediente = new Ingrediente();
                    return(false);
                }
                break;

            case 1:
                ingrediente = T[0];
                break;

            default:
                FrmBuscarEntidades F = new FrmBuscarEntidades();
                F.BuscarIngredientes(Texto);
                ingrediente = (Ingrediente)F.registro;
                if (ingrediente == null)
                {
                }
                break;
            }
            registro.Costo      = ingrediente.Costo;
            registro.IdProducto = ingrediente.IdIngrediente;
            registro.Producto   = ingrediente.Descripcion;
            return(true);
        }
コード例 #6
0
        public void ListadoInventarios()
        {
            List <Ingrediente> lista = FactoryIngredientes.getItemsConInventario();

            lista = (from x in lista
                     orderby x.Grupo, x.Descripcion
                     select x).ToList();
            reportViewer1.ProcessingMode = ProcessingMode.Local;
            this.reportViewer1.LocalReport.ReportPath = Application.StartupPath + "\\Reportes\\ListadoInventarios.rdlc";
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Ingredientes", lista));
            this.reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Parametros", new Parametro[] { Basicas.parametros() }));
            this.reportViewer1.LocalReport.SetParameters(new ReportParameter("TotalInventarios", lista.Sum(x => x.CostoTotal).Value.ToString("n2")));
            this.reportViewer1.RefreshReport();
            this.ShowDialog();
        }
コード例 #7
0
 void CargarNuevosProductos()
 {
     foreach (var ingrediente in FactoryIngredientes.getItemsConInventario())
     {
         IngredientesInventario item = Lista.FirstOrDefault(x => x.IdIngrediente == ingrediente.IdIngrediente);
         if (item == null)
         {
             IngredientesInventario nuevoItem = new IngredientesInventario();
             nuevoItem.Ajuste                  = 0;
             nuevoItem.Entradas                = 0;
             nuevoItem.FechaInicio             = DateTime.Today;
             nuevoItem.Grupo                   = ingrediente.Grupo;
             nuevoItem.IdIngrediente           = ingrediente.IdIngrediente;
             nuevoItem.IdIngredienteInventario = FactoryContadores.GetMax("IdIngredienteInventario");
             nuevoItem.Ingrediente             = ingrediente.Descripcion;
             nuevoItem.Inicio                  = ingrediente.Existencia.GetValueOrDefault(0);
             nuevoItem.Salidas                 = 0;
             nuevoItem.Final                   = nuevoItem.Inicio + nuevoItem.Entradas - nuevoItem.Salidas;
             nuevoItem.InventarioFisico        = nuevoItem.Final;
             db.IngredientesInventarios.Add(nuevoItem);
         }
     }
     db.SaveChanges();
 }