/// <summary> /// Gets the orders details. /// </summary> /// <returns></returns> public ObservableCollection <OrderInfo> GetOrdersDetails() { ObservableCollection <OrderInfo> orderinfo = new ObservableCollection <OrderInfo>(); if (!LayoutControl.IsInDesignMode) { string connectionString = LayoutControl.FindFile("Northwind.sdf"); northWind = new Northwind(connectionString); var order = northWind.Orders.Take(50); foreach (var o in order) { OrderInfo or = new OrderInfo(); or.CustomerID = o.CustomerID; or.OrderID = o.OrderID; or.Customers = new CustomerInfo(); or.Customers.Address = o.Customers.Address; or.Customers.City = o.Customers.City; or.Customers.CompanyName = o.Customers.CompanyName; or.ShippersInfo = new ShipperDetails[1]; or.ShippersInfo[0] = new ShipperDetails(); or.ShippersInfo[0].CompanyName = o.Shippers.CompanyName; or.ShippersInfo[0].ShipperID = o.Shippers.ShipperID; orderinfo.Add(or); } } return(orderinfo); }
/// <summary> /// Gets the product info. /// </summary> /// <returns></returns> public List <ProductDetails> GetProductInfo() { var productInfo = new List <ProductDetails>(); if (!LayoutControl.IsInDesignMode) { northWind = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); var ords = northWind.Products.Take(500); foreach (var em in ords) { var product = new ProductDetails(); em.SupplierID += 1000; em.ProductID += 10000; product.CategoryID = (int)em.CategoryID; product.Discontinued = em.Discontinued; product.EnglishName = em.EnglishName; product.ProductID = em.ProductID; product.ProductName = em.ProductName; product.QuantityPerUnit = em.QuantityPerUnit; product.ReorderLevel = (short)em.ReorderLevel; product.SupplierID = (int)em.SupplierID; product.UnitPrice = (decimal)em.UnitPrice; product.UnitsInStock = (short)em.UnitsInStock; product.UnitsOnOrder = (short)em.UnitsOnOrder; productInfo.Add(product); } } return(productInfo); }
/// <summary> /// Populates the data. /// </summary> private void PopulateData() { if (!LayoutControl.IsInDesignMode) { Random r = new Random(); Northwind north = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); foreach (OrderDetails orderDet in north.OrderDetails.Take(200)) { OrderInfo orderInfo = new OrderInfo(); orderInfo.OrderID = orderDet.OrderID; orderInfo.CustomerID = orderDet.Orders.CustomerID; orderInfo.ProductName = orderDet.Products.ProductName; orderInfo.UnitPrice = (double)orderDet.UnitPrice; orderInfo.OrderDate = (DateTime)orderDet.Orders.OrderDate; orderInfo.Quantity = orderDet.Quantity; orderInfo.ContactNumber = r.Next(999111234, 999111239).ToString(); orderInfo.ShipAddress = orderDet.Orders.ShipAddress; orderInfo.IsAvailable = orderInfo.UnitPrice % 2 == 0; _orderList.Add(orderInfo); if (!_comboBoxItemsSource.Contains(orderDet.Products.ProductName)) { _comboBoxItemsSource.Add(orderDet.Products.ProductName); } } } }
/// <summary> /// Populates the data. /// </summary> private void PopulateData() { if (!LayoutControl.IsInDesignMode) { Northwind north = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); foreach (OrderDetails orderDet in north.OrderDetails.Take(600)) { OrderInfo orderInfo = new OrderInfo(); orderInfo.OrderID = orderDet.OrderID; orderInfo.CustomerID = orderDet.Orders.CustomerID; orderInfo.ProductName = orderDet.Products.ProductName; orderInfo.OrderDate = DateTime.Today.AddDays(r.Next(-100, 1)); if (orderInfo.OrderID % 2 == 0) { orderInfo.IsShipped = true; } else { orderInfo.IsShipped = false; } orderInfo.ShipName = orderDet.Orders.ShipName; orderInfo.ShipAddress = orderDet.Orders.ShipAddress; _orderList.Add(orderInfo); } } }
/// <summary> /// Gets the supplier info. /// </summary> /// <returns></returns> public ObservableCollection <SalesByYear> GetSalesInfo() { if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("AdventureWorksExt.sdf")); var sales = new ObservableCollection <SalesByYear>(); using (var c = new SqlCeConnection(connectionString)) { c.Open(); using (var com = new SqlCeCommand("SELECT * FROM Sales_QuarterSalesProductView", c)) { var reader = com.ExecuteReader(); int i = 1; while (reader.Read() && i < 30) { sales.Add(new SalesByYear() { Name = reader["Name"].ToString(), QS1 = reader["QS1"].ToString() != "" ? double.Parse(reader["QS1"].ToString()) :480000.00, QS2 = reader["QS2"].ToString() != "" ? double.Parse(reader["QS2"].ToString()) : 10000.00, QS3 = reader["QS3"].ToString() != "" ? double.Parse(reader["QS3"].ToString()) : 10000.00, QS4 = reader["QS4"].ToString() != "" ? double.Parse(reader["QS4"].ToString()) : 10000.00, Total = double.Parse(reader["Total"].ToString()), Year = Int32.Parse(reader["Year"].ToString()), }); i++; } } c.Close(); } return(sales); } return(null); }
/// <summary> /// Populates the zip codes. /// </summary> public void PopulateZipCodes() { if (!LayoutControl.IsInDesignMode) { connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("ZipCodes.sdf")); using (SqlCeConnection c = new SqlCeConnection(connectionString)) { c.Open(); using (SqlCeCommand com = new SqlCeCommand("SELECT ZipCodes.*, States.StateAbbereviation,States.StateName, Class.Description FROM(ZipCodes INNER JOIN States ON ZipCodes.StateCode = States.StateCode) INNER JOIN Class ON ZipCodes.Class = Class.Class", c)) { SqlCeDataReader reader = com.ExecuteReader(); int i = 0; while (reader.Read() && i < 50) { i++; this._zipCodes.Add(new ZipCodeInfo() { ZipCode = reader["ZipCode"].ToString(), Class = reader["Class"].ToString(), StateCode = reader["StateCode"].ToString(), Latitude = reader["Latitude"].ToString(), Longitude = reader["Longitude"].ToString(), City = reader["City"].ToString(), StateName = reader["StateName"].ToString(), StateAbbereviation = reader["StateAbbereviation"].ToString(), }); } } c.Close(); } } }
/// <summary> /// Populates the data. /// </summary> private void PopulateData() { if (!LayoutControl.IsInDesignMode) { Random r = new Random(); Northwind north = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); foreach (OrderDetails orderDet in north.OrderDetails.Take(150)) { OrderInfo orderInfo = new OrderInfo(); orderInfo.OrderID = orderDet.OrderID; orderInfo.CustomerID = orderDet.Orders.CustomerID; orderInfo.ProductName = orderDet.Products.ProductName; orderInfo.UnitPrice = (double)orderDet.UnitPrice; orderInfo.Quantity = orderDet.Quantity; orderInfo.Discount = Math.Round(orderDet.Discount, 2); orderInfo.Freight = (double)orderDet.Orders.Freight; orderInfo.OrderDate = (DateTime)orderDet.Orders.OrderDate; orderInfo.ShippedDate = (DateTime)orderDet.Orders.ShippedDate; orderInfo.ShipPostalCode = orderDet.Orders.ShipPostalCode; orderInfo.ShipAddress = orderDet.Orders.ShipAddress; orderInfo.IsClosed = r.Next() % 2 == 0 ? true : false; orderInfo.ContactNumber = r.Next(999111, 999119).ToString(); orderInfo.DeliveryDelay = orderInfo.ShippedDate - orderInfo.OrderDate; if (!_comboBoxItemsSource.Contains(orderDet.Products.ProductName)) { _comboBoxItemsSource.Add(orderDet.Products.ProductName); } _orderList.Add(orderInfo); } } }
/// <summary> /// Gets the data table. /// </summary> /// <returns></returns> public DataTable GetDataTable() { DataSet ds = new DataSet(); if (!LayoutControl.IsInDesignMode) { connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); using (SqlCeConnection con = new SqlCeConnection(connectionString)) { con.Open(); SqlCeDataAdapter sda = new SqlCeDataAdapter("SELECT * FROM Suppliers", con); sda.Fill(ds, "Suppliers"); } using (SqlCeConnection con1 = new SqlCeConnection(connectionString)) { con1.Open(); SqlCeDataAdapter sda1 = new SqlCeDataAdapter("SELECT * FROM Products", con1); sda1.Fill(ds, "Products"); } ds.Relations.Add(new DataRelation("Supplier_Product", ds.Tables[0].Columns["Supplier ID"], ds.Tables[1].Columns["Supplier ID"])); } if (ds.Tables.Count > 0) { return(ds.Tables[0]); } else { return(null); } }
/// <summary> /// Called when [execute de serialize]. /// </summary> /// <param name="sender">The sender.</param> /// <param name="args">The <see cref="System.Windows.Input.ExecutedRoutedEventArgs"/> instance containing the event data.</param> private static void OnExecuteDeSerialize(object sender, ExecutedRoutedEventArgs args) { GridTreeControl GTC = args.Source as GridTreeControl; GTC.InternalGrid.CurrentCell.Deactivate(); GTC.InternalGrid.Deserialize(LayoutControl.FindFile("Default.xml")); GTC.ExpandAllNodes(); }
/// <summary> /// Populates the data. /// </summary> private void PopulateData() { if (!LayoutControl.IsInDesignMode) { Northwind north = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); this.OrderList = new ObservableCollection <Orders>(north.Orders.Take(150)); } }
/// <summary> /// Initializes a new instance of the <see cref="ViewModel"/> class. /// </summary> public ViewModel() { if (!LayoutControl.IsInDesignMode) { connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("AdventureWorksExt.sdf")); SupplierDetails = this.Get_Suppliers().ToList <DataModel>().GetRange(0, 60); } }
/// <summary> /// Populates the data. /// </summary> private void PopulateData() { if (!LayoutControl.IsInDesignMode) { Northwind north = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); var order = north.Orders.Take(100); foreach (var o in order) { OrderList.Add(o); } } }
public Order() { if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); northWind = new Northwind(connectionString); var order = northWind.Orders.Skip(0).Take(100).ToList(); foreach (var o in order) { this.Add(o); } } }
public Order() { if (!LayoutControl.IsInDesignMode) { string connectionString = LayoutControl.FindFile("Northwind.sdf"); var nw = new Northwind(connectionString); var orders = nw.Orders; foreach (var o in orders) { this.Add(o); } } }
/// <summary> /// Initializes a new instance of the <see cref="CategorySource"/> class. /// </summary> public CategorySource() { if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); northWind = new Northwind(connectionString); var ship = northWind.Products.Select(o => o.CategoryID).Distinct().ToList(); foreach (int s in ship) { this.Add(s.ToString()); } } }
/// <summary> /// Gets the orders. /// </summary> void GetOrders() { OrderDetails = new List <Orders>(); if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); northWind = new Northwind(connectionString); var order = northWind.Orders.Skip(0).Take(50); foreach (var o in order) { OrderDetails.Add(o); } } }
/// <summary> /// Gets the product info. /// </summary> /// <returns></returns> public List<Products> GetProductInfo() { List<Products> productInfo = new List<Products>(); if (!LayoutControl.IsInDesignMode) { northWind = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); var ords = northWind.Products.Take(500); foreach (var em in ords) { productInfo.Add(em); } } return productInfo; }
private void InitGrid() { var model = this.grid.Model; model.RowCount = 30; model.ColumnCount = 12; model.TableStyle.CellType = "Static"; var nw = new Northwind(string.Format("Data Source={0}", LayoutControl.FindFile("Northwind.sdf"))); var customers = nw.Customers.Skip(0).Take(30).ToList(); model[0, 1].CellValue = "CustomerID"; model[0, 2].CellValue = "ContactName"; model[0, 3].CellValue = "ContactTitle"; model[0, 4].CellValue = "CompanyName"; model[0, 5].CellValue = "City"; model[0, 6].CellValue = "Country"; model[0, 7].CellValue = "Address"; model[0, 8].CellValue = "Phone"; model[0, 9].CellValue = "ContactName"; model[0, 10].CellValue = "Orders"; model[0, 11].CellValue = "Fax"; for (int i = 1; i < model.RowCount; i++) { var customer = customers[i - 1]; model[i, 1].CellValue = customer.CustomerID; model[i, 3].CellValue = customer.ContactTitle; model[i, 4].CellValue = customer.CompanyName; model[i, 5].CellValue = customer.City; model[i, 6].CellValue = customer.Country; model[i, 7].CellValue = customer.Address; model[i, 8].CellValue = customer.Phone; model[i, 9].CellValue = customer.ContactName; model[i, 10].CellValue = customer.Fax; model.RowHeights[i] = 30; int j = 2; var style = model[i, j]; style.ShowTooltip = true; style.CellValue = customer.ContactName; style.Background = new SolidColorBrush(Colors.NavajoWhite); style.CellValue2 = customer.Phone.Length > 0 ? customer.Phone : "None"; style.TooltipTemplateKey = "templateTooltip"; } model.ColumnWidths[0] = 30; model.ColumnWidths[2] = 150; model.ResizeColumnsToFit(GridRangeInfo.Cols(3, 5), GridResizeToFitOptions.NoShrinkSize); }
/// <summary> /// Gets the data. /// </summary> /// <returns></returns> public IQueryable <Orders> GetData() { if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("NorthwindGrid.sdf")); EntityConnectionStringBuilder entityBuilder = new EntityConnectionStringBuilder(); entityBuilder.Metadata = "res://*/Model.NorthWind.csdl|res://*/Model.NorthWind.ssdl|res://*/Model.NorthWind.msl"; entityBuilder.Provider = "System.Data.SqlServerCe.3.5"; entityBuilder.ProviderConnectionString = connectionString; NorthwindGridEntities northwind = new NorthwindGridEntities(entityBuilder.ToString()); return(northwind.Orders); } return(null); }
/// <summary> /// Populates the data. /// </summary> private void PopulateData() { if (!LayoutControl.IsInDesignMode) { Random r = new Random(); Northwind north = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); foreach (OrderDetails orderDet in north.OrderDetails.Take(50)) { OrderInfo orderInfo = new OrderInfo(); orderInfo.ProductName = orderDet.Products.ProductName; orderInfo.NoOfOrders = discountcount + 6 / 100; if (discountcount > 16) { discountcount = 7; } orderInfo.OrderDate = (DateTime)orderDet.Orders.OrderDate; if (countrycount >= 21) { countrycount = 0; } orderInfo.Total = 10; orderInfo.SupplierID = countrycount % 3 == 0 ? 1 : countrycount % 3; orderInfo.CountryDescription = this.ShipCountry[countrycount]; if (countrycount % 3 == 0 || countrycount % 9 == 0) { orderInfo.ImageLink = "US.jpg"; } else if (countrycount % 5 == 0 || countrycount % 17 == 0) { orderInfo.ImageLink = "Japan.jpg"; } else { orderInfo.ImageLink = "UK.jpg"; } countrycount++; discountcount += 3; if (!_comboBoxItemsSource.Contains(orderDet.Products.ProductName)) { _comboBoxItemsSource.Add(orderDet.Products.ProductName); } _orderList.Add(orderInfo); } } }
/// <summary> /// Initializes a new instance of the <see cref="OrderSource"/> class. /// </summary> public OrderSource() { if (!LayoutControl.IsInDesignMode) { northWind = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); var ord = northWind.OrderDetails.Select(o => o.Products.EnglishName).Distinct().ToList(); foreach (string em in ord) { this.Add(new BasicFilteringDemo.DataModel.OrderDetails() { ID = em }); } } }
/// <summary> /// Gets the product info. /// </summary> /// <returns></returns> public ObservableCollection <Orders> GetOrderInfo() { ObservableCollection <Orders> orderInfo = new ObservableCollection <Orders>(); if (!LayoutControl.IsInDesignMode) { northWind = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); var ords = northWind.Orders.Take(50); foreach (var em in ords) { orderInfo.Add(em); } } return(orderInfo); }
/// <summary> /// Gets the products. /// </summary> void GetProducts() { ProductDetails = new ObservableCollection <Products>(); Northwind northWind; if (!LayoutControl.IsInDesignMode) { northWind = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); var ords = northWind.Products.Take(50); foreach (var em in ords) { this.ProductDetails.Add(em); } } }
/// <summary> /// Gets the product info. /// </summary> /// <returns></returns> public List <Orders> GetOrderInfo() { List <Orders> OrderInfo = new List <Orders>(); if (!LayoutControl.IsInDesignMode) { northWind = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); var ords = northWind.Orders.Take(200); foreach (var em in ords) { OrderInfo.Add(em); } } return(OrderInfo); }
/// <summary> /// Gets the orders. /// </summary> private void GetOrders() { Northwind northWind; if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); northWind = new Northwind(connectionString); var order = northWind.Orders.Skip(0).Take(100).Select(o => o); foreach (var o in order) { _orderCollection.Add(o); } } }
public ObservableCollection <Orders> GetEmployeeInfo() { ObservableCollection <Orders> employeesInfo = new ObservableCollection <Orders>(); if (!LayoutControl.IsInDesignMode) { northWind = new Northwind(string.Format(@"Data Source= {0}", LayoutControl.FindFile("Northwind.sdf"))); var ords = northWind.Orders;//.First(x=> x.; foreach (var em in ords) { employeesInfo.Add(em); } } return(employeesInfo); }
public Window1() { InitializeComponent(); string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); northWind = new Northwind(connectionString); this.grid.Model.RowCount = 35; this.grid.Model.ColumnCount = 25; this.grid.Model.ColumnWidths[1] = 100d; this.grid.Model.ColumnWidths[2] = 200d; grid.Model[1, 1].Foreground = Brushes.Black; grid.Model[1, 1].Background = Brushes.LightBlue; grid.Model[1, 1].Font.FontSize = 13; grid.Model[1, 1].HorizontalAlignment = HorizontalAlignment.Left; grid.Model[1, 1].Font.FontWeight = FontWeights.Bold; grid.Model[6, 1].Foreground = Brushes.Black; grid.Model[6, 1].Background = Brushes.LightBlue; grid.Model[6, 1].Font.FontSize = 13; grid.Model[6, 1].HorizontalAlignment = HorizontalAlignment.Left; grid.Model[6, 1].Font.FontWeight = FontWeights.Bold; grid.Model[6, 1].Foreground = Brushes.Black; grid.Model[6, 1].Background = Brushes.LightBlue; grid.Model[6, 1].Font.FontSize = 13; grid.Model[6, 1].HorizontalAlignment = HorizontalAlignment.Left; grid.Model[6, 1].Font.FontWeight = FontWeights.Bold; grid.Model[12, 1].Foreground = Brushes.Black; grid.Model[12, 1].Background = Brushes.LightBlue; grid.Model[12, 1].Font.FontSize = 13; grid.Model[12, 1].HorizontalAlignment = HorizontalAlignment.Left; grid.Model[12, 1].Font.FontWeight = FontWeights.Bold; grid.Model[17, 1].Foreground = Brushes.Black; grid.Model[17, 1].Background = Brushes.LightBlue; grid.Model[17, 1].Font.FontSize = 13; grid.Model[17, 1].HorizontalAlignment = HorizontalAlignment.Left; grid.Model[17, 1].Font.FontWeight = FontWeights.Bold; this.AddComboBoxes(); this.AddDropDownLists(); this.AddComboBoxesChoiceList(); this.AddDropDownWithoutValueMember(); }
/// <summary> /// Gets the orders info. /// </summary> /// <returns></returns> private List <Orders> GetOrdersInfo() { List <Orders> ordersInfo = new List <Orders>(); if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); northWind = new Northwind(connectionString); var order = northWind.Orders; foreach (var o in order) { ordersInfo.Add(o); } } return(ordersInfo); }
/// <summary> /// Initializes a new instance of the <see cref="CustomerSource"/> class. /// </summary> public CustomerSource() { if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); northWind = new Northwind(connectionString); var order = northWind.Orders; foreach (var o in order) { if (!this.Contains(o.CustomerID)) { this.Add(o.CustomerID); } } } }
/// <summary> /// Gets the employee info. /// </summary> /// <returns></returns> private ObservableCollection <Orders> GetOrdersDetails() { var ordersDetails = new ObservableCollection <Orders>(); if (!LayoutControl.IsInDesignMode) { string connectionString = string.Format(@"Data Source = {0}", LayoutControl.FindFile("Northwind.sdf")); northWind = new Northwind(connectionString); var emp = northWind.Orders.Take(500).ToList(); foreach (var o in emp) { ordersDetails.Add(o); } } return(ordersDetails); }