/// <summary> /// Processes the request. /// </summary> /// <param name="requestMessage">The request message.</param> public override void ProcessRequest(RequestMessage requestMessage) { Trip.SetTripSchema(textFieldParser.TextFields); //get all warehouse objects in one hit for performance allWarehouses = WarehouseController.GetWarehouses(false); //get all regions in one hit for performance allRegions = OptrakRegionController.GetRegions(); try { textFieldParser.FirstLineIsHeader = true; textFieldParser.FileType = TextFieldParser.FileFormat.Delimited; textFieldParser.Delimiter = '|'; textFieldParser.TrimWhiteSpace = true; // Set up event handlers for when a row is read and when a row is read but failes to match the expected schema textFieldParser.RecordFound += new TextFieldParser.RecordFoundHandler(textParser_RecordFound); textFieldParser.RecordFailed += new TextFieldParser.RecordFailedHandler(RecordFailed); // parse the message textFieldParser.ParseFileContents(requestMessage.Body); // Processed Status = SaveTrips(); } catch (Exception ex) { // Store the exception LastError = ex; // Failed Status = SubscriberStatusEnum.Failed; } }
private void PopulateRegions() { // Get the region drop down DropDownList dropDownListRegion = GetControl <DropDownList>("ddlRegion", PageFormView); DropDownList dropDownListWarehouse = GetControl <DropDownList>("ddlWarehouse", PageFormView); // Populate the list of regions dropDownListRegion.DataSource = OptrakRegionController.GetRegions(); dropDownListRegion.DataBind(); // Now add the all dropDownListRegion.Items.Insert(0, new ListItem("All", "-1")); dropDownListWarehouse.Items.Insert(0, new ListItem("All", "-1")); // Now disable the warehouse dropDownListWarehouse.Items[0].Selected = true; dropDownListWarehouse.Enabled = false; }
public void GetItems() { using (TransactionScope scope = new TransactionScope()) { //add a region int id = OptrakRegionController.SaveRegion(PopulateNewItem()); if (id > -1) { //retrieve all regions and the one we saved should return at least List <OptrakRegion> regions = OptrakRegionController.GetRegions(); //so the count should be >0 Assert.IsTrue(regions.Count > 0); //check for our new id Assert.IsTrue(regions.Find(delegate(OptrakRegion currentItem) { return(currentItem.Id == id); }) != null); } } }