Beispiel #1
0
        public static string UpdateOrder(Order order)
        {
            string orderResult;

            orderResult = OrdersStore.Save(order);
            return(orderResult);
        }
Beispiel #2
0
        private void loadcombobox() //讀取甜度冰塊combobox
        {
            var q = from s in dbConntext.Sugars
                    where s.SugarID > 0
                    select s;

            foreach (var item in q)
            {
                this.OrdersSugar.Items.Add(item.SugarName);
            }

            var q2 = from t in dbConntext.Temperatures
                     where t.TemperatureID > 0
                     select t;

            foreach (var item in q2)
            {
                this.ordersTemperature.Items.Add(item.TemperatureName);
            }

            var q3 = from sz in dbConntext.Sizes
                     select sz;

            foreach (var item in q3)
            {
                this.ordersSize.Items.Add(item.SizeName);
            }

            var q4 = from st in dbConntext.Stores
                     select st.StoreName;

            foreach (var item in q4)
            {
                this.OrdersStore.Items.Add(item);
            }

            OrdersSugar.SelectedIndex = OrdersSugar.FindStringExact(OrdersSugar.Items[0].ToString());

            ordersTemperature.SelectedIndex = ordersTemperature.FindStringExact(OrdersSugar.Items[0].ToString());

            ordersSize.SelectedIndex = ordersSize.FindStringExact(ordersSize.Items[0].ToString());

            OrdersStore.SelectedIndex = OrdersStore.FindStringExact(OrdersStore.Items[0].ToString());
        }
Beispiel #3
0
        public UserType(IDataLoaderContextAccessor accessor, OrdersStore orders)
        {
            Name = "User";

            Field(x => x.UserId);
            Field(x => x.FirstName);
            Field(x => x.LastName);
            Field(x => x.Email);

            Field <ListGraphType <OrderType>, IEnumerable <Order> >()
            .Name("Orders")
            .ResolveAsync(ctx =>
            {
                var ordersLoader = accessor.Context.GetOrAddCollectionBatchLoader <int, Order>("GetOrdersByUserId",
                                                                                               orders.GetOrdersByUserIdAsync);

                return(ordersLoader.LoadAsync(ctx.Source.UserId));
            });
        }
Beispiel #4
0
        public QueryType(IDataLoaderContextAccessor accessor, UsersStore users, OrdersStore orders)
        {
            Name = "Query";

            Field <ListGraphType <UserType>, IEnumerable <User> >()
            .Name("Users")
            .Description("Get all Users")
            .Returns <IEnumerable <User> >()
            .ResolveAsync(ctx =>
            {
                var loader = accessor.Context.GetOrAddLoader("GetAllUsers",
                                                             () => users.GetAllUsersAsync());

                return(loader.LoadAsync());
            });

            Field <OrderType, Order>()
            .Name("Order")
            .Description("Get Order by ID")
            .Argument <NonNullGraphType <IntGraphType> >("orderId", "")
            .ResolveAsync(ctx =>
            {
                var loader = accessor.Context.GetOrAddBatchLoader <int, Order>("GetOrderById",
                                                                               orders.GetOrderByIdAsync, x => x.OrderId);

                return(loader.LoadAsync(ctx.GetArgument <int>("orderId")));
            });

            Field <ListGraphType <OrderType>, IEnumerable <Order> >()
            .Name("Orders")
            .Description("Get all Orders")
            .ResolveAsync(ctx =>
            {
                var loader = accessor.Context.GetOrAddLoader("GetAllOrders",
                                                             orders.GetAllOrdersAsync);

                return(loader.LoadAsync());
            });
        }
Beispiel #5
0
        public static IEnumerable <Order> GetOrderByUnAssigned()
        {
            IEnumerable <Order> orders = OrdersStore.GetOrderByUnAssigned();

            return(orders);
        }
Beispiel #6
0
        public static bool DeleteOrder(string id)
        {
            var deleteOrder = OrdersStore.Delete(id);

            return(deleteOrder);
        }
Beispiel #7
0
        public static string CreateOrder(Order order)
        {
            string newOrder = OrdersStore.Save(order);

            return(newOrder);
        }
Beispiel #8
0
        public static string GetOrdersByShortCodeJSON(string clientShortCode)
        {
            string ordersJSON = OrdersStore.GetOrdersByClientShortCodeJSON(clientShortCode);

            return(ordersJSON);
        }
Beispiel #9
0
        public static IEnumerable <Order> GetOrdersByShortCode(string clientShortCode)
        {
            IEnumerable <Order> orders = OrdersStore.GetOrdersByClientShortCode(clientShortCode).OrderByDescending((o => o.OrderNumber));

            return(orders);
        }
Beispiel #10
0
 public static Order GetOrderByNumber(string orderNumber)
 {
     return(OrdersStore.GetOrderByNumber(orderNumber));
 }
Beispiel #11
0
 public static Order GetOrderById(string orderId)
 {
     return(OrdersStore.GetOrderById(orderId));
 }
Beispiel #12
0
 public static IEnumerable <Order> GetRecentOrders()
 {
     return(OrdersStore.GetOrders());
 }