public async Task <JsonResult> GetDineForPrinting(int hotelId, string dineId, List <int> dineMenuIds)
        {
            string connStr = await YummyOnlineManager.GetHotelConnectionStringById(hotelId);

            var tHotel = new YummyOnlineManager().GetHotelForPrintingById(hotelId);

            Task <Dine> tDine = null;

            if (dineId == "00000000000000")
            {
                tDine = generateTestDine();
            }
            else
            {
                tDine = new HotelManager(connStr).GetDineForPrintingById(dineId, dineMenuIds);
            }

            var tPrinterFormat = new HotelManager(connStr).GetPrinterFormatForPrinting();
            var tUser          = new YummyOnlineManager().GetUserForPrintingById((await tDine).UserId);

            return(Json(new DineForPrinting {
                Hotel = await tHotel,
                Dine = await tDine,
                User = await tUser,
                PrinterFormat = await tPrinterFormat
            }));
        }
Exemple #2
0
        public async Task <JsonResult> GetAllDineIds(int hotelId, DateTime?dateTime)
        {
            dateTime = dateTime ?? DateTime.Now;

            string connStr = await YummyOnlineManager.GetHotelConnectionStringById(hotelId);

            return(Json(await new HotelManager(connStr).GetAllDineIds(dateTime.Value)));
        }
        public async Task <JsonResult> GetPrintersForPrinting(int hotelId)
        {
            string connStr = await YummyOnlineManager.GetHotelConnectionStringById(hotelId);

            var manager = new HotelManager(connStr);

            return(Json(new PrintersForPrinting {
                Printers = await manager.GetPrinters()
            }));
        }
Exemple #4
0
        public async Task <JsonResult> GetDines(int hotelId, List <string> dineIds)
        {
            string connStr = await YummyOnlineManager.GetHotelConnectionStringById(hotelId);

            List <dynamic> dines = new List <dynamic>();

            foreach (string dineId in dineIds)
            {
                var dine = await new HotelManager(connStr).GetFormatedDineById(dineId);
                if (dine != null)
                {
                    dines.Add(dine);
                }
            }

            return(Json(dines));
        }
        public async Task <JsonResult> GetShiftsForPrinting(int hotelId, List <int> ids, DateTime dateTime)
        {
            string connStr = await YummyOnlineManager.GetHotelConnectionStringById(hotelId);

            var manager = new HotelManager(connStr);

            var tShifts        = new HotelManager(connStr).GetShiftsForPrinting(ids, dateTime);
            var tPrinter       = new HotelManager(connStr).GetShiftPrinter();
            var tPrinterFormat = new HotelManager(connStr).GetPrinterFormatForPrinting();


            return(Json(new ShiftForPrinting {
                Shifts = await tShifts,
                Printer = await tPrinter,
                PrinterFormat = await tPrinterFormat
            }));
        }
Exemple #6
0
        public async Task <JsonResult> RemoteRecord(int?hotelId, int level, string message, string detail)
        {
            if (hotelId == null)
            {
                await YummyOnlineManager.RecordLog(Log.LogProgram.Remote, (Log.LogLevel) level, message, detail);
            }
            else
            {
                string connStr = await YummyOnlineManager.GetHotelConnectionStringById((int)hotelId);

                HotelManager hotelManager = new HotelManager(connStr);
                await hotelManager.RecordLog((HotelDAO.Models.Log.LogLevel) level, message, detail);
            }

            Response.Headers.Add("Access-Control-Allow-Origin", "*");
            Response.Headers.Add("Access-Control-Allow-Methods", "POST");
            Response.Headers.Add("Access-Control-Allow-Headers", "x-requested-with,content-type");
            return(Json(new JsonSuccess()));
        }