Esempio n. 1
0
 private void btn_opret_Click(object sender, EventArgs e)
 {
     try
     {
         CustomerControllerSingleton.Instance().CreateCustomer(new Customer(txt_Navn.Text,
                                                                            txt_Adresse.Text,
                                                                            Convert.ToInt32(txt_TlfNr.Text),
                                                                            Convert.ToInt32(txt_Postnummer.Text)
                                                                            ));
         MessageBox.Show("Kunde oprettet");
         this.Close();
     }
     catch (Exception)
     {
         MessageBox.Show("Fejl i kundeoprettelse. Prøv igen.");
     }
 }
        private void btn_soeg_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource    = CustomerControllerSingleton.Instance().GetGridCustomerData(tbt_name.Text).Customers.Local.ToBindingList();
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.Columns["CustomerId"].HeaderText     = "Kundenummer";
            dataGridView1.Columns["Name"].HeaderText           = "Navn";
            dataGridView1.Columns["Address"].HeaderText        = "Adresse";
            dataGridView1.Columns["PhoneNr"].HeaderText        = "Tlf. Nr.";
            dataGridView1.Columns["Zipcode"].HeaderText        = "Postnummer";
            dataGridView1.Columns["ZipCodeNavigation"].Visible = false;
            dataGridView1.Columns["CaseOrderBuyers"].Visible   = false;
            dataGridView1.Columns["CaseOrderSellers"].Visible  = false;

            this.dataGridView1.Columns["ZipCodeNavigation"].Visible = false;
            this.dataGridView1.Columns["CaseOrderBuyers"].Visible   = false;
            this.dataGridView1.Columns["CaseOrderSellers"].Visible  = false;
        }
        private void bt_GetAllCustAdmin_Click(object sender, EventArgs e)
        {
            dataGridView_CustAdmin.DataSource = CustomerControllerSingleton.Instance().GetGridCustomerData("").Customers.Local.ToBindingList();


            dataGridView_CustAdmin.Columns["CustomerId"].HeaderText        = "Kundenummer";
            dataGridView_CustAdmin.Columns["Name"].HeaderText              = "Navn";
            dataGridView_CustAdmin.Columns["Address"].HeaderText           = "Adresse";
            dataGridView_CustAdmin.Columns["PhoneNr"].HeaderText           = "Telefonnummer";
            dataGridView_CustAdmin.Columns["ZipCode"].HeaderText           = "Postnummer";
            dataGridView_CustAdmin.Columns["ZipCodeNavigation"].HeaderText = "PostnummerNavigation";
            dataGridView_CustAdmin.Columns["CaseOrderBuyers"].HeaderText   = "SagsOrdreKøbere";
            dataGridView_CustAdmin.Columns["CaseOrderSellers"].HeaderText  = "SagsOrdreSælgere";

            this.dataGridView_CustAdmin.Columns["ZipCodeNavigation"].Visible = false;
            this.dataGridView_CustAdmin.Columns["CaseOrderBuyers"].Visible   = false;
            this.dataGridView_CustAdmin.Columns["CaseOrderSellers"].Visible  = false;
        }
 private void bt_saveCustAdmin_Click(object sender, EventArgs e)
 {
     CustomerControllerSingleton.Instance().SaveDBContext();
 }
Esempio n. 5
0
        private void UpdateAdminCase()
        {
            co = CaseOrderControllerSingleton.Instance().GetCaseOrder(Convert.ToInt32(txt_caseOrderID.Text));
            if (co == null)
            {
                throw new Exception();
            }

            Customer seller = CustomerControllerSingleton.Instance().GetCustomer(co.SellerId);

            if (co.CaseStatusId == 3)
            {
                Customer buyer = CustomerControllerSingleton.Instance().GetCustomer(co.BuyerId);
                tableLayoutPanel_buyerInfo.Visible = true;
                lbl_KoeberNavn.Text        = buyer.Name;
                lbl_KoeberKundenummer.Text = buyer.CustomerId.ToString();
                lbl_KoeberAdresse.Text     = buyer.Address;
                lbl_KoeberTlfNr.Text       = buyer.PhoneNr.ToString();
                lbl_KoeberPostnummer.Text  = buyer.ZipCode.ToString();
                lbl_KoeberBy.Text          = CustomerControllerSingleton.Instance().GetCityFromZipCode(buyer.ZipCode).ToString();
            }
            else
            {
                tableLayoutPanel_buyerInfo.Visible = false;
            }
            lbl_SælgerKundenummer.Text = seller.CustomerId.ToString();
            lbl_SælgerNavn.Text        = seller.Name;
            lbl_SælgerAdresse.Text     = seller.Address;
            lbl_SælgerPostnummer.Text  = seller.ZipCode.ToString();
            lbl_SælgerTlfNr.Text       = seller.PhoneNr.ToString();
            lbl_SælgerBy.Text          = CustomerControllerSingleton.Instance().GetCityFromZipCode(seller.ZipCode).ToString();

            dataGridView_HouseInformation.DataSource = EstateControllerSingleton.Instance().GetEstate(co.EstateId);
            dataGridView_PriceHistory.DataSource     = CaseOrderControllerSingleton.Instance().GetPriceHistory(co.EstateId);


            dataGridView_HouseInformation.Columns["EstateId"].HeaderText          = "EjendomsId";
            dataGridView_HouseInformation.Columns["Address"].HeaderText           = "Adresse";
            dataGridView_HouseInformation.Columns["BuildYear"].HeaderText         = "HusetsByggelsesår";
            dataGridView_HouseInformation.Columns["RemodelYear"].HeaderText       = "RenoveringsÅr";
            dataGridView_HouseInformation.Columns["Condition"].HeaderText         = "Stand";
            dataGridView_HouseInformation.Columns["Areal"].HeaderText             = "Areal";
            dataGridView_HouseInformation.Columns["Rooms"].HeaderText             = "Rum";
            dataGridView_HouseInformation.Columns["Floors"].HeaderText            = "Etager";
            dataGridView_HouseInformation.Columns["Garden"].HeaderText            = "Have";
            dataGridView_HouseInformation.Columns["ZipCode"].HeaderText           = "Postnummer";
            dataGridView_HouseInformation.Columns["TypeId"].HeaderText            = "TypeId";
            dataGridView_HouseInformation.Columns["Type"].HeaderText              = "Type";
            dataGridView_HouseInformation.Columns["ZipCodeNavigation"].HeaderText = "PostnummerNavigation";
            dataGridView_HouseInformation.Columns["CaseOrders"].HeaderText        = "SagsOrdre";
            dataGridView_HouseInformation.Columns["PriceHistories"].HeaderText    = "PrisHistorik";


            this.dataGridView_HouseInformation.Columns["ZipCodeNavigation"].Visible = false;
            this.dataGridView_HouseInformation.Columns["Type"].Visible           = false;
            this.dataGridView_HouseInformation.Columns["CaseOrders"].Visible     = false;
            this.dataGridView_HouseInformation.Columns["PriceHistories"].Visible = false;


            dataGridView_PriceHistory.Columns["PriceHistoryId"].HeaderText = "PrisHistorik";
            dataGridView_PriceHistory.Columns["Price"].HeaderText          = "Pris";
            dataGridView_PriceHistory.Columns["Date"].HeaderText           = "Dato";
            dataGridView_PriceHistory.Columns["PriceType"].HeaderText      = "PrisType";
            dataGridView_PriceHistory.Columns["EstateId"].HeaderText       = "EjendomsId";
            dataGridView_PriceHistory.Columns["Estate"].HeaderText         = "Ejendom";

            this.dataGridView_PriceHistory.Columns["Estate"].Visible = false;
        }