Ejemplo n.º 1
0
        private void RefreshView()
        {
            foreach (ListViewItem lvItem in pickingListView.Items)
            {
                pickingListView.Items.Remove(lvItem);
            }

            pickingList = InvoiceDatabase.GetAllInvoices();

            foreach (Invoice l in pickingList)
            {
                pickingListView.Items.Add(new ListViewItem(new String[] { l.InvoiceID.ToString(), l.customer.StoreName, l.customer.StreetAddress }));
            }

            pickingListView.Columns[2].Width = 180;
            if (pickingListView.Items.Count != 0)
            {
                pickingListView.EnsureVisible(pickingListView.Items.Count - 1);
            }
        }
Ejemplo n.º 2
0
        private void SetupLists()
        {
            Label pickingLabel = new System.Windows.Forms.Label();

            pickingLabel.AutoSize = true;
            pickingLabel.Font     = new System.Drawing.Font("Microsoft Sans Serif", 13.875F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            pickingLabel.Location = new System.Drawing.Point(210, 95);
            pickingLabel.Size     = new System.Drawing.Size(238, 42);
            pickingLabel.TabIndex = 0;
            pickingLabel.Text     = "INVOICES";
            this.Controls.Add(pickingLabel);

            pickingListView.Size     = new Size(500, 450);
            pickingListView.Location = new Point(50, 120);

            pickingListView.Columns.Add("Local Invoice ID", -2, HorizontalAlignment.Left);
            pickingListView.Columns.Add("Customer Name", 200, HorizontalAlignment.Left);
            pickingListView.Columns.Add("Shipping Address", 200, HorizontalAlignment.Left);

            pickingListView.GridLines     = true;
            pickingListView.Scrollable    = true;
            pickingListView.FullRowSelect = true;
            pickingListView.View          = System.Windows.Forms.View.Details;
            pickingListView.DoubleClick  += PickingListView_DoubleClick;
            pickingListView.Enter        += PickingListView_Enter;
            this.Controls.Add(pickingListView);


            Button refreshButton = new Button();

            refreshButton.Location = new Point(50, 60);
            refreshButton.Size     = new Size(70, 40);
            refreshButton.Text     = "Refresh";
            refreshButton.Click   += RefreshButton_Click;
            this.Controls.Add(refreshButton);


            Button deleteButton = new Button();

            deleteButton.Location = new Point(225, 600);
            deleteButton.Size     = new Size(70, 40);
            deleteButton.Text     = "Delete";
            deleteButton.Click   += DeleteButton_Click;
            this.Controls.Add(deleteButton);


            Button printButton = new Button();

            printButton.Location = new Point(305, 600);
            printButton.Size     = new Size(60, 40);
            printButton.Text     = "Print";
            printButton.Click   += PrintButton_Click;
            this.Controls.Add(printButton);

            pickingList = InvoiceDatabase.GetAllInvoices();

            foreach (Invoice l in pickingList)
            {
                pickingListView.Items.Add(new ListViewItem(new String[] { l.InvoiceID.ToString(), l.customer.StoreName, l.customer.StreetAddress }));
            }
        }