public void SetDropSchema() { TextFieldCollection fields = new TextFieldCollection(); ShipmentDrop.SetDropSchema(fields); Assert.IsTrue(fields.Count == 19); Assert.IsTrue(fields["TripNumber"] != null); Assert.IsTrue(fields["OrderSequence"] != null); Assert.IsTrue(fields["OriginalCustomerCode"] != null); Assert.IsTrue(fields["ShipmentNumberAndDespatch"] != null); Assert.IsTrue(fields["Weight"] != null); Assert.IsTrue(fields["Volume"] != null); Assert.IsTrue(fields["ArriveTime"] != null); Assert.IsTrue(fields["DepartTime"] != null); Assert.IsTrue(fields["LoadingTime"] != null); Assert.IsTrue(fields["WaitingTime"] != null); Assert.IsTrue(fields["TravellingTime"] != null); Assert.IsTrue(fields["Distance"] != null); Assert.IsTrue(fields["CallType"] != null); Assert.IsTrue(fields["MatrixCost"] != null); Assert.IsTrue(fields["WorstError"] != null); Assert.IsTrue(fields["DropSequence"] != null); Assert.IsTrue(fields["RegionAndRoute"] != null); Assert.IsTrue(fields["OriginalDepot"] != null); Assert.IsTrue(fields["DeliveryDate"] != null); }
/// <summary> /// Sets the drop schema. /// </summary> /// <param name="fields">The fields.</param> public static void SetDropSchema(TextFieldCollection fields) { fields.Add(new TextField("TripNumber", TypeCode.String, 8)); fields.Add(new TextField("OrderSequence", TypeCode.Int32, 3)); fields.Add(new TextField("OriginalCustomerCode", TypeCode.String, 16)); fields.Add(new TextField("ShipmentNumberAndDespatch", TypeCode.String, 22)); fields.Add(new TextField("Weight", TypeCode.Single, 10)); fields.Add(new TextField("Volume", TypeCode.Single, 8)); fields.Add(new TextField("ArriveTime", TypeCode.String, 5)); fields.Add(new TextField("DepartTime", TypeCode.String, 5)); fields.Add(new TextField("LoadingTime", TypeCode.String, 5)); fields.Add(new TextField("WaitingTime", TypeCode.String, 5)); fields.Add(new TextField("TravellingTime", TypeCode.String, 5)); fields.Add(new TextField("Distance", TypeCode.Single, 6)); fields.Add(new TextField("CallType", TypeCode.Int32, 1)); fields.Add(new TextField("DropSequence", TypeCode.Int32, 3)); fields.Add(new TextField("RegionAndRoute", TypeCode.String, 5)); fields.Add(new TextField("OriginalDepot", TypeCode.String, 18)); fields.Add(new TextField("DeliveryDate", TypeCode.DateTime, 10)); ////each field has an extra space between it! //foreach (TextField field in fields) //{ // field.Length += 1; //} ////we don't need an extra space on the last field //fields[fields.Count - 1].Length -= 1; }
/// <summary> /// Sets the parser schema. /// </summary> /// <param name="fields">The fields.</param> public static void SetParserSchema(TextFieldCollection fields) { // Clear fields fields.Clear(); // Add fields for schema fields.Add(new TextField("Type", TypeCode.String, false)); fields.Add(new TextField("OpCoCode", TypeCode.String, false)); fields.Add(new TextField("ShipmentNumber", TypeCode.String, false)); fields.Add(new TextField("DespatchNumber", TypeCode.String, false)); fields.Add(new TextField("LineNumber", TypeCode.Int32, false)); fields.Add(new TextField("ProductCode", TypeCode.String, false)); fields.Add(new TextField("Description1", TypeCode.String, false)); fields.Add(new TextField("Description2", TypeCode.String, false)); fields.Add(new TextField("Quantity", TypeCode.Int32, false)); fields.Add(new TextField("QuantityUnit", TypeCode.String, false)); fields.Add(new TextField("NetWeight", TypeCode.Decimal, false)); fields.Add(new TextField("CustomerReference", TypeCode.String, false)); fields.Add(new TextField("ConversionQuantity", TypeCode.Int32, false)); fields.Add(new TextField("ConversionInstructions", TypeCode.String, false)); fields.Add(new TextField("Volume", TypeCode.Decimal, false)); fields.Add(new TextField("Width", TypeCode.Int32, false)); fields.Add(new TextField("Length", TypeCode.Int32, false)); fields.Add(new TextField("Grammage", TypeCode.Int32, false)); fields.Add(new TextField("Microns", TypeCode.Int32, false)); fields.Add(new TextField("Packing", TypeCode.String, false)); fields.Add(new TextField("IsPanel", TypeCode.Boolean, false)); fields.Add(new TextField("LoadCategoryCode", TypeCode.String, false)); fields.Add(new TextField("ProductGroup", TypeCode.String, false)); fields.Add(new TextField("IsISO9000Approved", TypeCode.Boolean, false)); }
/// <summary> /// Populates the properties of the provided object using reflection. /// </summary> /// <remarks>If a property name includes a '.' an attempt will be made to populate the child property</remarks> /// <param name="fields">The fields.</param> /// <param name="objectToPopulate">The object to populate.</param> protected static void PopulateProperties(TextFieldCollection fields, DiscoveryBusinessObject objectToPopulate) { foreach (TextField field in fields) { String[] propertyName = field.Name.Split(new char[] { '.' }); PropertyInfo property = objectToPopulate.GetType().GetProperty(propertyName[0]); if (property != null) { object parentObject = objectToPopulate; if (propertyName.Length == 2) { //crappy code, should be recursive but it's a start when deailing with complex custom types! parentObject = property.GetValue(objectToPopulate, null); property = parentObject.GetType().GetProperty(propertyName[1]); } if (property != null) { object fieldValue = field.Value; //if (field.Value.GetType().Equals(typeof(String))) // fieldValue = fieldValue.ToString().Trim(); property.SetValue(parentObject, fieldValue, null); } } } }
/// <summary> /// Fills the object. /// </summary> /// <param name="objectToPopulate">The object to populate.</param> /// <param name="fields">The fields.</param> /// <param name="entityPrefix">The entity prefix.</param> public static void FillObject(esEntity objectToPopulate, TextFieldCollection fields, string entityPrefix) { // Qualified property name string qualifiedProperty = ""; // Iterate over the properties of the type List <PropertyInfo> objectProperties = GetPropertyInfo(objectToPopulate.GetType()); foreach (PropertyInfo objectProperty in objectProperties) { // Build the qualified name qualifiedProperty = ((string.IsNullOrEmpty(entityPrefix)) ? "" : entityPrefix + ".") + objectProperty.Name; // See if we can write to the property if (objectProperty.CanWrite) { // See if it's a complex type if (objectProperty.PropertyType.IsSubclassOf(typeof(esEntity))) { // It's a complext type FillObject( (esEntity)objectProperty.GetValue(objectToPopulate, null), fields, qualifiedProperty); } else if (null != fields[qualifiedProperty]) { // See if the property is in the text fields collection objectProperty.SetValue( objectToPopulate, Convert.ChangeType(fields[qualifiedProperty].Value, objectProperty.PropertyType), null); } } } }
/// <summary> /// Routings the populate site fields. /// </summary> /// <param name="siteSchema">The optrak site file schema.</param> public void RoutingPopulateSiteFields(TextFieldCollection siteSchema) { //check for nulls siteSchema["SiteCode"].Value = LocationCode; siteSchema["OpenTime"].Value = "Z"; siteSchema["MaximumGrossWeight"].Value = VehicleMaxWeight == Null.NullInteger || (int)VehicleMaxWeight == 0?"":((int)VehicleMaxWeight).ToString(); siteSchema["CheckInDuration"].Value = CheckInTime; siteSchema["LoadMethod"].Value = "Load"; siteSchema["UnloadMethod"].Value = "Unload"; siteSchema["DefaultDepot"].Value = DeliveryWarehouseCode; siteSchema["Name"].Value = ShipmentName; siteSchema["Address1"].Value = PAFAddress.Line1; siteSchema["Address2"].Value = PAFAddress.Line2; siteSchema["Address3"].Value = PAFAddress.Line3; siteSchema["Town"].Value = PAFAddress.Line4; siteSchema["Postcode"].Value = PAFAddress.PostCode; siteSchema["Region"].Value = PAFAddress.Line5; siteSchema["X"].Value = PAFAddress.Easting; siteSchema["Y"].Value = PAFAddress.Northing; siteSchema["Telephone"].Value = ShipmentContact.TelephoneNumber; siteSchema["RHRegion"].Value = DeliveryWarehouse.OptrakRegion.Code; siteSchema["Route"].Value = RouteCode; siteSchema["Category"].Value = ""; siteSchema["TailLiftRequired"].Value = TailLiftRequired ? "1" : "0"; siteSchema["OriginalX"].Value = siteSchema["X"].Value; siteSchema["OriginalY"].Value = siteSchema["Y"].Value; }
/// <summary> /// This fires when a product is successfully read from the message /// </summary> /// <param name="currentLineNumber">The current line number.</param> /// <param name="fields">The fields.</param> /// <param name="lineText">The line text.</param> private void RecordFound(ref int currentLineNumber, TextFieldCollection fields, string lineText) { string type; string subType; GetRowTypeAndSubType(lineText, out type, out subType); if (type == GetItemType() && subType == GetSubItemType()) //add { //get commander product by product code string productCode = fields["ProductCode"].Value.ToString().Trim(); if (string.IsNullOrEmpty(site)) { site = fields["Site"].Value.ToString().Trim(); } CommanderProduct commanderProduct = CommanderController.GetProduct(productCode); if (commanderProduct == null) //there is no matching HSPG product in our product list { hspgItems.Add(lineText); } else { tpcItems.Add(lineText); } } else if (type == HeaderOrFooter && subType == "L") //footer { footerLine = lineText; } else if (type == HeaderOrFooter && subType == "F") //header { headerLine = lineText; } }
/// <summary> /// Populates the commander sales order from the item values held in the TextFieldCollection.. /// </summary> /// <param name="fields">The fields.</param> /// <returns></returns> private Trip PopulateTrip(TextFieldCollection fields) { Trip trip = new Trip(); PopulateProperties(fields, trip); string deport = fields["Depot"].Value.ToString(); trip.Warehouse = allWarehouses.Find(delegate(Warehouse currentWarehouse) { return(currentWarehouse.Code == deport); }); if (trip.Warehouse == null) { throw new Exception( string.Format("During Optrak Trip file processsing the Warehouse '{0}' could not be found.", deport)); } string regionCode = fields["RegionCode"].Value.ToString(); trip.OptrakRegion = allRegions.Find(delegate(OptrakRegion currentWarehouse) { return(currentWarehouse.Code == regionCode); }); if (trip.OptrakRegion == null) { throw new Exception( string.Format("During Optrak Trip file processsing the OptrakRegion '{0}' could not be found.", regionCode)); } trip.WarehouseId = trip.Warehouse.Id; trip.RegionId = trip.OptrakRegion.Id; return(trip); }
/// <summary> /// Sets the file header and footer schema. /// </summary> /// <param name="fields">The fields.</param> protected void SetFileHeaderAndFooterSchema(TextFieldCollection fields) { fields.Clear(); AddCommonFields(fields); fields.Add(new TextField("Date", TypeCode.DateTime, 10)); fields.Add(new TextField("Time", TypeCode.DateTime, 5)); //should be 8 but the test data only has 5! }
/// <summary> /// Formats the each field based on it's type and length properties and appends each field to a /// string builder for use by the caller. /// </summary> /// <param name="currentInstance">The current buisiness object.</param> /// <param name="fields">The TextField Collection to iterate through.</param> /// <param name="stringBuilder">The string builder. Passed by reference for the caller to use</param> internal static void FormatField(DiscoveryBusinessObject currentInstance, TextFieldCollection fields, StringBuilder stringBuilder) { foreach (TextField field in fields) { string unformattedValue = currentInstance.GetType().GetProperty(field.Name).GetValue(currentInstance, null).ToString(); //default the formatted value to be the unformatted value string formattedValue = unformattedValue; switch (field.DataType) { case TypeCode.String: { formattedValue = unformattedValue.PadRight(field.Length); break; } case TypeCode.Decimal: { formattedValue = string.Format("#.00", unformattedValue).PadLeft(field.Length, '0'); break; } case TypeCode.Int32: { formattedValue = unformattedValue.PadLeft(field.Length, '0'); break; } } stringBuilder.Append(formattedValue); } }
/// <summary> /// Sets the commander sales order header schema. /// </summary> /// <param name="fields">The fields.</param> public static void SetCommanderSalesOrderHeaderSchema(TextFieldCollection fields) { //set-up fields collection, make sure the field names are the same as the //CommanderSalesOrder class properties so that reflection can be used in the parsing subscriber fields.Clear(); fields.Add(new TextField("LineNumber", TypeCode.Int32, 5)); fields.Add(new TextField("RecordType", TypeCode.Int32, 3)); fields.Add(new TextField("RecordSubType", TypeCode.String, 1)); fields.Add(new TextField("Site", TypeCode.String, 10)); fields.Add(new TextField("OrderReference", TypeCode.String, 20)); fields.Add(new TextField("CustomerNumber", TypeCode.String, 10)); fields.Add(new TextField("DespatchRouteCode", TypeCode.String, 10)); fields.Add(new TextField("DropNumber", TypeCode.Int32, 6)); fields.Add(new TextField("TotalWeight", TypeCode.Decimal, 19)); fields.Add(new TextField("DeliveryAddress.Line1", TypeCode.String, 32)); fields.Add(new TextField("DeliveryAddress.Line2", TypeCode.String, 32)); fields.Add(new TextField("DeliveryAddress.Line3", TypeCode.String, 32)); fields.Add(new TextField("DeliveryAddress.Line4", TypeCode.String, 32)); fields.Add(new TextField("DeliveryAddress.Line5", TypeCode.String, 32)); fields.Add(new TextField("CustomerOrderReference", TypeCode.String, 32)); fields.Add(new TextField("Carrier", TypeCode.String, 4)); fields.Add(new TextField("CustomerType", TypeCode.String, 3)); }
/// <summary> /// Headers the record found. /// </summary> /// <param name="currentLineNumber">The current line number.</param> /// <param name="textFields">The text fields.</param> /// <param name="lineText">The line text.</param> void HeaderRecordFound(ref int currentLineNumber, TextFieldCollection textFields, string lineText) { // A matching header has been found, we need to create an instance of the opco shipment opcoShipment = new OpCoShipment(); // Fill the opco shipment using the parsed header TextFieldParser.FillObject(opcoShipment, textFields); int Hrs, Mins; string[] HHMMSS; // We need manual conversion here for CheckInTimeHHMMSS as passed on interface in some ridiculous format HHMMSS = textFields["CheckInTimeHHMMSS"].Value.ToString().Split(':'); Hrs = Convert.ToInt32(HHMMSS[0]); Mins = Convert.ToInt32(HHMMSS[1]); opcoShipment.CheckInTime = (Hrs * 60) + Mins; // We need manual conversion here for the current time, we need to add it to the generated date HHMMSS = textFields["GeneratedTimeHHMMSS"].Value.ToString().Split(':'); opcoShipment.GeneratedDateTime = opcoShipment.GeneratedDateTime.AddHours(Convert.ToInt32(HHMMSS[0])); opcoShipment.GeneratedDateTime = opcoShipment.GeneratedDateTime.AddMinutes(Convert.ToInt32(HHMMSS[1])); opcoShipment.GeneratedDateTime = opcoShipment.GeneratedDateTime.AddSeconds(Convert.ToInt32(HHMMSS[2])); // Unwire event handlers for header shipmentParser.RecordFailed -= new TextFieldParser.RecordFailedHandler(HeaderRecordFailed); shipmentParser.RecordFound -= new TextFieldParser.RecordFoundHandler(HeaderRecordFound); // Wire up event handlers for line shipmentParser.RecordFailed += new TextFieldParser.RecordFailedHandler(LineRecordFailed); shipmentParser.RecordFound += new TextFieldParser.RecordFoundHandler(LineRecordFound); // Seed fields for line OpCoShipmentLine.SetParserSchema(shipmentParser.TextFields); }
/// <summary> /// Populates the commander sales order from the item values held in the TextFieldCollection.. /// </summary> /// <param name="fields">The fields.</param> /// <returns></returns> private ShipmentDropLine PopulateDropLine(TextFieldCollection fields) { ShipmentDropLine shipmentDropLine = new ShipmentDropLine(); PopulateProperties(fields, shipmentDropLine); return(shipmentDropLine); }
/// <summary> /// Sets the product maintenance file header schema. /// </summary> /// <param name="fields">The fields.</param> public static void SetProductMaintenanceFileHeaderSchema(TextFieldCollection fields) { fields.Clear(); AddCommonFields(fields); fields.Add(new TextField("Date", TypeCode.String, 10)); fields.Add(new TextField("Time", TypeCode.String, 8)); }
/// <summary> /// Populates the commander sales order from the item values held in the TextFieldCollection.. /// </summary> /// <param name="fields">The fields.</param> /// <returns></returns> private ShipmentDrop PopulateDrop(TextFieldCollection fields) { ShipmentDrop shipmentDrop = new ShipmentDrop(); PopulateProperties(fields, shipmentDrop); // shipmentDrop.TripId=TripController.GetTripByWarehouseDateAndNumber() return(shipmentDrop); }
/// <summary> /// Populates a commander product object from the item values held in the TextFieldCollection. /// </summary> /// <param name="fields">The fields.</param> /// <returns></returns> private CommanderProduct PopulateCommanderProduct(TextFieldCollection fields) { CommanderProduct commanderProduct = new CommanderProduct(); PopulateProperties(fields, commanderProduct); commanderProduct.UpdatedBy = GetType().ToString(); return(commanderProduct); }
/// <summary> /// Populates a commander sales order line object from the item values held in the TextFieldCollection. /// </summary> /// <param name="fields">The fields.</param> /// <returns></returns> private CommanderSalesOrderLine PopulateCommanderSalesOrderLine(TextFieldCollection fields) { CommanderSalesOrderLine newLine = new CommanderSalesOrderLine(); PopulateProperties(fields, newLine); newLine.UpdatedBy = GetType().ToString(); return(newLine); }
/// <summary> /// Sets the item schema. /// </summary> /// <param name="fields">The fields.</param> protected override void SetItemSchema(TextFieldCollection fields) { fields.Clear(); AddCommonFields(fields); fields.Add(new TextField("Site", TypeCode.String, 10)); fields.Add(new TextField("ProductCode", TypeCode.String, 20)); fields.Add(new TextField("Quantity", TypeCode.Int32, 19)); fields.Add(new TextField("CustomerReferenceNumber", TypeCode.String, 20)); }
/// <summary> /// Sets the commander sales order file header schema. /// </summary> /// <param name="fields">The fields.</param> public static void SetCommanderSalesOrderFileHeaderSchema(TextFieldCollection fields) { fields.Clear(); fields.Add(new TextField("LineNumber", TypeCode.Int32, 5)); fields.Add(new TextField("RecordType", TypeCode.Int32, 3)); fields.Add(new TextField("RecordSubType", TypeCode.String, 1)); fields.Add(new TextField("Date", TypeCode.String, 10)); fields.Add(new TextField("Time", TypeCode.String, 8)); }
/// <summary> /// Adds the contents of another 'TextFieldCollection' at the end of this instance. /// </summary> /// <param name="texValue">A 'TextFieldCollection' containing the objects to add to the collection.</param> public void AddRange(TextFieldCollection texValue) { int intCounter = 0; while ((intCounter < texValue.Count)) { Add(texValue[intCounter]); intCounter = (intCounter + 1); } }
/// <summary> /// Routings the populate shipment line fields. /// </summary> /// <param name="schema">The schema.</param> /// <param name="parentShipment">The parent shipment.</param> public void RoutingPopulateShipmentLineFields(TextFieldCollection schema, TDCShipment parentShipment) { schema["Order"].Value = string.Concat(parentShipment.OpCoCode, "-", parentShipment.ShipmentNumber, "-", parentShipment.DespatchNumber); schema["LineCode"].Value = LineNumber.ToString(); schema["Product"].Value = ProductCode; schema["MaximumUnits"].Value = Quantity.ToString(); schema["MaximumWeight"].Value = GrossWeight.ToString("######0.##"); schema["MaximumVolume"].Value = Volume.ToString("###0.###"); schema["Width"].Value = Width.ToString();; schema["Length"].Value = Length.ToString(); }
/// <summary> /// Lines the record found. /// </summary> /// <param name="currentLineNumber">The current line number.</param> /// <param name="textFields">The text fields.</param> /// <param name="lineText">The line text.</param> void LineRecordFound(ref int currentLineNumber, TextFieldCollection textFields, string lineText) { // A matching line has been found, we need to create an instance of the shipment line OpCoShipmentLine opcoShipmentLine = new OpCoShipmentLine(); // Fill the opcoshipment using the parsed header TextFieldParser.FillObject(opcoShipmentLine, textFields); // Add the line to the shipment opcoShipment.ShipmentLines.Add(opcoShipmentLine); }
/// <summary> /// Routings the populate product fields. /// </summary> /// <param name="schema">The schema.</param> public void RoutingPopulateProductFields(TextFieldCollection schema) { schema["Name"].Value = ProductCode; //only description 1 has been outputted because that field alone is 50 chars and the optrak field is 32 max schema["Description"].Value = Description1;// string.Concat(Description1, Description1.EndsWith(" ") || Description2.StartsWith(" ") ? "" : " ", Description2); schema["LoadCategory"].Value = LoadCategoryCode; schema["TypeData"].Value = IsPanel?"1":"0"; schema["ProductGroup"].Value = ProductGroup; schema["Width"].Value = Width.ToString(); schema["Length"].Value = Length.ToString(); }
/// <summary> /// Generates a delimited set of values for this instance for output to Commander WMS. /// </summary> /// <returns></returns> public string GenerateCSV() { TextFieldCollection fields = new TextFieldCollection(); SetCommanderSalesOrderHeaderSchema(fields); StringBuilder stringBuilder = new StringBuilder(); FormatField(this, fields, stringBuilder); return(stringBuilder.ToString()); }
/// <summary> /// Sets the expected file schema. /// </summary> /// <param name="fields">The fields.</param> private static void setFileSchema(TextFieldCollection fields) { fields.Add(new TextField("Fund Code", TypeCode.String, 10, true)); fields.Add(new TextField("Description", TypeCode.String, 100, true)); fields.Add(new TextField("Price Type", TypeCode.String, 3)); TextField field = new TextField("Price Date", TypeCode.DateTime, true); field.DateTimeFormat = "yyyyMMddHHmm"; fields.Add(field); fields.Add(new TextField("Bid Price", TypeCode.Double, false)); fields.Add(new TextField("Offer Price", TypeCode.Double, false)); fields.Add(new TextField("Yield", TypeCode.Double, false)); }
/// <summary> /// Sets the item schema. These fields describe the format of a single line /// </summary> /// <param name="fields">The fields.</param> protected override void SetItemSchema(TextFieldCollection fields) { fields.Clear(); AddCommonFields(fields); fields.Add(new TextField("Site", TypeCode.String, 10)); fields.Add(new TextField("RecieptRef", TypeCode.String, 20)); fields.Add(new TextField("LineNumber", TypeCode.Int32, 5)); fields.Add(new TextField("ProductCode", TypeCode.String, 20)); fields.Add(new TextField("QuantityReceived", TypeCode.Int32, 19)); fields.Add(new TextField("CustomerReferenceNumber", TypeCode.String, 20)); fields.Add(new TextField("IsAdviceNoteRequired", TypeCode.Int32, 2)); fields.Add(new TextField("AdviceNoteNumber", TypeCode.String, 30)); }
/// <summary> /// Sets the commander product maintenance modify schema. /// </summary> /// <param name="fields">The fields.</param> public static void SetCommanderProductMaintenanceModifySchema(TextFieldCollection fields) { //set-up fields collection, make sure the field names are the same as the //CommanderSalesOrder class properties so that reflection can be used in the parsing subscriber fields.Clear(); AddCommonFields(fields); fields.Add(new TextField("ProductCode", TypeCode.String, 20)); fields.Add(new TextField("Description", TypeCode.String, 40)); fields.Add(new TextField("ShortDescription", TypeCode.String, 30)); fields.Add(new TextField("Account", TypeCode.String, 20)); }
/// <summary> /// Sets the parser schema. /// </summary> /// <param name="fields">The fields.</param> public static void SetParserSchema(TextFieldCollection fields) { // Clear fields fields.Clear(); // Add fields for schema fields.Add(new TextField("MessageType", TypeCode.String, false)); // Not used fields.Add(new TextField("OpCoCode", TypeCode.String, false)); fields.Add(new TextField("OpCoSequenceNumber", TypeCode.String, false)); fields.Add(new TextField("ShipmentNumber", TypeCode.String, false)); fields.Add(new TextField("DespatchNumber", TypeCode.String, false)); fields.Add(new TextField("Amendment", TypeCode.Boolean, false)); fields.Add(new TextField("OpCoHeld", TypeCode.Boolean, false)); fields.Add(new TextField("RequiredShipmentDate", TypeCode.DateTime, false)); fields.Add(new TextField("OpCoContact.Name", TypeCode.String, false)); fields.Add(new TextField("TransactionTypeCode", TypeCode.String, false)); fields.Add(new TextField("TransactionSubTypeCode", TypeCode.String, false)); // Not used fields.Add(new TextField("CustomerReference", TypeCode.String, false)); fields.Add(new TextField("Instructions", TypeCode.String, false)); fields.Add(new TextField("RouteCode", TypeCode.String, false)); fields.Add(new TextField("CustomerNumber", TypeCode.String, false)); fields.Add(new TextField("StockWarehouseCode", TypeCode.String, false)); fields.Add(new TextField("SalesBranchCode", TypeCode.String, false)); fields.Add(new TextField("CustomerName", TypeCode.String, false)); fields.Add(new TextField("CustomerAddress.Line1", TypeCode.String, false)); fields.Add(new TextField("CustomerAddress.Line2", TypeCode.String, false)); fields.Add(new TextField("CustomerAddress.Line3", TypeCode.String, false)); fields.Add(new TextField("CustomerAddress.Line4", TypeCode.String, false)); fields.Add(new TextField("CustomerAddress.Line5", TypeCode.String, false)); fields.Add(new TextField("CustomerAddress.PostCode", TypeCode.String, false)); fields.Add(new TextField("ShipmentName", TypeCode.String, false)); fields.Add(new TextField("ShipmentAddress.Line1", TypeCode.String, false)); fields.Add(new TextField("ShipmentAddress.Line2", TypeCode.String, false)); fields.Add(new TextField("ShipmentAddress.Line3", TypeCode.String, false)); fields.Add(new TextField("ShipmentAddress.Line4", TypeCode.String, false)); fields.Add(new TextField("ShipmentAddress.Line5", TypeCode.String, false)); fields.Add(new TextField("ShipmentAddress.PostCode", TypeCode.String, false)); fields.Add(new TextField("ShipmentContact.Name", TypeCode.String, false)); fields.Add(new TextField("ShipmentContact.TelephoneNumber", TypeCode.String, false)); fields.Add(new TextField("ShipmentContact.Email", TypeCode.String, false)); fields.Add(new TextField("AfterTime", TypeCode.String, false)); fields.Add(new TextField("BeforeTime", TypeCode.String, false)); fields.Add(new TextField("TailLiftRequired", TypeCode.Boolean, false)); fields.Add(new TextField("VehicleMaxWeight", TypeCode.Decimal, false)); fields.Add(new TextField("CheckInTimeHHMMSS", TypeCode.String, false)); fields.Add(new TextField("DeliveryWarehouseCode", TypeCode.String, false)); fields.Add(new TextField("OpCoContact.Email", TypeCode.String, false)); fields.Add(new TextField("DivisionCode", TypeCode.String, false)); fields.Add(new TextField("GeneratedDateTime", TypeCode.DateTime, false)); fields.Add(new TextField("GeneratedTimeHHMMSS", TypeCode.String, false)); }
/// <summary> /// Populates the commander sales order from the item values held in the TextFieldCollection.. /// </summary> /// <param name="fields">The fields.</param> /// <returns></returns> private CommanderSalesOrder PopulateCommanderSalesOrder(TextFieldCollection fields) { CommanderSalesOrder salesOrder = new CommanderSalesOrder(); salesOrders.Add(salesOrder); salesOrder.DeliveryAddress = new Address(); PopulateProperties(fields, salesOrder); //set the updated by field to the name of this class salesOrder.UpdatedBy = GetType().ToString(); return(salesOrder); }
/// <summary> /// Sets the commander sales order lines schema. /// </summary> /// <param name="fields">The fields.</param> public static void SetCommanderSalesOrderLinesSchema(TextFieldCollection fields) { //set-up fields collection, make sure the field names are actually the same as the //CommanderSalesOrderLine class properties so that reflection can be used in the parsing subscriber fields.Clear(); fields.Add(new TextField("LineNumber", TypeCode.Int32, 5)); fields.Add(new TextField("RecordType", TypeCode.Int32, 3)); fields.Add(new TextField("RecordSubType", TypeCode.String, 1)); fields.Add(new TextField("Site", TypeCode.String, 10)); fields.Add(new TextField("OrderReference", TypeCode.String, 20)); fields.Add(new TextField("LineNumber", TypeCode.Int32, 5)); fields.Add(new TextField("ProductCode", TypeCode.String, 20)); fields.Add(new TextField("QuantityOrdered", TypeCode.Int32, 19)); fields.Add(new TextField("CustomerReferenceNumber", TypeCode.String, 20)); fields.Add(new TextField("UOM", TypeCode.String, 10)); fields.Add(new TextField("SpecialInstructions1", TypeCode.String, 33)); fields.Add(new TextField("SpecialInstructions2", TypeCode.String, 33)); fields.Add(new TextField("SpecialInstructions3", TypeCode.String, 33)); fields.Add(new TextField("SpecialInstructions4", TypeCode.String, 33)); fields.Add(new TextField("SpecialInstructions5", TypeCode.String, 33)); }