Question
With a history directory I have several text files that includes sales order information that comes as an individual long string for each customer in
With a history directory I have several text files that includes sales order information that comes as an individual long string for each customer in each of the text files. Each of the text files start either with the letter r or the letter s. In this instance r stands for a comment file pertaining to a order file and the file beginning with the letter s, is the actual sales order file.
With this information I am trying to create a Microsoft Service that loops on a timer through each of these text files reading each line in a text file then comparing the string text from that text file to a data table in a ssms database by way of parsing from text to a variable. If the data that is presented to the database doesn't match or doesn't exist as a record then it should update the table with the text file data. The last component to the service is that should loop through the history folder and move any text files that begin with that letter r mentioned earlier.
If it possible to at least get psuedo code it would be greatly appreciated but, if I could get a model to look over that would be a tremendous help. I have been struggling to find a workaround am fairly new to doing a Microsoft Service. I appreciate any help that you can offer.
A text file will look something like this:
111112222222222222K FOODS GROUP INC 20221126 033361-0933000022CR20221116 1223 E 3RD ST NASHVILLE TN3330213413563096223 000020221125 00000000 00100000 00000000
Each file should be broken down to something like this:
[StringLength(10)] public string ShipToNumber { get; set; }
[StringLength(7)] public string SalesOrderNumber { get; set; }
[StringLength(30)] public string CustomerName { get; set; }
[StringLength(17)] public string DeliveryDate { get; set; }
[StringLength(11)] public string ProductCode { get; set; }
[StringLength(6)] public string Quantity { get; set; }
[StringLength(2)] public string UOM { get; set; }
[StringLength(19)] public string TimeStamp { get; set; }
[StringLength(30)] public string ShipToAddress1 { get; set; }
[StringLength(30)] public string ShipToAddress2 { get; set; }
[StringLength(20)] public string ShipToCity { get; set; }
[StringLength(2)] public string StateCode { get; set; }
[StringLength(9)] public string ZipCode { get; set; }
[StringLength(25)] public string CustomerPONumber { get; set; }
[StringLength(4)] public string RetailPrice { get; set; }
[StringLength(17)] public string ShipDate { get; set; }
[StringLength(17)] public string SellByDate { get; set; } // Code Date
[StringLength(4)] public string OrderLineNumber { get; set; }
[StringLength(4)] public string DiscountRetailPriceAmount { get; set; }
[StringLength(2)] public string DiscountRetailCalcMethod { get; set; }
[StringLength(4)] public string PackageTare { get; set; }
[StringLength(4)] public string BoxTare { get; set; }
[StringLength(2)] public string CRLF { get; set; }
public string PlantId { get; set; }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started