/// <summary> /// /// </summary> public OrderUI(Inventory _i) { try { //Spring.NET XmlApplicationContext ctx = new XmlApplicationContext("config/spring.cfg.xml"); iManager = (InventoryManager)ctx.GetObject("InventoryManager"); oManager = (OrderManager)ctx.GetObject("OrderManager"); newOrder = new Order(); curInventory = _i; bDialog = new BurritoDialog(curInventory); } catch (Exception e) { dLog.Debug("Exception | Unable to initialize business layer components: " + e.Message + "\n" + e.StackTrace); } InitializeComponent(); // Initialize the DataGridView. dataGridView1.AutoGenerateColumns = false; dataGridView1.AutoSize = true; // Initialize columns DataGridViewColumn column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "#"; column.Name = "#"; dataGridView1.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "Type"; column.Name = "Type"; dataGridView1.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "Price"; column.Name = "Price"; dataGridView1.Columns.Add(column); dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.ReadOnly = true; this.AutoSize = true; }
protected void SetUp() { XmlConfigurator.Configure(new FileInfo("config/log4net.properties")); dLog.Info("Beginning InventoryManagerTestCase Setup"); rand = new Random(); try { //iManager = new InventoryManager(); //oManager = new OrderManager(); //Spring.NET XmlApplicationContext ctx = new XmlApplicationContext("config/spring.cfg.xml"); iManager = (InventoryManager)ctx.GetObject("InventoryManager"); oManager = (OrderManager)ctx.GetObject("OrderManager"); i = new Inventory(rand.Next(), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250), rand.Next(10, 250)); o = new Order(rand.Next(), new List<Burrito>(), new DateTime(), false, false, new Decimal(0)); b = new Burrito(rand.Next(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), nextBool(), new Decimal(rand.NextDouble())); } catch (Exception e) { dLog.Error("Unable to initialize service/domain objects: " + e.Message + "\n" + e.StackTrace); } dLog.Info("Finishing InventoryManagerTestCase Setup"); }
/// <summary> /// /// </summary> public OrderViewUI() { try { //Spring.NET XmlApplicationContext ctx = new XmlApplicationContext("config/spring.cfg.xml"); oManager = (OrderManager)ctx.GetObject("OrderManager"); tOrders = oManager.getOrderHistories(); } catch (Exception e) { dLog.Debug("Exception | Unable to initialize business layer components: " + e.Message + "\n" + e.StackTrace); } InitializeComponent(); // Initialize the DataGridView. dataGridView1.AutoGenerateColumns = false; dataGridView1.AutoSize = true; // Initialize columns DataGridViewColumn column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "ID"; column.Name = "#"; dataGridView1.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "Date"; column.Name = "Date"; dataGridView1.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "BurritoName"; column.Name = "# of Burritos"; dataGridView1.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "Submitted"; column.Name = "Submitted"; dataGridView1.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "Complete"; column.Name = "Complete"; dataGridView1.Columns.Add(column); column = new DataGridViewTextBoxColumn(); column.DataPropertyName = "TotalCost"; column.Name = "Total Cost"; dataGridView1.Columns.Add(column); dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; dataGridView1.ReadOnly = true; this.AutoSize = true; try { //add all orders foreach (Order o in tOrders) { int n = dataGridView1.Rows.Add(); dataGridView1.Rows[n].Cells[0].Value = n; dataGridView1.Rows[n].Cells[1].Value = o.orderDate; dataGridView1.Rows[n].Cells[2].Value = o.burritos.Count; dataGridView1.Rows[n].Cells[3].Value = o.isSubmitted; dataGridView1.Rows[n].Cells[4].Value = o.isComplete; dataGridView1.Rows[n].Cells[5].Value = o.totalCost; } updateTotalSales(); } catch (Exception e) { dLog.Debug("Exception | Unable to initialize business layer components: " + e.Message + "\n" + e.StackTrace); } }