/// <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 PopulateTDCWarehouses() { // Populate the stock warehouse from warehouse table List <Warehouse> allWarehouses = WarehouseController.GetWarehouses(false); ddlStockWarehouse.DataSource = allWarehouses; ddlStockWarehouse.DataBind(); // Populate the delivery warehouse from warehouse table //ddlDeliveryWarehouse.DataSource = allWarehouses; //ddlDeliveryWarehouse.DataBind(); PopulateTDCDeliveryWarehouses(""); }
public void GetItems() { using (TransactionScope scope = new TransactionScope()) { //add a warehouse int id = WarehouseController.SaveWarehouse(PopulateNewItem()); if (id > -1) { //retrieve all warehouses and the one we saved should return at least List <Warehouse> warehouses = WarehouseController.GetWarehouses(); //so the count should be >0 Assert.IsTrue(warehouses.Count > 0); //check for our new id Assert.IsTrue(warehouses.Find(delegate(Warehouse currentItem) { return(currentItem.Id == id); }) != null); } } }
public void TestGetWarehouses() { using (TransactionScope ts = new TransactionScope()) { Warehouse warehouse = PopulateNewItem(); int Id1 = SaveItem(warehouse); warehouse.Id = -1; warehouse.Code = "Code2"; warehouse.Description = "Next One"; int Id2 = SaveItem(warehouse); List <Warehouse> warehouseList = WarehouseController.GetWarehouses(true); int NoOfRows = 0; foreach (Warehouse wh in warehouseList) { if (wh.Id == Id1 || wh.Id == Id2) { NoOfRows++; } } Assert.IsTrue(NoOfRows == 2); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { WarehouseController wc = new WarehouseController(); cboWarehouse.ItemsSource = wc.GetWarehouses(); }