/// <summary> /// Creates the underlying data. /// </summary> private void CreateData() { this.data = new DataSet(); // create the Delivery table DataTable deliveryTable = this.data.Tables.Add("Deliveries"); deliveryTable.Columns.Add("StartDateTime", typeof(DateTime)); // used in Schedule binding deliveryTable.Columns.Add("Category", typeof(CategoryType)); deliveryTable.Columns.Add("EndDateTime", typeof(DateTime)); // used in Schedule binding deliveryTable.Columns.Add("Subject", typeof(string)); // used in Schedule binding deliveryTable.Columns.Add("Description", typeof(string)); // used in Schedule binding deliveryTable.Columns.Add("AllDayEvent", typeof(bool)); // used in Schedule binding deliveryTable.Columns.Add("DataKey", typeof(string)); // used in Schedule binding deliveryTable.Columns.Add("Weight"); deliveryTable.Columns.Add("Cost"); deliveryTable.Columns.Add("Count", typeof(int)); // create the Inventory table DataTable table = data.Tables.Add("Inventory"); table.Columns.Add("PartNumber"); table.Columns.Add("Manufacturer"); table.Columns.Add("Category", typeof(CategoryType)); table.Columns.Add("Component"); table.Columns.Add("PricePerItem", typeof(float)); table.Columns.Add("WeightPerItem", typeof(float)); table.Columns.Add("InStock", typeof(int)); // loop through each main Category foreach (CategoryType partType in Enum.GetValues(typeof(CategoryType))) { // for each subcategory, create a random number (2 - 5) of parts. foreach (string component in AutoPartsCatalog.GetSubCategories(partType)) { for (int i = 0; i < Utilities.RandomInt(2, 5); i++) { int numberInStock = Utilities.RandomInt(0, 12); DataRow row = table.Rows.Add(new object[] { Utilities.GenerateSerialNumber(Utilities.RandomInt(2, 4), Utilities.RandomInt(8, 12)), this.GetManufacturer(), partType, component, Utilities.RandomDouble(2, 30), Utilities.RandomDouble(10, 100), numberInStock, }); // if the current stock is less than 2, make a random delivery appointment. if (numberInStock <= 1) { this.CreateDelivery(row, Utilities.RandomInt(1, 10)); } } } } table.AcceptChanges(); }
/// <summary> /// Initializes the UI controls. /// </summary> private void InitializeUI() { // Assign the images Image background = Utilities.GetCachedImage(CachedImages.Background); this.lblLogo.Appearance.ImageBackground = background; this.ultraToolbarsManager1.Ribbon.CaptionAreaAppearance.ImageBackground = background; this.MainForm_Fill_Panel.Appearance.ImageBackground = background; this.tcSchedule.TabHeaderAreaAppearance.ImageBackground = background; this.gridInventory.DisplayLayout.Appearance.ImageBackground = background; this.dvSchedule.Appearance.ImageBackground = background; this.wvSchedule.Appearance.ImageBackground = background; this.mvSchedule.Appearance.ImageBackground = background; this.ultraPanel1.Appearance.ImageBackground = background; this.lblLogo.Appearance.ImageBackground = Utilities.GetCachedImage(CachedImages.Logo); this.btnInventory.Appearance.Image = Utilities.GetCachedImage(CachedImages.Inventory); this.btnSchedule.Appearance.Image = Utilities.GetCachedImage(CachedImages.Schedule); this.tcSchedule.Tabs["Daily"].Appearance.Image = Utilities.GetCachedImage(CachedImages.Daily); this.tcSchedule.Tabs["Weekly"].Appearance.Image = Utilities.GetCachedImage(CachedImages.Weekly); this.tcSchedule.Tabs["Monthly"].Appearance.Image = Utilities.GetCachedImage(CachedImages.Monthly); this.ultraRadialMenu1.ToolSettings.CenterButtonAppearance.Image = Utilities.GetCachedImage(CachedImages.RadialCenter); // assign UIElement filters this.ultraToolbarsManager1.CreationFilter = new Showcase.INGear.ToolbarsManagerUIElementFilter(); this.dvSchedule.CreationFilter = new Showcase.INGear.DayViewUIElementFilter(); // create the radial menu tools foreach (CategoryType category in Enum.GetValues(typeof(CategoryType))) { RadialMenuTool tool = new RadialMenuTool(); tool.Tag = category; tool.ToolTipText = Utilities.LocalizeString(Utilities.CategoryTypeToString(category)); tool.ToolSettings.Appearance.Image = Utilities.GetCachedImage(Utilities.CachedImagesFromCategory(category)); foreach (string sub in AutoPartsCatalog.GetSubCategories(category)) { RadialMenuTool childTool = new RadialMenuTool(sub); childTool.Tag = category; childTool.Text = Utilities.LocalizeString(sub); tool.Tools.Add(childTool); } this.ultraRadialMenu1.CenterTool.Tools.Add(tool); } this.LocalizeStrings(); }