public void GetMappingLookup() { using (TransactionScope scope = new TransactionScope()) { if (MappingController.DeleteAllMappings()) { if (MappingController.DeleteAllMappingSystems()) { if (MappingController.DeleteAllMappingPropertyAssociations()) { if (MappingController.DeleteAllMappingClassAssociations()) { Mapping mapping = PopulateMappingItem(); if (MappingController.SaveMapping(mapping) != -1) { //we have set the lookup table to be route so we should add a route and then when we get the lookup list //back it should include the RouteCode we save in the routing table Route route = RouteTests.PopulateNewItem(); if (RouteTests.SaveItem(route) != -1) { //get a list of route codes from the route table Dictionary <string, string> lookupList = MappingController.GetMappingLookup(mapping.MappingPropertyAssociationId); //so the count should be >0 Assert.IsTrue(lookupList.Count > 0); //check for our new id Assert.IsTrue(lookupList.ContainsValue(route.Description)); } } } } } } } }
/// <summary> /// Sets the up destination value drop down control. /// </summary> /// <param name="dropDownListDestinationProperty">The drop down list destination property.</param> private void SetUpDestinationValueDropDownControl(DropDownList dropDownListDestinationProperty) { int mappingPropertyAssociationId = Convert.ToInt32(dropDownListDestinationProperty.SelectedValue); Dictionary <string, string> lookupItems = MappingController.GetMappingLookup(mappingPropertyAssociationId); DropDownList dropDownDestinationValue = GetControl <DropDownList>("DropDownListDestinationValue", PageFormView); TextBox textBoxDestinationValue = GetControl <TextBox>("TextBoxDestinationValue", PageFormView); dropDownDestinationValue.Visible = (lookupItems.Count > 0); textBoxDestinationValue.Visible = (lookupItems.Count == 0); //if (dropDownDestinationValue.Visible) //{ // validation.AddValidation("DropDownListDestinationValue", "DestinationValue"); //} if (dropDownDestinationValue.Visible) { dropDownDestinationValue.Items.Clear(); if (lookupItems.Count != 1) { dropDownDestinationValue.Items.Add(new ListItem(null, null)); } //dropDownDestinationValue.DataSource = lookupItems; //dropDownDestinationValue.DataBind(); foreach (KeyValuePair <string, string> kvp in lookupItems) { dropDownDestinationValue.Items.Add(new ListItem(kvp.Value, kvp.Key)); } } }