private void SetCustomerType()
        {
            if (RadioButtonListBuyOrSell.SelectedIndex == 0)
            {
                LabelCustomerType.Text        = "Creditor";
                LabelMaterialInvoiceType.Text = "Buy";
            }
            else
            {
                LabelCustomerType.Text        = "Debtor";
                LabelMaterialInvoiceType.Text = "Sell";
            }

            EntityDataSourceCustomers.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SetName = "Freight";

            if (!IsPostBack)
            {
                Common.AddFreightOurRoleTypeList(ComboBox_TransportRole_SelectedValue.Items, true);
                Common.AddFreightTransportNotificationTransportType(ComboBox_TransportNotificationTransportType_SelectedValue.Items, true);
                Common.AddFreightTransportNotificationRemovalType(ComboBox_TransportNotificationRemovalType_SelectedValue.Items, true);
                Common.AddWrappingTypeList(ComboBox_TransportWrapping_SelectedValue.Items, true);
                Common.AddDCodeList(ComboBox_TransportDRCode_SelectedValue.Items, true, true);
                Common.AddRCodeList(ComboBox_TransportDRCode_SelectedValue.Items, false, false);
                Common.AddDCodeList(ComboBox_TransportDestructionAction_SelectedValue.Items, true, true);
                Common.AddRCodeList(ComboBox_TransportDestructionAction_SelectedValue.Items, false, false);
                Common.AddTransportTypeList(ComboBox_TransportType_SelectedValue.Items, true);

                if (Request.Params["FreightId"] != null)
                {
                    KeyID = new Guid(Request.Params["FreightId"]);
                }

                Freight frg = DataItem as Freight;

                // check if this freight has to be initialised
                if (frg != null)
                {
                    LabelCustomerType.Text = frg.FreightDirection == "To warehouse" ? "Creditor" : "Debtor";
                    EntityDataSourceCustomers.DataBind();

                    if ((frg.TransportSourceCustomer == null) && (frg.TransportDestinationCustomer == null))
                    {
                        // initialise freight
                        frg.TransportSourceCustomer         = frg.FreightDirection == "To warehouse" ? frg.FromRelation : null;
                        frg.TransportUltimateSourceCustomer = frg.TransportSourceCustomer;
                        frg.TransportCompanyCustomer        = null;
                        frg.TransportDestinationCustomer    = frg.FreightDirection == "To warehouse" ? null : frg.FromRelation;
                        frg.TransportDestructorCustomer     = frg.TransportDestinationCustomer;
                        ControlObjectContext.SaveChanges();
                    }

                    RebindControls();
                }
            }
        }
 protected void DropDownListLocations_SelectedIndexChanged(object sender, EventArgs e)
 {
     EntityDataSourceCustomers.DataBind();
 }