Esempio n. 1
0
        private void button_recept_Click(object sender, EventArgs e)
        {
            Item prescriptionItem = (Item)comboBox_recept.SelectedItem;

            SaleItemForm saleItemForm = new SaleItemForm(prescriptionItem, null, null);

            saleItemForm.RemovePriceOption();

            if (saleItemForm.ShowDialog() == DialogResult.OK)
            {
                int amount = saleItemForm.saleLineItem.amount;

                DateTime prescriptionDay = DateTime.Now;
                bool     payed           = false;
                Employee employee        = treatment.employee;
                Animal   animal          = treatment.animal;
                Item     item            = prescriptionItem;

                Prescription prescription = PrescriptionFactory.Instance().CreatePrescription(amount, prescriptionDay, payed, employee, animal, item);

                try
                {
                    BossController.Instance().animalController.CreatePrescription(prescription);
                }
                catch (Exception exception)
                {
                    string errorMessage = ErrorManager.Instance().GetErrorMessage(exception);
                    MessageBox.Show(errorMessage);
                    return;
                }

                MessageBox.Show(prescription.item.name.ToString() + " Udstedet til " + animal.name.ToString());
            }
        }
Esempio n. 2
0
        private void FillItemList(Item item, Prescription prescription, Treatment treatment, int amount = -1)
        {
            SaleItemForm saleItemForm = new SaleItemForm(item, prescription, treatment, amount);

            if (saleItemForm.ShowDialog() == DialogResult.OK)
            {
                SaleLineItem saleLineItem = saleItemForm.saleLineItem;

                if (sale == null)
                {
                    sale = SaleFactory.Instance().CreateSale(customer, DateTime.Now);
                }

                sale.AddSaleLineItem(saleLineItem);
                LoadeItemList();
                EndButton.Enabled = true;
            }
        }