示例#1
0
        private void FindLeasesByDebtorID(string debtorID)
        {
            DataTable dataTable = controller.ReadLeasesByDebtorID(debtorID);

            if (dataTable.Rows.Count == 0)
            {
                MessageBox.Show("Der blev ikke fundet nogle ordrer, prøv at indtaste kundenummeret igen.");
                return;
            }

            FormSelectFromTable formSelectFromTable = new FormSelectFromTable();

            formSelectFromTable.ShowResources(dataTable);
            formSelectFromTable.SetTitle("Vælg ordre");
            var result = formSelectFromTable.ShowDialog();

            if (result == DialogResult.OK)
            {
                int leaseID = formSelectFromTable.returnValue;

                GetLeaseByLeaseID(leaseID);
                createLease.Enabled  = false;
                updateLease.Enabled  = true;
                deleteLease.Enabled  = true;
                updateStatus.Enabled = true;
                writeInvoice.Enabled = true;
            }
        }
示例#2
0
        private void SelectResource(int resourceID, FormSelectFromTable formSelectFromTable)
        {
            leaseOrders.Rows.Add();
            int lastRow = leaseOrders.Rows.GetLastRow(DataGridViewElementStates.Visible);

            leaseOrders.Rows[lastRow].Cells["ResurseID"].Value     = resourceID;
            leaseOrders.Rows[lastRow].Cells["Resurse"].Value       = formSelectFromTable.modelName;
            leaseOrders.Rows[lastRow].Cells["Leveringsdato"].Value = DeliveryDate.Value.ToString("yyyy/MM/dd");
            leaseOrders.Rows[lastRow].Cells["Slutdato"].Value      = ReturnDate.Value.ToString("yyyy/MM/dd");
            leaseOrders.Rows[lastRow].Cells["Dagspris"].Value      = formSelectFromTable.dailyPrice.ToString("N2");

            leaseOrders.Rows[lastRow].Cells["Gade"].Value     = deliveryAddressTextBox.Text;
            leaseOrders.Rows[lastRow].Cells["Postkode"].Value = deliveryPostCodeTextBox.Text;
            leaseOrders.Rows[lastRow].Cells["By"].Value       = deliveryCityTextBox.Text;

            int    weight        = Convert.ToInt32(esourcesDataGridView.Rows[esourcesDataGridView.SelectedRows[0].Index].Cells["WeightKG"].Value);
            double deliveryPrice = GetDeliveryPrice(Convert.ToInt32(deliveryZoneComboBox.Text), weight);

            leaseOrders.Rows[lastRow].Cells["Levering"].Value = deliveryPrice.ToString("N2");
        }
示例#3
0
        private void AddResourceToLease(int modelID)
        {
            DateTime startDate = DeliveryDate.Value;
            DateTime endDate   = ReturnDate.Value;

            DataTable dataTable = controller.GetAvailableResourcesForPeriod(modelID, Utility.BranchID, startDate.ToString("yyyy-MM-dd"), endDate.ToString("yyyy-MM-dd"));

            Dictionary <string, string> dictionary = GetLeaseOrdersThatClashWithDates();

            dataTable = SetBookedItems(dataTable, dictionary);

            FormSelectFromTable formSelectFromTable = new FormSelectFromTable();

            formSelectFromTable.ShowResources(dataTable);
            formSelectFromTable.SetTitle("Vælg resurse");
            var result = formSelectFromTable.ShowDialog();

            if (result == DialogResult.OK)
            {
                int resourceID = formSelectFromTable.returnValue;

                SelectResource(resourceID, formSelectFromTable);
            }
        }