//Constructor public FreightReportCreator(string title, List<Order> orders) { this.dbManager = new DatabaseManager(); grandTotal = 0; this.title = title; this.orders = orders; }
public FileExportForm(Form1 form1) { InitializeComponent(); this.StartPosition = FormStartPosition.CenterScreen; this.form1 = form1; dbManager = new DatabaseManager(); fileManager = new FileManager(); }
//Constructor public SalesReportCreator(string title, List<Order> orders, int[] booksPerOrder, double[] pricePerOrder) { this.dbManager = new DatabaseManager(); grandTotal = 0; indexOfArrays = 0; this.title = title; this.orders = orders; this.booksPerOrder = booksPerOrder; this.pricePerOrder = pricePerOrder; }
/*Precondition: Postcondition: Setup and initialize everything needed */ private void setup() { //Intialization of globals dbManager = new DatabaseManager(); fileManager = new FileManager(); foundCustomers = new List<Customer>(); allCustomers = new List<Customer>(); currCustomer = null; newCustAndHaventRefreshed = false; //Set up column widths DataGridViewColumn colFirstName = dataGridView1.Columns[0]; colFirstName.Width = 110; DataGridViewColumn colLastName = dataGridView1.Columns[1]; colLastName.Width = 110; DataGridViewColumn colAdd1 = dataGridView1.Columns[2]; colAdd1.Width = 120; DataGridViewColumn colAdd2 = dataGridView1.Columns[3]; colAdd2.Width = 120; DataGridViewColumn colCountry = dataGridView1.Columns[4]; colCountry.Width = 60; DataGridViewColumn colEmail = dataGridView1.Columns[5]; colEmail.Width = 182; //Set focus to first name box boxSearchFirstName.Select(); //Setup event handlers for when enter is pressed while on textboxes boxSearchCustID.KeyPress += TextBox_KeyPress_Enter; boxSearchFirstName.KeyPress += TextBox_KeyPress_Enter; boxSearchLastName.KeyPress += TextBox_KeyPress_Enter; boxSearchInstiution.KeyPress += TextBox_KeyPress_Enter; boxSearchEmail.KeyPress += TextBox_KeyPress_Enter; }
/*Precondition: Postcondition: Sets up and initialises everything needed */ private void setup() { foundStock = new List<Stock>(); dbManager = new DatabaseManager(); DataGridViewColumn column1 = dataGridView1.Columns[0]; column1.Width = 50; DataGridViewColumn column2 = dataGridView1.Columns[1]; column2.Width = 200; DataGridViewColumn column3 = dataGridView1.Columns[2]; column3.Width = 300; DataGridViewColumn column4 = dataGridView1.Columns[3]; column4.Width = 200; DataGridViewColumn column5 = dataGridView1.Columns[4]; column5.Width = 60; DataGridViewColumn column6 = dataGridView1.Columns[5]; column6.Width = 75; boxBookID.Select(); boxBookID.KeyPress += TextBox_KeyPress_Enter; boxAuthor.KeyPress += TextBox_KeyPress_Enter; boxTitle.KeyPress += TextBox_KeyPress_Enter; boxSubject.KeyPress += TextBox_KeyPress_Enter; }
/*Precondition: Postcondition: Sets up and initialises everything needed */ private void setup() { dbManager = new DatabaseManager(); tabPress = false; //Setup Event Handler for textboxes to highlight text when they are entered if tab was pressed boxFirstName.Enter += textbox_Enter; boxLastName.Enter += textbox_Enter; boxInstitution.Enter += textbox_Enter; boxAddress1.Enter += textbox_Enter; boxAddress2.Enter += textbox_Enter; boxAddress3.Enter += textbox_Enter; boxPostcode.Enter += textbox_Enter; boxCountry.Enter += textbox_Enter; boxEmail.Enter += textbox_Enter; boxComments.Enter += textbox_Enter; boxSales.Enter += textbox_Enter; boxPayment.Enter += textbox_Enter; boxFirstName.Select(); }
private void setup() { dbManager = new DatabaseManager(); fileManager = new FileManager(); allStock = new List<Stock>(); allCustomers = new List<Customer>(); allOrders = new List<Order>(); allOrderedStock = new List<OrderedStock>(); }
/*Precondition: Postcondition: Setup and initialize everything needed */ private void setup() { fileManager = new FileManager(); dbManager = new DatabaseManager(); }
/*Precondition: Postcondition: Does setup and initializes everything needed*/ private void setup() { //Initialize globals dbManager = new DatabaseManager(); allOrders = new List<Order>(); allOrderedStock = new List<OrderedStock>(); currOrderedStock = new List<OrderedStock>(); newOrderedStock = new List<OrderedStock>(); fileManager = new FileManager(); currCustomer = null; currOrder = null; canEdit = false; boxOrderSearchID.Select(); //Set up column widths DataGridViewColumn colQuantity = dataGridView1.Columns[0]; colQuantity.Width = 50; DataGridViewColumn colAuthor = dataGridView1.Columns[1]; colAuthor.Width = 187; DataGridViewColumn colTitle = dataGridView1.Columns[2]; colTitle.Width = 270; DataGridViewColumn colPrice = dataGridView1.Columns[3]; colPrice.Width = 75; DataGridViewColumn colBookID = dataGridView1.Columns[4]; colBookID.Width = 75; DataGridViewColumn colDiscount = dataGridView1.Columns[5]; colDiscount.Width = 75; loadNewestOrder(); //If this form was opened through customers orders then remove unneccessary controls and adjust form if (mainMenu == null) { labOrderID.Visible = false; boxOrderSearchID.Visible = false; btnSearch.Enabled = false; btnSearch.Visible = false; btnNewestOrder.Enabled = false; btnNewestOrder.Visible = false; btnNewOrder.Enabled = false; btnNewOrder.Visible = false; btnPrev.Enabled = false; btnPrev.Visible = false; btnNext.Enabled = false; btnNext.Visible = false; btnMainMenu.Text = "Close"; groupBox1.Left = groupBox1.Left - 50; btnAddBook.Left = btnAddBook.Left - 50; btnMainMenu.Left = btnMainMenu.Left - 50; btnCreateInvoice.Left = btnCreateInvoice.Left - 40; btnBigMailingLabel.Left = btnBigMailingLabel.Left - 40; btnSmallMailingLabel.Left = btnSmallMailingLabel.Left - 40; labMailingLabels.Left = labMailingLabels.Left - 40; Width = Width - 50; } }
/*Precondition: Postcondition: Sets up everything that needs to be done when form is initialized*/ private void setup() { dbManager = new DatabaseManager(); customersOrders = new List<Order>(); labCustomerName.Text = "Orders for: " + currCustomer.firstName + " " + currCustomer.lastName; //Set up column widths DataGridViewColumn colOrderID = dataGridView1.Columns[0]; colOrderID.Width = 100; DataGridViewColumn colRef = dataGridView1.Columns[1]; colRef.Width = 100; DataGridViewColumn colInvoiceDate = dataGridView1.Columns[2]; colInvoiceDate.Width = 100; //Set column widths of 2nd datagridview DataGridViewColumn colQuantity = dataGridView2.Columns[0]; colQuantity.Width = 50; DataGridViewColumn colAuthor = dataGridView2.Columns[1]; colAuthor.Width = 187; DataGridViewColumn colTitle = dataGridView2.Columns[2]; colTitle.Width = 270; DataGridViewColumn colPrice = dataGridView2.Columns[3]; colPrice.Width = 75; DataGridViewColumn colBookID = dataGridView2.Columns[4]; colBookID.Width = 75; DataGridViewColumn colDiscount = dataGridView2.Columns[5]; colDiscount.Width = 75; //Find the customers orders customersOrders = dbManager.searchCustomersOrders(currCustomer.custID); //Set up first order from customer if they have any orders if (customersOrders.Count > 0) { currOrder = customersOrders[0]; foreach (Order o in customersOrders) { dataGridView1.Rows.Add(o.orderID, o.orderReference, o.invoiceDate); } selectedOrderUpdated(); } }
/*Precondition: Postcondition: Sets up everything needed when form is initialized*/ private void setup() { foundCustomers = new List<Customer>(); dbManager = new DatabaseManager(); //Set up column widths DataGridViewColumn colFirstName = dataGridView1.Columns[0]; colFirstName.Width = 110; DataGridViewColumn colLastName = dataGridView1.Columns[1]; colLastName.Width = 110; DataGridViewColumn colAdd1 = dataGridView1.Columns[2]; colAdd1.Width = 120; DataGridViewColumn colAdd2 = dataGridView1.Columns[3]; colAdd2.Width = 120; DataGridViewColumn colCountry = dataGridView1.Columns[4]; colCountry.Width = 60; DataGridViewColumn colEmail = dataGridView1.Columns[5]; colEmail.Width = 182; //Give focus to firstname box boxFirstName.Select(); //Setup keypress handler for when enter is pressed in textboxes boxCustID.KeyPress += TextBox_KeyPress_Enter; boxFirstName.KeyPress += TextBox_KeyPress_Enter; boxLastName.KeyPress += TextBox_KeyPress_Enter; boxInstiution.KeyPress += TextBox_KeyPress_Enter; boxEmail.KeyPress += TextBox_KeyPress_Enter; }
/*Precondition: Postcondition: Sets up everything needed */ private void setup() { fileManager = new FileManager(); dbManager = new DatabaseManager(); dateTimePicker1.Format = DateTimePickerFormat.Custom; dateTimePicker1.CustomFormat = "MMMM/yyyy"; dateTimePicker1.ShowUpDown = true; }
/*Precondition: Postcondition: Sets up and initialises everthing needed */ private void setup() { //Initialize globals orderedBooks = new List<Stock>(); dbManager = new DatabaseManager(); fileManager = new FileManager(); tabPress = false; //Setup event handlers for when textboxes are entered boxOrderRef.Enter += textbox_Enter; boxProgress.Enter += textbox_Enter; boxInvoiceDate.Enter += textbox_Enter; boxFreight.Enter += textbox_Enter; boxComments.Enter += textbox_Enter; //Set up column widths DataGridViewColumn colQuantity = dataGridView1.Columns[0]; colQuantity.Width = 50; DataGridViewColumn colAuthor = dataGridView1.Columns[1]; colAuthor.Width = 187; DataGridViewColumn colTitle = dataGridView1.Columns[2]; colTitle.Width = 270; DataGridViewColumn colPrice = dataGridView1.Columns[3]; colPrice.Width = 75; DataGridViewColumn colBookID = dataGridView1.Columns[4]; colBookID.Width = 75; DataGridViewColumn colDiscount = dataGridView1.Columns[5]; colDiscount.Width = 75; //Make it so that user can't enter information into blank row dataGridView1.Rows[0].ReadOnly = true; //Display the OrderID/Invoice number for the user boxInvoiceNo.Text = dbManager.getNextOrderID().ToString(); string date = DateTime.Now.ToString("d/MM/yyyy"); boxInvoiceDate.Text = date; btnFindCustomer.Select(); if (ordersForm == null) { btnFindCustomer.Enabled = false; btnFindCustomer.Visible = false; btnNewCustomer.Enabled = false; btnNewCustomer.Visible = false; } }
/*Precondition: Postcondition: Initializes and checks to see if files can be imported */ private void setup() { fileManager = new FileManager(); dbManager = new DatabaseManager(); if (!fileManager.checkForImportStorageLocation()) { importFileLocation = fileManager.getStorageFilePath(); canImport = false; MessageBox.Show("Please Set import location before trying to import"); } else { canImport = true; } }