public IActionResult ModalReceta(string idReceta)
        {
            Receta receta = new Receta();

            CocinaService cocinaService = new CocinaService();

            Int32 recetaID = 0;

            try
            {
                recetaID = Int32.Parse(idReceta);
            }
            catch (Exception)
            {
                recetaID = 121;
            }

            receta = cocinaService.getRecetaById(recetaID);

            List <Ingrediente> ingredientes = new List <Ingrediente>();

            cocinaService = null;

            cocinaService = new CocinaService();

            ingredientes = cocinaService.getIngredientesByIdReceta(receta.IdReceta);

            ViewData["Datos"]        = recetaID;
            ViewData["receta"]       = receta;
            ViewData["ingredientes"] = ingredientes;

            return(View());
        }
Esempio n. 2
0
        public IActionResult ModalAnularGarzon(string idOrden, String respuesta)
        {
            Orden orden = new Orden();


            CocinaService cocinaService = new CocinaService();

            Int32 ordenID = 0;

            try
            {
                ordenID       = Int32.Parse(idOrden);
                orden.IdOrden = ordenID;
            }
            catch (Exception)
            {
                ordenID = 121;
            }

            if (respuesta == null || respuesta == "")
            {
                ViewData["respuesta"] = respuesta;
            }


            ViewData["orden"] = orden;

            return(View());
        }
        public void TestPrepararPlato()
        {
            IBascula basculaService = new BasculaService();
            ICocina  cocinaService  = new CocinaService();

            TurbomixService sut        = new TurbomixService(basculaService, cocinaService);
            Alimento        mAlimento1 = new Alimento();

            mAlimento1.Nombre = "Curry";
            mAlimento1.Peso   = 1.5F;
            Alimento mAlimento2 = new Alimento();

            mAlimento2.Nombre = "Queso";
            mAlimento2.Peso   = 5F;
            Receta mReceta = new Receta();

            mReceta.NombreAlimento1 = "Curry";
            mReceta.NombreAlimento2 = "Queso";
            mReceta.Peso1           = 1.5F;
            mReceta.Peso2           = 5F;

            Plato resultado = sut.PrepararPlato(mAlimento1, mAlimento2, mReceta);

            Assert.IsTrue(resultado is Plato);
        }
Esempio n. 4
0
        public void TestCocinar()
        {
            ICocina  sut = new CocinaService();
            Alimento uno = new Alimento();
            Alimento dos = new Alimento();

            sut.Cocinar(uno, dos);

            Assert.IsTrue(uno.cocinado && dos.cocinado);
        }
Esempio n. 5
0
        public void TestMethod1()
        {
            Alimento alimento1 = new Alimento();
            Alimento alimento2 = new Alimento();
            ICocina  sut       = new CocinaService();

            sut.Calentar(alimento1, alimento2);
            Assert.IsTrue(alimento1.Calentado);
            Assert.IsTrue(alimento2.Calentado);
        }
Esempio n. 6
0
        public void CalentarTest()
        {
            ICocinaService sut       = new CocinaService();
            Alimento       alimento1 = new Alimento();
            Alimento       alimento2 = new Alimento();

            sut.Calentar(alimento1, alimento2);

            Assert.IsTrue(alimento1.Calentado);
            Assert.IsTrue(alimento2.Calentado);
        }
Esempio n. 7
0
        public void TestCalentar()
        {
            ICocinaService sut = new CocinaService();
            Alimento       a   = new Alimento();
            Alimento       b   = new Alimento();

            sut.Calentar(a, b);

            Assert.IsTrue(a.calentado);//Verifica de una vez que ambos estan calentados(El mismo tipo de verificación)
            Assert.IsTrue(b.calentado);
        }
Esempio n. 8
0
        public void TestCalentarAlimentos()
        {
            Alimento lechuga = new Alimento();
            Alimento tomate  = new Alimento();

            ICocina sut = new CocinaService();

            sut.CalentarAlimentos(lechuga, tomate);

            Assert.IsTrue(lechuga.Calentado);
            Assert.IsTrue(tomate.Calentado);
        }
Esempio n. 9
0
        public void init()
        {
            IBascula basculaService = new BasculaService();
            ICocina  cocinaService  = new CocinaService();

            sut              = new TurboMixService(basculaService, cocinaService);
            alimento1        = new Alimentos();
            alimento1.Nombre = "patata";
            alimento1.peso   = 25;

            alimento2        = new Alimentos();
            alimento2.Nombre = "zanahoria";
            alimento2.peso   = 35;
        }
        public void TestPrepararPlatoConReceta()
        {
            IBascula basculaService = new BasculaService();
            ICocina  cocinaService  = new CocinaService();

            TurbomixService sut        = new TurbomixService(basculaService, cocinaService);
            Alimento        mAlimento1 = new Alimento(0.2f, false);

            mAlimento1.Nombre = "Curry";
            Alimento mAlimento2 = new Alimento(0.4f, false);

            mAlimento2.Nombre = "Queso";

            Receta receta = new Receta(mAlimento1, mAlimento2);

            sut.PrepararPlatoConReceta(mAlimento1, mAlimento2, receta);
        }
        public void init()
        {
            IBasculaService basculaService = new BasculaService();
            ICocinaService  cocinaService  = new CocinaService();

            sut                 = new TurboMixService(basculaService, cocinaService);
            alimento1           = new Alimento();
            alimento1.Peso      = 1.5f;
            alimento1.Calentado = true;
            alimento2           = new Alimento();
            alimento2.Peso      = 5f;
            alimento2.Calentado = true;

            alimentoCocinado1           = new Alimento();
            alimentoCocinado1.Peso      = 1.5f;
            alimentoCocinado1.Calentado = true;
            alimentoCocinado2           = new Alimento();
            alimentoCocinado2.Peso      = 5f;
            alimentoCocinado2.Calentado = true;
        }
        public void TestPrepararPlato()
        {
            IBasculaService basculaService = new BasculaService();
            ICocinaService  cocinaService  = new CocinaService();

            TurbomixService sut        = new TurbomixService(basculaService, cocinaService, null);
            Alimento        mAlimento1 = new Alimento();

            mAlimento1.Nombre = "Curry";
            mAlimento1.Peso   = 1.5F;
            Alimento mAlimento2 = new Alimento();

            mAlimento2.Nombre = "Queso";
            mAlimento1.Peso   = 5F;

            Plato resultado = sut.PrepararPlato(mAlimento1, mAlimento2);

            Plato mPlato = new Plato(mAlimento1, mAlimento2);

            Assert.AreEqual(mPlato, resultado);
        }
        public void TestPrepararPlato()
        {
            IBascula basculaService = new BasculaService();
            ICocina  cocinaService  = new CocinaService();

            TurbomixService sut        = new TurbomixService(basculaService, cocinaService);
            Alimento        mAlimento1 = new Alimento();

            mAlimento1.Nombre = "Espagueti";
            mAlimento1.Peso   = 1.5F;
            Alimento mAlimento2 = new Alimento();

            mAlimento2.Nombre = "Tomate";
            mAlimento1.Peso   = 5F;

            Receta recetaEspaguetis = new Receta(mAlimento1, mAlimento2);

            Plato resultado = sut.PrepararPlato(mAlimento1, mAlimento2, recetaEspaguetis);

            Plato mPlato = new Plato(mAlimento1, mAlimento2);

            Assert.AreEqual(mPlato, resultado);
        }
        public void Init()
        {
            IBasculaService basculaService = new BasculaService();
            ICocinaService  cocinaService  = new CocinaService();

            sut               = new TurbomixService(basculaService, cocinaService, null);
            mAlimento1        = new Alimento();
            mAlimento1.Nombre = "Curry";
            mAlimento1.Peso   = 1.5F;
            mAlimento2        = new Alimento();
            mAlimento2.Nombre = "Queso";
            mAlimento2.Peso   = 5F;

            mAlimentoReceta1           = new Alimento();
            mAlimentoReceta1.Nombre    = "Curry";
            mAlimentoReceta1.Peso      = 1.4F;
            mAlimentoReceta1.Calentado = true;
            mAlimentoReceta2           = new Alimento();
            mAlimentoReceta2.Nombre    = "Queso";
            mAlimentoReceta2.Peso      = 3F;
            mAlimentoReceta2.Calentado = true;

            receta = new Receta(mAlimentoReceta1, mAlimentoReceta2);
        }
        public IActionResult Index()
        {
            //CARGAR LAS ORDENES DEL MAIN   async-Nombre
            Electron.IpcMain.On("async-receta", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                CocinaService cocinaService = new CocinaService();

                try
                {
                    List <OrdenCocina> ordenesCocina = cocinaService.getOrdenesByEstadoEnCocina();

                    cocinaService = null;

                    cocinaService = new CocinaService();


                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta", cocinaService.completarOrden(ordenesCocina));
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta", ex.Message);
                }
            });


            //CARGAR LAS ORDENES DEL MAIN   async-Nombre
            Electron.IpcMain.On("async-receta-cantidad", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                CocinaService cocinaService = new CocinaService();

                try
                {
                    List <OrdenCocina> ordenesCocina = cocinaService.getOrdenesByEstadoEnCocina();

                    cocinaService = null;

                    cocinaService = new CocinaService();

                    List <OrdenCocina> ordenes = cocinaService.completarOrden(ordenesCocina);

                    List <RecetaCantidad> recetaCantidad = cocinaService.obtenerRecetasWithCantidad(ordenes);

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-cantidad", recetaCantidad);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-cantidad", ex.Message);
                }
            });

            //completar la orden
            Electron.IpcMain.On("async-receta-completarOrden", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                CocinaService cocinaService = new CocinaService();

                try
                {
                    int idOrden = int.Parse(args.ToString());

                    int result = cocinaService.completarOrden(idOrden);

                    if (result == 1)
                    {
                        cocinaService = null;

                        cocinaService = new CocinaService();

                        Notificacion notificacion = new Notificacion();

                        notificacion.Descripcion = $"La orden Número: {args.ToString()} esta lista para llevar a mesa.";

                        notificacion.Asunto = "Cocina: Orden Lista Para Servir";

                        Rol rol = new Rol();

                        rol.Id_rol = 4;

                        notificacion.Rol = rol;

                        int resultNotificacion = cocinaService.insertarNotificacion(notificacion);

                        if (resultNotificacion == 1)
                        {
                            //carga una notificacion
                            var options = new NotificationOptions("Orden Completa", "La orden Número: " + args + " fue notificada a garzón para llevar a mesa.")
                            {
                                OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync("La orden Número: " + args + " fue notificada a garzón para llevar a mesa, Puedes ver los detalles en la opción de notificaciones"),
                                Icon    = "~/images/clienteCerdos.png"
                            };

                            Electron.Notification.Show(options);
                            //termina de cargar una notificacion
                        }
                    }
                    else
                    {
                        throw new Exception();
                    }

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-completarOrden", "listo");
                }
                catch (Exception ex)
                {
                    //carga una notificacion
                    var options = new NotificationOptions("Error", "Algo mal ocurrio")
                    {
                        OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync("Sorry"),
                        Icon    = "/images/cerdito.png"
                    };

                    Electron.Notification.Show(options);
                    //termina de cargar una notificacion

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-completarOrden", ex.Message);
                }
            });
            //fin completar la orden



            //cargar el modal
            Electron.IpcMain.On("modalReceta-window", async(argument) =>
            {
                //carga el puerto disponible
                string viewPath = $"http://localhost:{BridgeSettings.WebPort}/cocina/modalreceta?idReceta={argument}";

                var optionsWindows = new BrowserWindowOptions
                {
                    Frame = false
                };
                await Electron.WindowManager.CreateWindowAsync(optionsWindows, viewPath);
            });
            //cargar un modal



            return(View());
        }
Esempio n. 16
0
        public IActionResult Index()
        {
            //CARGAR
            Electron.IpcMain.On("async-pagarOrden-clientes", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    List <Cliente> clientes = pagarOrdenService.getClienteMesa();

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-clientes", clientes);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-clientes", ex.Message);
                }
            });


            //CARGAR
            Electron.IpcMain.On("async-pagarOrden-clienteDetalle", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    int idCliente = int.Parse(args.ToString());

                    Cliente cliente = pagarOrdenService.getClienteApagar(idCliente);

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-clienteDetalle", cliente);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-clienteDetalle", ex.Message);
                }
            });

            //CARGAR
            Electron.IpcMain.On("async-pagarOrden-totalOrdenClienteDetalle", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    int idCliente = int.Parse(args.ToString());

                    int total = pagarOrdenService.getClienteApagarTotalOrden(idCliente);

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-totalOrdenClienteDetalle", total);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-totalOrdenClienteDetalle", ex.Message);
                }
            });

            //CARGAR
            Electron.IpcMain.On("async-pagarOrden-totalPagarClienteDetalle", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    int idCliente = int.Parse(args.ToString());

                    int total = pagarOrdenService.getClienteTotalApagarOrden(idCliente);

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-totalPagarClienteDetalle", total);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-totalOrdenClienteDetalle", ex.Message);
                }
            });


            Electron.IpcMain.On("information-dialog-cambiarTotalPagar", async(args) =>
            {
                var options = new MessageBoxOptions("¿Seguro que desea cambiar el valor total a pagar del cliente?")
                {
                    Type    = MessageBoxType.info,
                    Title   = "Informatión",
                    Buttons = new string[] { "Si", "No" }
                };

                var result = await Electron.Dialog.ShowMessageBoxAsync(options);

                var mainWindow = Electron.WindowManager.BrowserWindows.First();
                Electron.IpcMain.Send(mainWindow, "information-dialog-reply-cambiarTotalPagar", result.Response);
            });


            //CARGAR
            Electron.IpcMain.On("async-pagarOrden-pagarClienteOrdenes", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                int result = 1;

                try
                {
                    int idCliente = int.Parse(args.ToString());

                    result = pagarOrdenService.pagar(idCliente);

                    if (result == 1)
                    {
                        //carga una notificacion
                        var options = new NotificationOptions("Exito", "Cliente marcado como confirmado y sus ordenes pagadas")
                        {
                            OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync(""),
                            Icon    = "/images/cerdito.png"
                        };

                        Electron.Notification.Show(options);
                        //termina de cargar una notificacion
                    }
                    else
                    {
                        //carga una notificacion
                        var options = new NotificationOptions("Error", "Algo esta pasando")
                        {
                            OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync(""),
                            Icon    = "/images/cerdito.png"
                        };
                        Electron.Notification.Show(options);
                        //termina de cargar una notificacion
                    }

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-pagarClienteOrdenes", result);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-pagarClienteOrdenes", ex.Message);
                }
            });


            //pagar personalizaso
            Electron.IpcMain.On("async-pagarOrden-pagarClientePersonalizado", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                int result = -1;

                try
                {
                    Boleta boleta = new Boleta();


                    List <Boleta> boletas = ((JArray)args).Select(x => new Boleta
                    {
                        IdBoleta         = (int)x["id_cliente"],
                        MontoExtra       = (int)x["valor_a_pagar"],
                        Operacion        = (int)x["operacion"],
                        MotivoMontoExtra = (string)x["motivo"]
                    }).ToList();



                    boleta = boletas[0];


                    result = pagarOrdenService.pagarPersonalizado(boleta);

                    if (result == 1)
                    {
                        //carga una notificacion
                        var options = new NotificationOptions("Exito", "Cliente marcado como confirmado y sus ordenes pagadas")
                        {
                            OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync(""),
                            Icon    = "/images/cerdito.png"
                        };

                        Electron.Notification.Show(options);
                        //termina de cargar una notificacion
                    }
                    else
                    {
                        //carga una notificacion
                        var options = new NotificationOptions("Error", "Algo esta pasando")
                        {
                            OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync(""),
                            Icon    = "/images/cerdito.png"
                        };
                        Electron.Notification.Show(options);
                        //termina de cargar una notificacion
                    }

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-pagarClientePersonalizado", result);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-pagarClientePersonalizado", ex.Message);
                }
            });



            //CARGAR ordenes del cliente
            Electron.IpcMain.On("async-pagarOrden-ordenesClienteInbox", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    //
                    //FALTAAAAAAAAAAAAAAAAA
                    //
                    //

                    int idCliente = int.Parse(args.ToString());

                    int total = pagarOrdenService.getClienteTotalApagarOrden(idCliente);

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-ordenesClienteInbox", total);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pagarOrden-ordenesClienteInbox", ex.Message);
                }
            });


            //CARGAR LAS ORDENES DEL MAIN   async-Nombre  cliente
            Electron.IpcMain.On("async-receta-pagarOrden-cliente", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                CocinaService cocinaService = new CocinaService();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    int idCliente = int.Parse(args.ToString());


                    List <OrdenCocina> ordenesCocina = pagarOrdenService.getOrdenesByCliente(idCliente);



                    cocinaService = null;

                    cocinaService = new CocinaService();


                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-pagarOrden-cliente", cocinaService.completarOrden(ordenesCocina));
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-pagarOrden-cliente", ex.Message);
                }
            });


            //buscar los clientes
            Electron.IpcMain.On("async-receta-pagarOrden-buscarCliente", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();


                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    string busqueda = args.ToString();

                    List <Cliente> resultados = pagarOrdenService.getClienteMesaBuscar(busqueda);

                    pagarOrdenService = null;

                    pagarOrdenService  = new PagarOrdenService();
                    List <Cliente> all = pagarOrdenService.getClienteMesa();


                    List <Cliente> final = pagarOrdenService.completarClienteBusqueda(resultados, all, busqueda);

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-pagarOrden-buscarCliente", final);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-pagarOrden-buscarCliente", ex.Message);
                }
            });



            //cargar el modal
            Electron.IpcMain.On("modalReceta-pagarOrden-window", async(argument) =>
            {
                //carga el puerto disponible
                string viewPath = $"http://localhost:{BridgeSettings.WebPort}/PagarOrden/modalrecetapago?idReceta={argument}";

                var optionsWindows = new BrowserWindowOptions
                {
                    Frame = false
                };
                await Electron.WindowManager.CreateWindowAsync(optionsWindows, viewPath);
            });
            //cargar un modal



            return(View());
        }
        public IActionResult Notificacion()
        {
            //CARGAR LAS ORDENES DEL MAIN   async-Nombre
            Electron.IpcMain.On("async-de-cocina-notify", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                CocinaService cocinaService = new CocinaService();

                try
                {
                    List <Notificacion> notificacionsDe = cocinaService.getNotificacionDeCocina();

                    cocinaService = null;

                    cocinaService = new CocinaService();

                    List <Notificacion> notificacionsPara = cocinaService.getNotificacionParaCocina();

                    List <Notificacion> notificacions = cocinaService.obtenerTodasNotificacionesOrdenFecha(notificacionsDe, notificacionsPara);


                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-de-cocina-notify", notificacions);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-de-cocina-notify", ex.Message);
                }
            });


            //CARGAR LAS ORDENES DEL MAIN   async-Nombre
            Electron.IpcMain.On("async-cocina-notify-leido", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                CocinaService cocinaService = new CocinaService();

                try
                {
                    int idNotificacion = int.Parse(args.ToString());

                    int result = cocinaService.cambiarEstadoNotificacion(idNotificacion);

                    if (result == 1)
                    {
                        //carga una notificacion
                        var options = new NotificationOptions("Exito", "Notificación marcada como leída")
                        {
                            OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync(""),
                            Icon    = "/images/cerdito.png"
                        };

                        Electron.Notification.Show(options);
                        //termina de cargar una notificacion
                    }

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-cocina-notify-leido", result);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-cocina-notify-leido", ex.Message);
                }
            });


            return(View());
        }
        public IActionResult Index()
        {
            //CARGAR  los clientes
            Electron.IpcMain.On("async-pedirOrdenGarzon-clientes", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    List <Cliente> clientes = pagarOrdenService.getClienteMesa();

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pedirOrdenGarzon-clientes", clientes);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pedirOrdenGarzon-clientes", ex.Message);
                }
            });

            //CARGAR cliente
            Electron.IpcMain.On("async-pedirOrdenGarzon-clienteDetalle", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    int idCliente = int.Parse(args.ToString());

                    Cliente cliente = pagarOrdenService.getClienteApagar(idCliente);

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pedirOrdenGarzon-clienteDetalle", cliente);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pedirOrdenGarzon-clienteDetalle", ex.Message);
                }
            });

            //CARGAR LAS ORDENES DEl cliente
            Electron.IpcMain.On("async-pedirOrdenGarzon-ordenes-cargar", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                CocinaService cocinaService = new CocinaService();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    int idCliente = int.Parse(args.ToString());


                    List <OrdenCocina> ordenesCocina = pagarOrdenService.getOrdenesByCliente(idCliente);


                    cocinaService = null;

                    cocinaService = new CocinaService();


                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pedirOrdenGarzon-ordenes-cargar", cocinaService.completarOrden(ordenesCocina));
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pedirOrdenGarzon-ordenes-cargar", ex.Message);
                }
            });

            //buscar los clientes
            Electron.IpcMain.On("async-receta-pedirOrdenGarzon-buscarCliente", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();


                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    string busqueda = args.ToString();

                    List <Cliente> resultados = pagarOrdenService.getClienteMesaBuscar(busqueda);

                    pagarOrdenService = null;

                    pagarOrdenService  = new PagarOrdenService();
                    List <Cliente> all = pagarOrdenService.getClienteMesa();


                    List <Cliente> final = pagarOrdenService.completarClienteBusqueda(resultados, all, busqueda);

                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-pedirOrdenGarzon-buscarCliente", final);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-receta-pedirOrdenGarzon-buscarCliente", ex.Message);
                }
            });


            //CARGAR
            Electron.IpcMain.On("async-pedirOrden-eliminarCliente", (args) =>
            {
                var mainWindow = Electron.WindowManager.BrowserWindows.First();

                PagarOrdenService pagarOrdenService = new PagarOrdenService();

                try
                {
                    int idCliente = int.Parse(args.ToString());

                    Cliente cliente = new Cliente();

                    cliente.IdCliente = idCliente;

                    int exito = pagarOrdenService.eliminarClienteById(cliente);


                    if (exito == 1)
                    {
                        //carga una notificacion
                        var options = new NotificationOptions("Exito", "Cliente número " + idCliente + " fue eliminado")
                        {
                            OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync(""),
                            Icon    = "/images/cerdito.png"
                        };

                        Electron.Notification.Show(options);
                        //termina de cargar una notificacion
                    }
                    else
                    {
                        //carga una notificacion
                        var options = new NotificationOptions("Error", "Algo mal paso")
                        {
                            OnClick = async() => await Electron.Dialog.ShowMessageBoxAsync(""),
                            Icon    = "/images/cerdito.png"
                        };
                        Electron.Notification.Show(options);
                        //termina de cargar una notificacion
                    }


                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pedirOrden-eliminarCliente", cliente);
                }
                catch (Exception ex)
                {
                    Electron.IpcMain.Send(mainWindow, "asynchronous-reply-pedirOrden-eliminarCliente", ex.Message);
                }
            });


            return(View());
        }