Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            MenuOptionsService menuOptionsList = new MenuOptionsService();
            OrdersService      ordersService   = new OrdersService();
            FiltersService     filtersService  = new FiltersService();
            OrdersManager      ordersManager   = new OrdersManager(ordersService);
            FiltersManager     filtersManager  = new FiltersManager(ordersService);

            ordersService.LoadFromFile();

            Console.WriteLine("Witaj w aplikacji do zarządzania zleceniami.");
            while (true)
            {
                Console.WriteLine("Wybierz co chcesz zrobić:");

                menuOptionsList.ShowItems();
                var operation = Console.ReadKey();
                switch (operation.KeyChar)
                {
                case '1':
                    var key = ordersManager.CreateNewOrder();
                    break;

                case '2':
                    var key1 = ordersManager.CancelOrder();
                    break;

                case '3':
                    var key2 = ordersManager.SearchOrder();
                    break;

                case '4':
                    var key3          = filtersService.ShowItems();
                    var choosenFilter = Console.ReadKey();
                    filtersManager.ChooseFilter(choosenFilter);
                    break;

                default:
                    Console.WriteLine("Wybrana operacja nie istnieje.");
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        public string Execute(Hashtable params_ht)
        {
            Hashtable res = params_ht;

            if (res["UID"] == null || res["UID"].ToString().Trim().Length <= 0)
            {
                return(SiteHelper.GetJsonFromHashTable(null, "faild", "参数不完整"));
            }
            else
            {
                uid = res["UID"].ToString().Trim();
                OrdersManager om    = new OrdersManager();
                Hashtable     order = om.GetUserCurrentOrderVehicle(uid);
                Hashtable     ht    = om.GetUserCurrentOrderVehicleGPSNum(uid);
                if (ht == null)
                {
                    return(SiteHelper.GetJsonFromHashTable(null, "faild", "您没有需要取消的订单"));
                }
                else
                {
                    string orderNum  = SiteHelper.GetHashTableValueByKey(ht, "OrderNum");
                    string startTime = SiteHelper.GetHashTableValueByKey(ht, "StartTime");
                    if (string.IsNullOrEmpty(startTime))
                    {
                        bool isSuccess = om.CancelOrder(orderNum, 0);
                        if (!isSuccess)
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "faild", "取消订单失败,请稍后重试"));
                        }
                        else
                        {
                            return(SiteHelper.GetJsonFromHashTable(null, "success", "取消订单成功"));
                        }
                    }
                    else
                    {
                        return(SiteHelper.GetJsonFromHashTable(null, "faild", "当前订单不能自动取消"));
                    }
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 根据订单号取消订单
        /// </summary>
        /// <param name="order_no">订单号</param>
        /// <param name="type">1 系统自动取消订单 0 客户取消订单 </param>
        /// <returns></returns>
        private bool CancelOrder(string ordernum, int type)
        {
            OrdersManager ordersManager = new OrdersManager();

            return(ordersManager.CancelOrder(ordernum, type));
        }