예제 #1
0
        private void MozoBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Mozo mozo = mozoBox.SelectedItem as Mozo;

            moz = mozo;
            Close();
        }
예제 #2
0
        static void Main(string[] args)
        {
            Mesa mesa = new Mesa();

            mesa.Cubiertos = 8;
            mesa.Id        = 2;

            string descripcion = mesa.Descripcion;

            // creo el bar
            Bar.Model.Bar bar = new Bar.Model.Bar();

            // agrego un mozo al bar
            //bar.Mozos.Add(new Mozo("Guille", "Filia", "26721601"));


            // reservar una mesa a las 22hs del 23/2/2019
            //mesa.Reserva = new Reserva();
            //mesa.Reserva.FechaYHora = new DateTime(2019, 2, 23, 22, 0, 0);
            //mesa.Reserva.Cliente = new Cliente();


            // imprimir el nombre del mozo que atiende a la mesa
            //System.Console.Write(mesa.MozoAsignado.Nombre);


            Mozo cliente = new Mozo("Ale", "Fraenkel", "45450650");
            var  s       = cliente.GetDescripcion();
        }
예제 #3
0
 private void btnCargar_Click(object sender, EventArgs e)
 {
     try
     {
         int  id_mozo = Convert.ToInt32(tbID.Text);
         Mozo moz     = new Mozo(id_mozo);
         if (moz.Error)
         {
             MessageBox.Show(this, moz.Mensaje, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             tbNombre.Text      = moz.Nombre;
             tbApellido.Enabled = true;
             tbApellido.Text    = moz.Apellido;
             tbApellido.Enabled = true;
             tbCalle.Text       = moz.Calle;
             tbCalle.Enabled    = true;
             tbNumero.Text      = moz.Nro.ToString();
             tbNumero.Enabled   = true;
             tbTelefono.Text    = moz.Telefono;
             tbTelefono.Enabled = true;
             tbDNI.Text         = moz.Dni;
             tbDNI.Enabled      = true;
         }
     }
     catch (Exception)
     {
         MessageBox.Show(this, "El id debe ser Nro", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
예제 #4
0
        public IList <Mozo> lista()
        {
            SqlConnection conexion = new SqlConnection("data source=DESKTOP-O7A5ID6\\SQLEXPRESS; initial catalog=TPC_Sidauy; integrated security=sspi");
            SqlCommand    comando  = new SqlCommand("select idinterno,nombre,apellido from interno where idpuesto=3", conexion);
            SqlDataReader lector;
            List <Mozo>   lista = new List <Mozo>();

            conexion.Open();
            lector = comando.ExecuteReader();

            try
            {
                while (lector.Read())
                {
                    Mozo mozo = new Mozo();
                    mozo.idinterno = lector.GetInt32(0);

                    mozo.Nombre   = lector.GetString(1);
                    mozo.Apellido = lector.GetString(2);
                    lista.Add(mozo);
                }
                return(lista);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                conexion.Close();
                conexion = null;
            }
        }
예제 #5
0
        public async Task <IActionResult> PutMozo(string id, Mozo mozo)
        {
            if (id != mozo.Id)
            {
                return(BadRequest());
            }

            _context.Entry(mozo).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MozoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
예제 #6
0
        private void AgregarMozo_Click(object sender, RoutedEventArgs e)
        {
            Mozo   mozo = new Mozo();
            Random rm   = new Random();

            string[] nombres = { "George", "Richard", "Robert", "Bob", "Pancracio", "Rigoberto" };
            mozo.nombre = nombres[rm.Next(0, 5)];
            mozos.Add(mozo);
            this.ShowMessageAsync("Mozo agregado con exito!", "Asignelo con el click derecho sobre una mesa.");
        }
예제 #7
0
        private void MostrarDatosMozo(long cuil)
        {
            Mozo mozo = CapaNegocio.Mozo.TraerUnMozo(cuil);

            txtApellido.Text    = mozo.Apellido;
            txtCuil.Text        = mozo.Cuil.ToString();
            txtDireccion.Text   = mozo.Direccion;
            txtMail.Text        = mozo.Mail;
            txtNombre.Text      = mozo.Nombre;
            dtpNacimiento.Value = mozo.Nacimiento;
        }
예제 #8
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int id = Convert.ToInt32(dgMozo.CurrentRow.Cells["id_mozo"].Value);

            if (id > 0)
            {
                if (Mozo.Eliminar(id))
                {
                    Funciones.mOk(this, "Registro eliminado correctamente");
                }
                else
                {
                    Funciones.mError(this, "Error al eliminar registro");
                }
            }
            dgMozo.DataSource = Mozo.getAll();
        }
예제 #9
0
        public void Test_AnalizarEficienciaUsoSalon_Historica()
        {
            Mozo mozoTest  = _bar.Mozos[0];
            Mesa mesaTest1 = _bar.Mesas[0];

            mesaTest1.CubiertosUtilizados = 4;
            Mesa mesaTest2 = _bar.Mesas[1];

            mesaTest2.CubiertosUtilizados = 3;
            Mesa mesaTest3 = _bar.Mesas[2];

            mesaTest3.CubiertosUtilizados = 2;
            _bar.Facturas.Add(new Factura(new DateTime(2016), mozoTest, mesaTest1, 10));
            _bar.Facturas.Add(new Factura(new DateTime(2012), mozoTest, mesaTest2, 10));
            _bar.Facturas.Add(new Factura(new DateTime(2013), mozoTest, mesaTest3, 10));

            Assert.AreEqual(2.75 / 3, _bar.ObtenerEficicienciaHistorica());
        }
예제 #10
0
        private void GuardarModificacion()
        {
            mozo.Cuil       = Convert.ToInt64(txtCuil.Text.Replace("-", ""));
            mozo.Nombre     = txtNombre.Text;
            mozo.Apellido   = txtApellido.Text;
            mozo.Direccion  = txtDireccion.Text;
            mozo.Mail       = txtMail.Text;
            mozo.Nacimiento = dtpNacimiento.Value;

            if (mozo.ModificarMozo())
            {
                CapaNegocio.Funciones.mOk(this, "Los cambios al mozo se guardaron correctamente");
                dgvMozos.DataSource = Mozo.ListarTodos();
                banderaGuardar      = true;
                Clear();
                pnlMozo.Enabled = false;
            }
            dgvMozos.DataSource = Mozo.ListarTodos();
        }
예제 #11
0
 private void MozoItem_Click(object sender, RoutedEventArgs e)
 {
     if (mozos.Any())
     {
         Mesa             mesa    = mesas.Find(x => x.ImageName == rightClicked.Name);
         Mozo             moz     = null;
         selectMozoWindow window3 = new selectMozoWindow(mozos);
         window3.ShowDialog();
         moz = window3.Moz;
         if (moz != null)
         {
             mesa.mozito = moz;
         }
         this.ShowMessageAsync("Mozo asignado con exito!", "");
     }
     else
     {
         this.ShowMessageAsync("Agregue un mozo primero!", "");
     }
 }
예제 #12
0
        public void Test_AnalizarEficienciaUsoSalon_DiaEspecifico()
        {
            DateTime fechaTest = new DateTime(2012);
            Mozo     mozoTest  = _bar.Mozos[0];
            Mesa     mesaTest1 = _bar.Mesas[0];

            mesaTest1.CubiertosUtilizados = 4;
            Mesa mesaTest2 = _bar.Mesas[1];

            mesaTest2.CubiertosUtilizados = 3;
            Mesa mesaTest3 = _bar.Mesas[2];

            mesaTest3.CubiertosUtilizados = 2;
            _bar.Facturas.Add(new Factura(fechaTest, mozoTest, mesaTest1, 10));
            _bar.Facturas.Add(new Factura(fechaTest, mozoTest, mesaTest2, 10));
            _bar.Facturas.Add(new Factura(fechaTest, mozoTest, mesaTest3, 10));

            double eficienciaDia = _bar.ObtenerEficicienciaEnDia(fechaTest);

            Assert.AreEqual(2.75 / 3, eficienciaDia);
        }
예제 #13
0
        public async Task <ActionResult <Mozo> > PostMozo(Mozo mozo)
        {
            _context.Mozos.Add(mozo);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (MozoExists(mozo.Id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetMozo", new { id = mozo.Id }, mozo));
        }
예제 #14
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     Clear();
     if (CapaNegocio.Funciones.RowSeleccionado(
             dgvMozos.SelectedRows.Count, "un mozo", "eliminarlo.", this))
     {
         pnlMozo.Enabled = false;
         if (CapaNegocio.Funciones.mConsulta(this, "¿Está seguro de que desea eliminar el mozo?"))
         {
             long cuil = Convert.ToInt64(dgvMozos.CurrentRow.Cells["cuil"].Value);
             if (Mozo.Eliminar(cuil))
             {
                 Funciones.mOk(this, "Se eliminó correctamente el mozo.");
                 dgvMozos.DataSource = Mozo.ListarTodos();
             }
             else
             {
                 Funciones.mError(this, "Error al eliminar el mozo.");
             }
         }
     }
 }
예제 #15
0
        private void btnModificar_Click_1(object sender, EventArgs e)
        {
            Clear();
            if (CapaNegocio.Funciones.RowSeleccionado(
                    dgvMozos.SelectedRows.Count, "un mozo", "ver los detalles del mismo.", this))
            {
                pnlMozo.Enabled     = true;
                btnCancelar.Enabled = true;
                btnGuardar.Enabled  = true;
                banderaGuardar      = false;

                long cuil = Convert.ToInt64(dgvMozos.CurrentRow.Cells["cuil"].Value);
                mozo = CapaNegocio.Mozo.TraerUnMozo(cuil);

                txtApellido.Text    = mozo.Apellido;
                txtCuil.Text        = mozo.Cuil.ToString();
                txtDireccion.Text   = mozo.Direccion;
                txtMail.Text        = mozo.Mail;
                txtNombre.Text      = mozo.Nombre;
                dtpNacimiento.Value = mozo.Nacimiento;
            }
        }
예제 #16
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            string dni      = tbDNI.Text.Trim();
            string nombre   = tbNombre.Text.Trim();
            string apellido = tbApellido.Text.Trim();
            string calle    = tbCalle.Text.Trim();
            int    nro      = 0;
            int    id       = Convert.ToInt32(tbID.Text);

            try
            {
                nro = Convert.ToInt32(tbNumero.Text);
            }
            catch (Exception)
            {
                MessageBox.Show(this, "Error en el número", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            string telefono = tbTelefono.Text.Trim();

            Mozo moz = new Mozo(id, dni, nombre, apellido, calle, nro, telefono);

            if (moz.Error)
            {
                Funciones.mError(this, moz.Mensaje);
            }
            else
            {
                moz.Actualizar();
                MessageBox.Show(this, "Registro actualizado correctamente");
                tbNombre.Text   = "";
                tbDNI.Text      = "";
                tbCalle.Text    = "";
                tbApellido.Text = "";
                tbNumero.Text   = "";
                tbTelefono.Text = "";
            }
            dgMozo.DataSource = Mozo.getAll();
        }
예제 #17
0
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     if (banderaGuardar)
     {
         CapaNegocio.Mozo mozo1 = new CapaNegocio.Mozo(txtNombre.Text, txtApellido.Text, txtDireccion.Text, txtMail.Text, Convert.ToInt64(txtCuil.Text.Replace("-", "")), dtpNacimiento.Value);
         if (mozo1.Error)
         {
             if (mozo1.Mensaje == "Cuil existente no activo")
             {
                 if (CapaNegocio.Funciones.mConsulta(this, "Existe un mozo no activo con este cuil, ¿Desea ver esos datos para soobreescribirlos?, de ser la respuesta no, se creara un nuevo mozo con los datos que ingreso."))
                 {
                     banderaGuardar = false;
                     MostrarDatosMozo(mozo1.Cuil);
                 }
                 else
                 {
                     GuardarModificacion();
                 }
             }
             else
             {
                 CapaNegocio.Funciones.mError(this, mozo1.Mensaje);
             }
         }
         else
         {
             CapaNegocio.Funciones.mOk(this, "Los datos del mozo se guardaron con éxito.");
             dgvMozos.DataSource = Mozo.ListarTodos();
             Clear();
             pnlMozo.Enabled = false;
         }
     }
     else
     {
         GuardarModificacion();
     }
 }
예제 #18
0
        public Frm_Mozo()
        {
            InitializeComponent();

            dgMozo.DataSource = Mozo.getAll();
        }
예제 #19
0
 public void ActualizarPantalla()
 {
     dgvMozos.DataSource    = Mozo.ListarTodos();
     pnlMozo.Enabled        = false;
     dgvMozos.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
 }