Esempio n. 1
0
        private bool UbicarPlato(string Texto)
        {
            List <Plato> T = new List <Plato>();

            T = FactoryPlatos.getItems(Texto);
            switch (T.Count)
            {
            case 0:
                MessageBox.Show("Plato no Encontrado", "Atencion", MessageBoxButtons.OK, MessageBoxIcon.Error);
                mPlato = new Plato();
                return(false);

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

            default:
                FrmBuscarEntidades F = new FrmBuscarEntidades();
                F.BuscarPlatos(Texto);
                mPlato = (Plato)F.registro;
                if (mPlato == null)
                {
                    mPlato = new Plato();
                }
                break;
            }
            LeerPlato(false);
            return(true);
        }
Esempio n. 2
0
        void btnCargarReceta_Click(object sender, EventArgs e)
        {
            Plato p = new Plato();
            FrmBuscarEntidades f = new FrmBuscarEntidades();

            f.BuscarPlatos("");
            if (f.DialogResult != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            p = (Plato)f.registro;
            foreach (PlatosIngrediente item in p.PlatosIngredientes)
            {
                PlatosIngrediente nuevo = new PlatosIngrediente();
                nuevo.Cantidad           = item.Cantidad;
                nuevo.CostoRacion        = item.CostoRacion;
                nuevo.IdIngrediente      = item.IdIngrediente;
                nuevo.Ingrediente        = item.Ingrediente;
                nuevo.Raciones           = item.Raciones;
                nuevo.Total              = item.Total;
                nuevo.UnidadMedida       = item.UnidadMedida;
                nuevo.IdPlatoIngrediente = FactoryContadores.GetMax("IdPlatoIngrediente");
                registro.PlatosIngredientes.Add(nuevo);
            }
            this.platosIngredienteBindingSource.ResetBindings(true);
        }
        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);
        }
        void MesaTextEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            FrmBuscarEntidades f = new FrmBuscarEntidades();

            f.BuscarMesasDisponibles("");
            if (f.registro != null)
            {
                Mesa item = (Mesa)f.registro;
                newMesa = item;
                newMesaAbierta.IdMesa = item.IdMesa;
                newMesaAbierta.Mesa   = item.Descripcion;
            }
        }
Esempio n. 5
0
        void MesaButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            FrmBuscarEntidades F = new FrmBuscarEntidades();

            F.BuscarMesas("");
            if (F.registro != null)
            {
                mesa = (Mesa)F.registro;
            }
            else
            {
                mesa = new Mesa();
            }
            this.MesaButtonEdit.Text = mesa.Descripcion;
        }
Esempio n. 6
0
        void MesoneroButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            FrmBuscarEntidades F = new FrmBuscarEntidades();

            F.BuscarMesoneros("");
            if (F.registro != null)
            {
                mesonero = (Usuario)F.registro;
            }
            else
            {
                mesonero = new Usuario();
            }
            this.MesoneroButtonEdit.Text = mesonero.Nombre;
        }
Esempio n. 7
0
        void CedulaRifButtonEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            FrmBuscarEntidades F = new FrmBuscarEntidades();

            F.BuscarProveedores("");
            if (F.registro != null)
            {
                proveedor = (Proveedore)F.registro;
                proveedor = FactoryProveedores.Item(proveedor.CedulaRif);
                LeerProveedor();
            }
            else
            {
                proveedor = new Proveedore();
            }
        }
Esempio n. 8
0
        void CedulaRifTextEdit_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            FrmBuscarEntidades F = new FrmBuscarEntidades();

            F.BuscarProveedores("");
            if (F.registro != null)
            {
                registro.CedulaRif         = ((Proveedore)F.registro).CedulaRif;
                registro.NombreRazonSocial = ((Proveedore)F.registro).RazonSocial;
            }
            else
            {
                registro.CedulaRif         = null;
                registro.NombreRazonSocial = null;
            }
        }
Esempio n. 9
0
        void txtPlato_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender;
            string Texto = Editor.Text;

            Editor.Text = "";
            Plato plato          = new Plato();
            FrmBuscarEntidades F = new FrmBuscarEntidades();

            F.BuscarPlatos(Texto);
            if (F.registro != null)
            {
                plato = (Plato)F.registro;
            }
            else
            {
                return;
            }
        }
Esempio n. 10
0
        void CedulaRifButtonEdit_Validating(object sender, CancelEventArgs e)
        {
            DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender;
            if (!Editor.IsModified)
            {
                return;
            }
            string Texto = Editor.Text;

            this.compraBindingSource.EndEdit();
            List <Proveedore> T = FactoryProveedores.getItems(Texto);

            switch (T.Count)
            {
            case 0:
                proveedor           = new Proveedore();
                proveedor.CedulaRif = Basicas.CedulaRif(Texto);
                break;

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

            default:
                FrmBuscarEntidades F = new FrmBuscarEntidades();
                F.BuscarProveedores(Texto);
                if (F.registro != null)
                {
                    proveedor = (Proveedore)F.registro;
                    proveedor = FactoryProveedores.Item(proveedor.CedulaRif);
                }
                else
                {
                    proveedor = null;
                }
                break;
            }
            LeerProveedor();
        }
Esempio n. 11
0
        void CedulaRifTextEdit_Validating(object sender, CancelEventArgs e)
        {
            DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender;
            if (!Editor.IsModified)
            {
                return;
            }
            string            Texto = Editor.Text;
            List <Proveedore> T     = FactoryProveedores.getItems(Texto);

            switch (T.Count)
            {
            case 0:
                Editor.Text = Basicas.CedulaRif(Texto);
                break;

            case 1:
                registro.CedulaRif         = T[0].CedulaRif;
                registro.NombreRazonSocial = T[0].RazonSocial;
                break;

            default:
                FrmBuscarEntidades F = new FrmBuscarEntidades();
                F.BuscarProveedores(Texto);
                if (F.registro != null)
                {
                    registro.CedulaRif         = ((Proveedore)F.registro).CedulaRif;
                    registro.NombreRazonSocial = ((Proveedore)F.registro).RazonSocial;
                }
                else
                {
                    registro.CedulaRif         = null;
                    registro.NombreRazonSocial = null;
                }
                break;
            }
        }
Esempio n. 12
0
        void txtPlato_Validating(object sender, CancelEventArgs e)
        {
            DevExpress.XtraEditors.TextEdit Editor = (DevExpress.XtraEditors.TextEdit)sender;
            if (!Editor.IsModified)
            {
                return;
            }
            Plato  plato = new Plato();
            string Texto = Editor.Text;

            Editor.Text = "";
            List <Plato> T = FactoryPlatos.getItems(Texto);

            switch (T.Count)
            {
            case 0:
                return;

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

            default:
                FrmBuscarEntidades F = new FrmBuscarEntidades();
                F.BuscarPlatos(Texto);
                if (F.registro != null)
                {
                    plato = (Plato)F.registro;
                }
                else
                {
                    return;
                }
                break;
            }
            AgregarItem(plato);
        }
Esempio n. 13
0
        void toolRecuperar_Click(object sender, EventArgs e)
        {
            FrmBuscarEntidades f = new  FrmBuscarEntidades();

            f.BuscarCompras("");
            if (f.DialogResult == System.Windows.Forms.DialogResult.Abort)
            {
                using (var db = new DatosEntities())
                {
                    var x = (from item in db.Compras
                             where item.IdCompra == ((Compra)(f.registro)).IdCompra
                             select item).FirstOrDefault();
                    if (x != null)
                    {
                        db.Compras.DeleteObject(x);
                        db.SaveChanges();
                        return;
                    }
                }
            }
            if (f.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                if (f.registro != null)
                {
                    Limpiar();
                    registro = FactoryCompras.Item(db, ((Compra)f.registro).IdCompra);
                    compraBindingSource.DataSource = registro;
                    compraBindingSource.ResetBindings(true);
                    comprasIngredienteBindingSource.DataSource = registro.ComprasIngredientes;
                    comprasIngredienteBindingSource.ResetBindings(true);
                    proveedor = FactoryProveedores.Item(registro.CedulaRif);
                    esNuevo   = false;
                    //   registro.Estatus = "ABIERTA";
                }
            }
        }