Пример #1
0
        static void Main()
        {
            // Create Data Objects
            DishTable        = new DishTable(GameData.DishData);
            IngredientsTable = new IngredientsTable(GameData.IngredientData);

            // Load Icon Files
            IconSet_Application = new List <Image>()
            {
                AppIcons.Application,
                AppIcons.Close,
                AppIcons.Collection,
                AppIcons.Console,
                AppIcons.Document,
                AppIcons.Files,
                AppIcons.FolderClosed,
                AppIcons.FolderOpened,
                AppIcons.Info,
                AppIcons.InfoSmall,
                AppIcons.Log,
                AppIcons.NewFile,
                AppIcons.Properties,
                AppIcons.Nippon_300x,
                AppIcons.Nippon_64x,
                AppIcons.Nippon_32x
            };

            // Load GameIcons
            IconSet_Game = new List <Image>()
            {
                GameIcons.Appearance_24x,
                GameIcons.Aroma_24x,
                GameIcons.Brain_24x,
                GameIcons.Charisma_24x,
                GameIcons.Health_24x,
                GameIcons.Rarity_24x,
                GameIcons.Food_32x24,
                GameIcons.Star_24x,
                GameIcons.Kitchen_24x
            };


            // Start WinForm
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
Пример #2
0
        public JsonResult Update(DishStore store, string doWhat, int?orderId, int?tableId, int?deliveryUnit)
        {
            if (!orderId.HasValue)
            {
                return(ApiModel(message: "参数不能为空[orderId]"));
            }

            DishOrder order = DishOrderBLL.SingleModel.GetModel(orderId.Value);

            if (order?.storeId != store.id)
            {
                return(ApiModel(message: "无效订单"));
            }

            bool success = false;

            switch (doWhat)
            {
            case "Table":
                if (!tableId.HasValue)
                {
                    return(ApiModel(message: "未找到相关桌台"));
                }
                DishTable table = DishTableBLL.SingleModel.GetModel(tableId.Value);
                if (table == null || table.storeId != store.id)
                {
                    return(ApiModel(message: "未找到相关桌台"));
                }
                order.order_table_id_zhen = table.id;
                order.order_table_id      = table.table_name;
                success = DishOrderBLL.SingleModel.Update(order, "order_table_id,order_table_id_zhen");
                break;

            case "PickUp":
                order.peisong_status = (int)DishEnums.DeliveryState.待取货;
                success = DishOrderBLL.SingleModel.Update(order, "peisong_status");
                break;

            case "Cancel":
                order.peisong_status = (int)DishEnums.DeliveryState.已取消;
                success = DishOrderBLL.SingleModel.Update(order, "peisong_status");
                break;

            case "Complete":
                order.peisong_status = (int)DishEnums.DeliveryState.已完成;
                success = DishOrderBLL.SingleModel.Update(order, "peisong_status");
                break;

            case "Delivery":
                if (!deliveryUnit.HasValue)
                {
                    return(ApiModel(message: "参数不能为空[deliveryUnit]"));
                }
                DishTransporter transporter = DishTransporterBLL.SingleModel.GetModel(deliveryUnit.Value);
                if (transporter == null)
                {
                    return(ApiModel(message: "未找到配送员资料"));
                }
                order.peisong_open       = 1;
                order.peisong_status     = (int)DishEnums.DeliveryState.配送中;
                order.peisong_user_name  = transporter.dm_name;
                order.peisong_user_phone = transporter.dm_mobile;
                success = DishOrderBLL.SingleModel.Update(order, "peisong_open,peisong_status,peisong_user_name,peisong_user_phone");
                break;
            }

            return(ApiModel(isok: success, message: success ? "操作成功" : "操作失败"));
        }
Пример #3
0
        /// <summary>
        /// 订单资料
        /// </summary>
        /// <param name="order"></param>
        /// <param name="act"></param>
        /// <returns></returns>
        public ActionResult Info(DishOrder order, string act = "", int psy_id = 0, string printer = null, string orderMark = null)
        {
            if (order.id <= 0)
            {
                _result.code = 0;
                _result.msg  = "未找到有效的订单标识";
                return(Json(_result, JsonRequestBehavior.AllowGet));
            }


            if (string.IsNullOrWhiteSpace(act))
            {
                EditModel <DishOrder> model = new EditModel <DishOrder>();

                model.DataModel = DishOrderBLL.SingleModel.GetModel(order.id) ?? new DishOrder();
                if (model.DataModel.id > 0)
                {
                    model.DataModel.carts = DishShoppingCartBLL.SingleModel.GetCartsByOrderId(model.DataModel.id) ?? new List <DishShoppingCart>();
                }
                model.aId     = model.appId = order.aId;
                model.storeId = order.storeId;

                ViewBag.dishTransporters = DishTransporterBLL.SingleModel.GetTransportersByparams(model.aId, model.storeId, true) ?? new List <DishTransporter>();
                return(View(model));
            }
            else
            {
                bool      isSuccess = false;
                DishOrder dbOrder   = DishOrderBLL.SingleModel.GetModel(order.id);
                if (dbOrder == null)
                {
                    _result.code = 0;
                    _result.msg  = "未找到相关订单";
                    return(Json(_result, JsonRequestBehavior.AllowGet));
                }

                if (act == "changeTable")
                {
                    DishTable table = DishTableBLL.SingleModel.GetModel(order.order_table_id_zhen);
                    if (table == null)
                    {
                        _result.code = 0;
                        _result.msg  = "未找到相关桌台";
                        return(Json(_result, JsonRequestBehavior.AllowGet));
                    }

                    dbOrder.order_table_id_zhen = table.id;
                    dbOrder.order_table_id      = table.table_name;

                    isSuccess = DishOrderBLL.SingleModel.Update(dbOrder, "order_table_id,order_table_id_zhen");

                    _result.code = isSuccess ? 1 : 0;
                    _result.msg  = isSuccess ? "操作成功" : "操作失败";
                    return(Json(_result, JsonRequestBehavior.AllowGet));
                }
                else if (act == "queren")
                {
                    dbOrder.peisong_status = (int)DishEnums.DeliveryState.待取货;
                    isSuccess = DishOrderBLL.SingleModel.Update(dbOrder, "peisong_status");

                    _result.code = isSuccess ? 1 : 0;
                    _result.msg  = isSuccess ? "操作成功" : "操作失败";
                    return(Json(_result, JsonRequestBehavior.AllowGet));
                }
                else if (act == "quxiao")
                {
                    dbOrder.peisong_status = (int)DishEnums.DeliveryState.已取消;
                    isSuccess = DishOrderBLL.SingleModel.Update(dbOrder, "peisong_status");

                    _result.code = isSuccess ? 1 : 0;
                    _result.msg  = isSuccess ? "操作成功" : "操作失败";
                    return(Json(_result, JsonRequestBehavior.AllowGet));
                }
                else if (act == "wancheng")
                {
                    dbOrder.peisong_status = (int)DishEnums.DeliveryState.已完成;
                    isSuccess = DishOrderBLL.SingleModel.Update(dbOrder, "peisong_status");

                    _result.code = isSuccess ? 1 : 0;
                    _result.msg  = isSuccess ? "操作成功" : "操作失败";
                    return(Json(_result, JsonRequestBehavior.AllowGet));
                }
                else if (act == "peisong")
                {
                    if (psy_id <= 0)
                    {
                        _result.code = 0;
                        _result.msg  = "配送员标识错误";
                        return(Json(_result, JsonRequestBehavior.AllowGet));
                    }
                    DishTransporter transporter = DishTransporterBLL.SingleModel.GetModel(psy_id);
                    if (transporter == null)
                    {
                        _result.code = 0;
                        _result.msg  = "未找到配送员资料";
                        return(Json(_result, JsonRequestBehavior.AllowGet));
                    }
                    dbOrder.peisong_open       = 1;
                    dbOrder.peisong_status     = (int)DishEnums.DeliveryState.配送中;
                    dbOrder.peisong_user_name  = transporter.dm_name;
                    dbOrder.peisong_user_phone = transporter.dm_mobile;

                    isSuccess = DishOrderBLL.SingleModel.Update(dbOrder, "peisong_open,peisong_status,peisong_user_name,peisong_user_phone");

                    _result.code = isSuccess ? 1 : 0;
                    _result.msg  = isSuccess ? "操作成功" : "操作失败";
                    return(Json(_result, JsonRequestBehavior.AllowGet));
                }
                else if (act == "print") //打印
                {
                    PrinterHelper.DishPrintOrderByPrintType(dbOrder, 0, printer);
                    _result.code = 1;
                    _result.msg  = "操作成功";
                    return(Json(_result, JsonRequestBehavior.AllowGet));
                }
                else if (act == "mark")
                {
                    DishOrderAttrbute orderAttr = dbOrder.GetAttrbute();
                    orderAttr.mark   = orderMark;
                    dbOrder.attrbute = JsonConvert.SerializeObject(orderAttr);
                    isSuccess        = DishOrderBLL.SingleModel.Update(dbOrder, "attrbute");
                    _result.code     = isSuccess ? 1 : 0;
                    _result.msg      = isSuccess ? "操作成功" : "操作失败";
                    return(Json(_result, JsonRequestBehavior.AllowGet));
                }
            }
            return(Json(_result, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
    public void TakeDishFormDishTable(DishTable dishTable)
    {
        var dish = dishTable.TakeDish();

        TakeDish(dish);
    }