示例#1
0
        public ShowBooking(int bookingID)
        {
            InitializeComponent();
            dtpDeliveryDate.Visible  = false;
            dtpRetrievalDate.Visible = false;
            coboSalesRep.Enabled     = false;
            btnSaveBooking.Visible   = false;
            btnCancel.Visible        = false;
            List <TextBox> textBoxList = new List <TextBox>
            {
                txtName1, txtName2, txtATT, txtAdresss, txtZipCode, txtCity, txtPhone,
                txtDeliveryDate, txtRetrievalDate, txtCarrier, txtMessageToWorkshop,
                txtDeliveryNote, txtConfigs
            };

            foreach (TextBox t in textBoxList)
            {
                t.ReadOnly = true;
            }
            rbtnNo.Enabled  = false;
            rbtnYes.Enabled = false;
            List <string>  customers         = CC.GetCustomer(bookingID);
            List <TextBox> customerTextboxes = new List <TextBox>()
            {
                txtName1, txtName2, txtATT, txtAdresss, txtZipCode, txtCity, txtPhone
            };

            int i = 0;

            foreach (string s in customers)
            {
                if (s == "Denmark" || s == "Sweden")
                {
                    coboCountry.Text = s;
                }
                else
                {
                    customerTextboxes[i].Text = s;
                    i++;
                }
            }


            List <string> booking = CC.GetBooking(bookingID);

            coboSalesRep.Text = CC.GetOneSalesRep(bookingID);
            List <TextBox> bookingTextboxes = new List <TextBox>()
            {
                txtDeliveryDate, txtRetrievalDate, txtCarrier, txtMessageToWorkshop, txtDeliveryNote
            };

            i = 0;
            foreach (TextBox t in bookingTextboxes)
            {
                t.Text = booking[i];
                i++;
            }

            if (booking[i] == "1")
            {
                rbtnYes.Checked = true;
                rbtnNo.Checked  = false;
            }

            else
            {
                rbtnNo.Checked  = true;
                rbtnYes.Checked = false;
            }

            List <string> machines = CC.GetMachines(bookingID);

            foreach (string s in machines)
            {
                libBookingMachines.Items.Add(s);
            }

            txtConfigs.Text = CC.GetConfigs(bookingID);
            BookingIDs      = bookingID;
        }