// GET: api/Calendars
        public IHttpActionResult GetCalendars()
        {
            //データを返すDataTableオブジェクトを生成
            var result = new EnterpriseService.DataTable();

            //列情報をColumnsにセット
            result.Columns = new EnterpriseService.DataTableColumn[] {
                new EnterpriseService.DataTableColumn {
                    name = "Date", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Year", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Quarter", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Month", @class = "java.lang.String"
                }
            };

            //データを返すRowsを初期化
            result.Rows = new EnterpriseService.DataTableRows();
            //行位置を示すインデックスを初期化
            int idx = 0;
            //データを取得する変数を初期化
            var rows = new List <EnterpriseService.DataTableRowsRow>();
            //データを取得し、格納
            var data = db.Calendars.AsEnumerable <Calendar>();

            foreach (var d in data)
            {
                EnterpriseService.DataTableRowsRowCell[] cells =
                {
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "0", Value = d.Date.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "1", Value = d.Year
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "2", Value = d.Quarter
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "3", Value = d.Month
                    }
                };

                rows.Add(new EnterpriseService.DataTableRowsRow {
                    index = idx.ToString(), Cell = cells
                });
                idx++;
            }
            result.Rows.Row = rows.ToArray <EnterpriseService.DataTableRowsRow>();
            //データ件数
            result.Rows.count = result.Rows.Row.Length.ToString();

            return(Ok(result));
        }
        // GET: api/ProductCategories
        public IHttpActionResult GetProductCategories()
        {
            //データを返すDataTableオブジェクトを生成
            var result = new EnterpriseService.DataTable();

            //列情報をColumnsにセット
            result.Columns = new EnterpriseService.DataTableColumn[] {
                new EnterpriseService.DataTableColumn {
                    name = "ProductCategoryID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ProductCategoryName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Description", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Picture", @class = "java.lang.String"
                }
            };

            //データを返すRowsを初期化
            result.Rows = new EnterpriseService.DataTableRows();
            //行位置を示すインデックスを初期化
            int idx = 0;
            //データを取得する変数を初期化
            var rows = new List <EnterpriseService.DataTableRowsRow>();
            //データを取得し、格納
            var data = db.ProductCategories.AsEnumerable <ProductCategory>();

            foreach (var d in data)
            {
                EnterpriseService.DataTableRowsRowCell[] cells =
                {
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "0", Value = d.ProductCategoryID.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "1", Value = d.ProductCategoryName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "2", Value = d.Description
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "3", Value = (d.Picture == null ? "" :  d.Picture.ToString())
                    }
                };

                rows.Add(new EnterpriseService.DataTableRowsRow {
                    index = idx.ToString(), Cell = cells
                });
                idx++;
            }
            result.Rows.Row = rows.ToArray <EnterpriseService.DataTableRowsRow>();
            //データ件数
            result.Rows.count = result.Rows.Row.Length.ToString();

            return(Ok(result));
        }
Пример #3
0
        // GET: api/Shippers
        public IHttpActionResult GetShippers()
        {
            //データを返すDataTableオブジェクトを生成
            var result = new EnterpriseService.DataTable();

            //列情報をColumnsにセット
            result.Columns = new EnterpriseService.DataTableColumn[] {
                new EnterpriseService.DataTableColumn {
                    name = "ShipperID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "CompanyName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Phone", @class = "java.lang.String"
                }
            };

            //データを返すRowsを初期化
            result.Rows = new EnterpriseService.DataTableRows();
            //行位置を示すインデックスを初期化
            int idx = 0;
            //データを取得する変数を初期化
            var rows = new List <EnterpriseService.DataTableRowsRow>();
            //データを取得し、格納
            var data = db.Shippers.AsEnumerable <Shipper>();

            foreach (var d in data)
            {
                EnterpriseService.DataTableRowsRowCell[] cells =
                {
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "0", Value = d.ShipperID.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "1", Value = d.CompanyName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "2", Value = d.Phone
                    }
                };

                rows.Add(new EnterpriseService.DataTableRowsRow {
                    index = idx.ToString(), Cell = cells
                });
                idx++;
            }
            result.Rows.Row = rows.ToArray <EnterpriseService.DataTableRowsRow>();
            //データ件数
            result.Rows.count = result.Rows.Row.Length.ToString();

            return(Ok(result));
        }
Пример #4
0
        // GET: api/OrderDetails
        public IHttpActionResult GetOrderDetails()
        {
            //データを返すDataTableオブジェクトを生成
            var result = new EnterpriseService.DataTable();

            //列情報をColumnsにセット
            result.Columns = new EnterpriseService.DataTableColumn[] {
                new EnterpriseService.DataTableColumn {
                    name = "OrderID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "DetailNo", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ProductID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "UnitPrice", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Quantity", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Discount", @class = "java.lang.String"
                }
            };

            //データを返すRowsを初期化
            result.Rows = new EnterpriseService.DataTableRows();
            //行位置を示すインデックスを初期化
            int idx = 0;
            //データを取得する変数を初期化
            var rows = new List <EnterpriseService.DataTableRowsRow>();
            //データを取得し、格納
            var data = db.OrderDetails.AsEnumerable <OrderDetail>();

            foreach (var d in data)
            {
                EnterpriseService.DataTableRowsRowCell[] cells =
                {
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "0", Value = d.OrderID.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "1", Value = d.DetailNo.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "2", Value = d.ProductID.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "3", Value = d.UnitPrice.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "4", Value = d.Quantity.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "5", Value = d.Discount.ToString()
                    }
                };

                rows.Add(new EnterpriseService.DataTableRowsRow {
                    index = idx.ToString(), Cell = cells
                });
                idx++;
            }
            result.Rows.Row = rows.ToArray <EnterpriseService.DataTableRowsRow>();
            //データ件数
            result.Rows.count = result.Rows.Row.Length.ToString();

            return(Ok(result));
        }
        // GET: api/Products
        public IHttpActionResult GetProducts()
        {
            //データを返すDataTableオブジェクトを生成
            var result = new EnterpriseService.DataTable();

            //列情報をColumnsにセット
            result.Columns = new EnterpriseService.DataTableColumn[] {
                new EnterpriseService.DataTableColumn {
                    name = "ProductID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ProductNameKana", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ProductName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "SupplierID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ProductCategoryID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "QuantityPerUnit", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "UnitPrice", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "UnitsInStock", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "UnitsOnOrder", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ReorderLevel", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Discontinued", @class = "java.lang.String"
                }
            };

            //データを返すRowsを初期化
            result.Rows = new EnterpriseService.DataTableRows();
            //行位置を示すインデックスを初期化
            int idx = 0;
            //データを取得する変数を初期化
            var rows = new List <EnterpriseService.DataTableRowsRow>();
            //データを取得し、格納
            var data = db.Products.AsEnumerable <Product>();

            foreach (var d in data)
            {
                EnterpriseService.DataTableRowsRowCell[] cells =
                {
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "0", Value = d.ProductID.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "1", Value = d.ProductNameKana
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "2", Value = d.ProductName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "3", Value = (d.SupplierID == null ? "" : d.SupplierID.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "4", Value = (d.ProductCategoryID == null ? "" : d.ProductCategoryID.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "5", Value = d.QuantityPerUnit
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "6", Value = d.UnitPrice.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "7", Value = d.UnitsInStock.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "8", Value = d.UnitsOnOrder.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "9", Value = d.ReorderLevel.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "10", Value = d.Discontinued.ToString()
                    }
                };

                rows.Add(new EnterpriseService.DataTableRowsRow {
                    index = idx.ToString(), Cell = cells
                });
                idx++;
            }
            result.Rows.Row = rows.ToArray <EnterpriseService.DataTableRowsRow>();
            //データ件数
            result.Rows.count = result.Rows.Row.Length.ToString();

            return(Ok(result));
        }
        // GET: api/Customers
        public IHttpActionResult GetCustomers()
        {
            //データを返すDataTableオブジェクトを生成
            var result = new EnterpriseService.DataTable();

            //列情報をColumnsにセット
            result.Columns = new EnterpriseService.DataTableColumn[] {
                new EnterpriseService.DataTableColumn {
                    name = "CustomerID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "CompanyNameKana", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "CompanyName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ContactName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ContactDepartment", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "PostalCode", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "RegionId", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Address1", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Address2", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Phone", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Fax", @class = "java.lang.String"
                }
            };

            //データを返すRowsを初期化
            result.Rows = new EnterpriseService.DataTableRows();
            //行位置を示すインデックスを初期化
            int idx = 0;
            //データを取得する変数を初期化
            var rows = new List <EnterpriseService.DataTableRowsRow>();
            //データを取得し、格納
            var data = db.Customers.AsEnumerable <Customer>();

            foreach (var d in data)
            {
                EnterpriseService.DataTableRowsRowCell[] cells =
                {
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "0", Value = d.CustomerID.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "1", Value = d.CompanyNameKana
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "2", Value = d.CompanyName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "3", Value = d.ContactName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "4", Value = d.ContactDepartment
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "5", Value = d.PostalCode
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "6", Value = (d.RegionId == null ? "" : d.RegionId.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "7", Value = d.Address1
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "8", Value = d.Address2
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "9", Value = d.Phone
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "10", Value = d.Fax
                    }
                };

                rows.Add(new EnterpriseService.DataTableRowsRow {
                    index = idx.ToString(), Cell = cells
                });
                idx++;
            }
            result.Rows.Row = rows.ToArray <EnterpriseService.DataTableRowsRow>();
            //データ件数
            result.Rows.count = result.Rows.Row.Length.ToString();

            return(Ok(result));
        }
        // GET: api/Employees
        public IHttpActionResult GetEmployees()
        {
            //データを返すDataTableオブジェクトを生成
            var result = new EnterpriseService.DataTable();

            //列情報をColumnsにセット
            result.Columns = new EnterpriseService.DataTableColumn[] {
                new EnterpriseService.DataTableColumn {
                    name = "EmployeeID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "EmployeeNameKana", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "EmployeeName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "BranchName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "DepartmentName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "BirthDate", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "HireDate", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "PostalCode", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "RegionID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Address1", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Address2", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Phone", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Extension", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "PhotoPath", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "Profile", @class = "java.lang.String"
                }
            };

            //データを返すRowsを初期化
            result.Rows = new EnterpriseService.DataTableRows();
            //行位置を示すインデックスを初期化
            int idx = 0;
            //データを取得する変数を初期化
            var rows = new List <EnterpriseService.DataTableRowsRow>();
            //データを取得し、格納
            var data = db.Employees.AsEnumerable <Employee>();

            foreach (var d in data)
            {
                EnterpriseService.DataTableRowsRowCell[] cells =
                {
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "0", Value = d.EmployeeID.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "1", Value = d.EmployeeNameKana
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "2", Value = d.EmployeeName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "3", Value = d.BranchName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "4", Value = d.DepartmentName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "5", Value = (d.BirthDate == null ? "" : d.BirthDate.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "6", Value = (d.HireDate == null ? "" : d.HireDate.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "7", Value = d.PostalCode
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "8", Value = (d.RegionID == null ? "" : d.RegionID.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "9", Value = d.Address1
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "10", Value = d.Address2
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "11", Value = d.Phone
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "12", Value = d.Extension
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "13", Value = d.PhotoPath
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "14", Value = d.Profile
                    }
                };

                rows.Add(new EnterpriseService.DataTableRowsRow {
                    index = idx.ToString(), Cell = cells
                });
                idx++;
            }
            result.Rows.Row = rows.ToArray <EnterpriseService.DataTableRowsRow>();
            //データ件数
            result.Rows.count = result.Rows.Row.Length.ToString();

            return(Ok(result));
        }
        // GET: api/Orders
        public IHttpActionResult GetOrders()
        {
            //データを返すDataTableオブジェクトを生成
            var result = new EnterpriseService.DataTable();

            //列情報をColumnsにセット
            result.Columns = new EnterpriseService.DataTableColumn[] {
                new EnterpriseService.DataTableColumn {
                    name = "OrderID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "CustomerID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "EmployeeID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ShipName", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ShipPostalCode", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ShipRegionID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ShipAddress1", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ShipAddress2", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ShipperID", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "OrderDate", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "RequiredDate", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ShippedDate", @class = "java.lang.String"
                },
                new EnterpriseService.DataTableColumn {
                    name = "ShipVia", @class = "java.lang.String"
                }
            };

            //データを返すRowsを初期化
            result.Rows = new EnterpriseService.DataTableRows();
            //行位置を示すインデックスを初期化
            int idx = 0;
            //データを取得する変数を初期化
            var rows = new List <EnterpriseService.DataTableRowsRow>();
            //データを取得し、格納
            var data = db.Orders.AsEnumerable <Order>();

            foreach (var d in data)
            {
                EnterpriseService.DataTableRowsRowCell[] cells =
                {
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "0", Value = d.OrderID.ToString()
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "1", Value = (d.CustomerID == null ? "" : d.CustomerID.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "2", Value = (d.EmployeeID == null ? "" : d.EmployeeID.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "3", Value = d.ShipName
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "4", Value = d.ShipPostalCode
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "5", Value = (d.ShipRegionID == null ? "" : d.ShipRegionID.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "6", Value = d.ShipAddress1
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "7", Value = d.ShipAddress2
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "8", Value = (d.ShipperID == null ? "" : d.ShipperID.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "9", Value = (d.OrderDate == null ? "" : d.OrderDate.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "10", Value = (d.RequiredDate == null ? "" : d.RequiredDate.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "11", Value = (d.ShippedDate == null ? "" : d.ShippedDate.ToString())
                    },
                    new EnterpriseService.DataTableRowsRowCell {
                        index = "12", Value = d.ShipVia.ToString()
                    }
                };

                rows.Add(new EnterpriseService.DataTableRowsRow {
                    index = idx.ToString(), Cell = cells
                });
                idx++;
            }
            result.Rows.Row = rows.ToArray <EnterpriseService.DataTableRowsRow>();
            //データ件数
            result.Rows.count = result.Rows.Row.Length.ToString();

            return(Ok(result));
        }