Example #1
0
 private static void UpdateVehicle(Model.Vehicle vehicleEntity, WC.Table table)
 {
     vehicleEntity.Year          = GetCellByLabel <int>(table, "Year:", true);
     vehicleEntity.Make          = GetCellByLabel(table, "Make:");
     vehicleEntity.Model         = GetCellByLabel(table, "Model:");
     vehicleEntity.TrimLevel     = GetCellByLabel(table, "Trim Level:");
     vehicleEntity.Odometer      = GetCellByLabel <int>(table, "Odometer:", true);
     vehicleEntity.InServiceDate = GetCellByLabel(table, "In-Service Date:");
     vehicleEntity.FuelType      = GetCellByLabel(table, "Fuel Type:");
     vehicleEntity.Engine        = GetCellByLabel(table, "Engine:");
     vehicleEntity.Displacement  = GetCellByLabel(table, "Displacement:");
     vehicleEntity.Transmission  = GetCellByLabel(table, "Transmission:");
     vehicleEntity.ExteriorColor = GetCellByLabel(table, "Exterior Color:");
     vehicleEntity.InteriorColor = GetCellByLabel(table, "Interior Color:");
     vehicleEntity.WindowSticker = GetCellByLabel(table, "Window Sticker:");
     vehicleEntity.VIN           = GetCellByLabel(table, "VIN:");
     vehicleEntity.BodyStyle     = GetCellByLabel(table, "Body Style:");
     vehicleEntity.Doors         = GetCellByLabel <int>(table, "Doors:", true);
     vehicleEntity.VehicleType   = GetCellByLabel(table, "Vehicle Type:");
     vehicleEntity.Salvage       = GetCellByLabel(table, "Salvage:") != "No";
     vehicleEntity.TitleState    = GetCellByLabel(table, "Title State:");
     vehicleEntity.TitleStatus   = GetCellByLabel(table, "Title Status:");
     vehicleEntity.DriveTrain    = GetCellByLabel(table, "Drive Train:");
     vehicleEntity.InteriorType  = GetCellByLabel(table, "Interior Type:");
     vehicleEntity.TopType       = GetCellByLabel(table, "Top Type:");
     vehicleEntity.Stereo        = GetCellByLabel(table, "Stereo:");
     vehicleEntity.Airbags       = GetCellByLabel(table, "Airbags:");
 }
Example #2
0
 private static Model.Vehicle SetVehicle(WC.Table table)
 {
     Model.Vehicle vehicleEntity;
     vehicleEntity = new Model.Vehicle();
     UpdateVehicle(vehicleEntity, table);
     return(vehicleEntity);
 }
Example #3
0
        private static T GetCellByLabel <T>(WC.Table table, string labelText, bool isNumeric = false)
        {
            var label = table.ElementWithTag("th", WC.Find.ByText(labelText));

            if (!label.Exists)
            {
                throw new WC.Exceptions.ElementNotFoundException("th", "Text=" + labelText, "", table);
            }
            string text = label.NextSibling.Text;

            if (isNumeric)
            {
                text = Regex.Replace(label.NextSibling.Text, @"[^\d.]", "");
                if (string.IsNullOrEmpty(text))
                {
                    text = "0";
                }
            }
            return((T)Convert.ChangeType(text, typeof(T)));
        }
Example #4
0
 private static string GetCellByLabel(WC.Table table, string labelText)
 {
     return(GetCellByLabel <string>(table, labelText));
 }