示例#1
0
        public void Add()
        {
            ORDENE or = new ORDENE
            {
                NOMBRE_ORDEN = "OrdenPrueba",
                ID_MESA      = 1,
                ID_MESERO    = 4
            };

            Assert.AreEqual(ordGlob.addOrden(or), 1);
        }
示例#2
0
        public void delete()
        {
            ORDENE or = new ORDENE
            {
                NOMBRE_ORDEN = "OrdenPrueba",
                ID_MESA      = 1,
                ID_MESERO    = 4
            };

            ordGlob.addOrden(or);
            Assert.AreEqual(1, ordGlob.deleteOrden(or.ID_ORDEN));
        }
示例#3
0
        public void update()
        {
            ORDENE or = new ORDENE
            {
                ID_ORDEN     = 5,
                NOMBRE_ORDEN = "Ignacio",
                ID_MESA      = 2,
                ID_MESERO    = 1
            };

            Assert.AreEqual(true, glob.updateOrden(or));
        }
示例#4
0
        public void delete()
        {
            ORDENE or = new ORDENE
            {
                NOMBRE_ORDEN = "PruebaDelete",
                ID_MESA      = 1,
                ID_MESERO    = 4
            };

            glob.addOrden(or);
            Assert.AreEqual(true, glob.deleteOrden(or.ID_ORDEN));
        }
示例#5
0
 public int addOrden(ORDENE orden)
 {
     try
     {
         using (context = new PROIVEntities())
         {
             context.ORDENES.Add(orden);
             context.SaveChanges();
         }
         return(1);
     }
     catch (Exception e)
     {
         return(0);
     }
 }
示例#6
0
 public int updateOrden(ORDENE order)
 {
     try
     {
         using (context = new PROIVEntities())
         {
             context.Entry(order).State = System.Data.Entity.EntityState.Modified;
             context.SaveChanges();
         }
         return(1);
     }
     catch (Exception)
     {
         return(0);
     }
 }
示例#7
0
 public int deleteOrden(int id)
 {
     try
     {
         ORDENE or = this.getOrder(id);
         using (context = new PROIVEntities())
         {
             context.ORDENES.Attach(or);
             context.ORDENES.Remove(or);
             context.SaveChanges();
         }
         return(1);
     }
     catch (Exception e)
     {
         return(0);
     }
 }
 public bool updateOrden(ORDENE orden)
 {
     try
     {
         int prueb = glob.updateOrden(orden);
         if (prueb == 1)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#9
0
        public void update()
        {
            ORDENE or = new ORDENE
            {
                ID_ORDEN     = 5,
                NOMBRE_ORDEN = "OrdenPrueba",
                ID_MESA      = 1,
                ID_MESERO    = 4
            };

            ordGlob.addOrden(or);
            ORDENE ord = new ORDENE
            {
                ID_ORDEN     = 5,
                NOMBRE_ORDEN = "PruebaUpdate",
                ID_MESA      = 2,
                ID_MESERO    = 3
            };

            Assert.AreEqual(1, ordGlob.updateOrden(ord));
        }
        private void terminarBtn_Click(object sender, EventArgs e)
        {
            try
            {
                idMesa   = Int32.Parse(cmbMesa.Text);
                idMesero = Int32.Parse(cmbMesero.Text);

                MESERO mesero = meseroGlob.obtenerMeseroPorID(idMesero);
                ORDENE orden  = new ORDENE
                {
                    ID_MESA      = idMesa,
                    ID_MESERO    = idMesero,
                    NOMBRE_ORDEN = mesero.NOMBRE_MESERO
                };
                using (context = new PROIVEntities())
                {
                    var num_orden = context.Database.SqlQuery <decimal>("SELECT IDENT_CURRENT('ORDENES')").FirstOrDefault();
                    numerOrden = (int)num_orden + 1;
                }
                for (int i = 0; i < tablaProductos.RowCount; i++)
                {
                    int idProducto = Int32.Parse(tablaProductos.Rows[i].Cells[0].Value.ToString());

                    PRODUCTO_X_ORDEN pxo = new PRODUCTO_X_ORDEN
                    {
                        ID_ORDEN          = numerOrden,
                        ID_PRODUCTO       = idProducto,
                        CANTIDAD_PRODUCTO = 1
                    };
                    pxoGlob.addProdxOrd(pxo);
                }
                ordenGlob.addOrden(orden);
                MessageBox.Show("Orden registrada");
                this.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Hubo un error");
            }
        }
示例#11
0
        public void search()
        {
            ORDENE ord = ordGlob.getOrder(3);

            Assert.AreEqual(ord.ID_ORDEN, 3);
        }
示例#12
0
        public void search()
        {
            ORDENE or = glob.getOrden(1);

            Assert.AreEqual("Gabriel", or.NOMBRE_ORDEN);
        }