I'm working on it, but really wanted to see some results today like my first database/collection write.
Thank God I only have the 2 CSV files to download. But Amazon allows for uploading Inventory, Prices, and shipping plans. Not sure about the format, probably CSV.
I know what I want to be able to do in this app, and the data I need to see. Using both marketplaces over the last 4 months has shown me that I don't have all the data I need to fill out a tax return, or show the state how much tax was collected. I can't account for all the inventory I purchased and sold. And I'm not a wiz with Excel, don't even know where to start with it. I don't even know how much money I made so I can pay myself. I've sold so much, that I don't have time to hand enter all the data. Just too many entries.
I'm stumped here. Writing a program for myself to keep track of Amazon and EBay sales. On this Ebay report, the first line is a string of comma's, and then the header. Some of the header columns are unquoted and some are quoted to represent text.
I don't know if the string comma's is a blank line, or what. And not sure how to tell CsvHelper about the quotes in the column names.
I guess the string of commas is a line, because the line has a line feed. That's solved.
My problem is the usual won't work issue. Guess I could edit the file and remove the commas and test to see if the column reads, No, the first column doesn't read and it doesn't have quotes. So it's the first line that's my issue.
I wonder why EBay put that line of commas in as the first line, must mean something.
Sales Record Number,"Order Number","Buyer Username","Buyer Name","Buyer Email","Buyer Note","Buyer Address 1","Buyer Address 2","Buyer City","Buyer State","Buyer Zip","Buyer Country","Ship To Name","Ship To Phone","Ship To Address 1","Ship To Address 2","Ship To City","Ship To State","Ship To Zip","Ship To Country","Item Number",Item Title,"Custom Label","Sold Via Promoted Listings","Quantity","Sold For","Shipping And Handling","Seller Collected Tax","eBay Collected Tax","Electronic Waste Recycling Fee","Mattress Recycling Fee","Additional Fee","Total Price","eBay Collected Tax and Fees Included in Total","Payment Method","Sale Date","Paid On Date","Ship By Date","Minimum Estimated Delivery Date","Maximum Estimated Delivery Date","Shipped On Date","Feedback Left","Feedback Received","My Item Note","PayPal Transaction ID","Shipping Service","Tracking Number","Transaction ID","Variation Details","Global Shipping Program","Global Shipping Reference ID","Click And Collect","Click And Collect Reference Number","eBay Plus","Authenticity Verification Program","Authenticity Verification Status","Authenticity Verification Outcome Reason"
Are you sure it's not an artifact of your download process? How did you get teh data?
The first row of a CSV file can normally be one of three things:
1) A header row giving the column titles.
2) The first row of data
3) A row indicating a "custom separator": "Sep=|" for example is used by Excel: Comma-separated values - Wikipedia[^]
I've never seen a valid CSV file with anything else as the top row.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
My guess is the line of comma's was an afterthought, and got added to "solve" some problem related to the inconsistent quote situation in the original title line; so now the title line is basically empty, and the column names appear in the first data row, which could be good enough for people reading the table on screen, not for a program trying to interpret it all.
Luc Pattyn [My Articles]
If you can't find it on YouTube try TikTok...
I took the names out of the map. Then did the readline twice to skip the comma's and header, and turned off read header.
So I can read the file and populate the model now. Just need to fix the number conversions, everything in the model is a string now. But I'm 3 steps closer now. Thanks for all the help!
publicstaticasync Task<List<EBayCsvImport>> Import_EBayOrderFile(string appPath)
var pOrders = new List<EBayCsvImport>();
using (var reader = new StreamReader(appPath))
using (var csv = new CsvReader(reader, CultureInfo.InvariantCulture))
csv.Configuration.Delimiter = ",";
csv.Configuration.Encoding = Encoding.UTF8;
csv.Configuration.MissingFieldFound = null;
csv.Configuration.HasHeaderRecord = false;
csv.Configuration.HeaderValidated = null;<br />
csv.Configuration.CultureInfo = CultureInfo.InvariantCulture;
csv.Configuration.TypeConverterOptionsCache.GetOptions(typeof(decimal)).NumberStyle = NumberStyles.AllowCurrencySymbol | NumberStyles.AllowThousands;
csv.Configuration.PrepareHeaderForMatch = (header, index) => header.ToLower();
// Skip the first two lines// Comma's and header
pOrders = csv.GetRecords<EBayCsvImport>().ToList();
catch (Exception ex)
If it ain't broke don't fix it
Discover my world at jkirkerx.com
I have a Listener class that implements a delegate and do some stuff when receive the request.
If this is a fresh project, I would recommend moving to a more web-development framework to write more secure, stable, and scalable apps; such as with ASP.NET Core. With ASP.NET Core, you can just specify a single Controller and let it handle your requests for you. On top of that, you get several benefits:
Parsing of the HTTP request/response.
Security features and authentication.
Publishing/hosting support with leading cloud hosting platforms
If you really want to handle the low-level details of the HTTP protocol (which, I again suggest not to), then I think you have got it working.
Now im getting calls by postman in localhost, and don't know how to implement to get server calls (idk if need other application for this like dotnet server or idk).
Your application is already on a server; localhost. If you want to move it to something like www.yourdomain.com, then that is more about the deployment of the application. Deploy it to a hosting platform and apply your domain name to it.
The calls is based in the appClientCode so i need to get only the client call can be more clients on but they din't notice about other calls.
Although I have not checked your code by running it, but your code "should" spawn a new thread for each request and handle the requests in an isolated manner. That shouldn't be an issue.
Once again, go with ASP.NET Core, and you can write an ASP.NET Core API that provides the HTTP access to your clients and server and makes it easier to work with HTTP protocol.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
I'm just learning to use C# Inheritance.
It is quite clear to me (I've worked with C++ in the past).
I've a problem with two classes.
So, imagine a base class, which contain a sub-class; the sub-class is used to collect data.
I used a sub-class because I need to write and read it from a disk, using a XmlSerializer.
The base class has the needed public Save/Load members, that serialize the sub-class.
I now have to Inherit the base class multiple times; the only differnece in the derived classes is the sub-class, that have a slightly different format for each derived class.
I created few derived classes, re-definind into them the sub-class wth the keyboard "new".
Unfortunately, everytime I call the Save/Load members (defined in the base class) from the derived classes, these methods actually save ansd load the sub-class defined into the base class, not the one defined into the calling derived class.
What I'm doing wrong?
Here below an excerpt of my code, with the definition of the two classes (heavily simplified, of course):
publicint data1 = 1;
publicint data2 = 1;
publicstring Data3 = "BaseString";
public Data data = new Data();
publicbool Save(string Filename)
var xs = new XmlSerializer(Data.GetType());
using (TextWriter sw = new StreamWriter(Filename))
publicstatic T Load<T>(Filename)
var xs = new XmlSerializer(typeof(T));
using (var sr = new StreamReader(FileName))
rslt = (T)xs.Deserialize(sr);
public DerivedClass : BaseClass
publicint data1 = 2;
publicint data2 = 2;
publicstring Data3 = "DerivedString";
publicint Data4 = 2;
publicnew Data data = new Data();
Now, using them as follows gives me the error that the base class Data are saved:
DerivedClass MyClass = new DerivedClass();
MyClass.Save("Test.xml"); // This saves the base class Data, not the derived one
I know this is probably quite trivial, but please help me.
Thank you in advance.
Members declared with new will not be visible to the base class. When code in the base class looks for the Data member, it will use its own member, not the "shadowed" member declared by the derived class.
Members which are meant to be overridden in a derived class must be marked as virtual, and overridden properly in the derived class.
See if Richard's excellent response, and this code ... gives you some ideas:
public Data(int data1, int data2, string data3)
Data1 = data1;
Data2 = data2;
Data3 = data3;
public Data TheData;
publicbool Save(string Filename, Data data)
var xs = new XmlSerializer(data.GetType());
using (TextWriter sw = new StreamWriter(Filename))
public Data Load(string Filename, Type type)
var xs = new XmlSerializer(type);
using (var sr = new StreamReader(Filename))
rslt = (Data) xs.Deserialize(sr);
publicclass DerivedClass : BaseClass
publicclass DerivedData : BaseClass.Data
public DerivedData(int data4, int data1, int data2, string data3) : base(data1, data2, data3)
Data4 = data4;
BaseClass bc = new BaseClass();
bc.TheData = new BaseClass.Data(1,1,"BaseString");
var bcdata = bc.Load(@"C:\Users\test_user\Desktop\Basedata.xml", bc.TheData.GetType());
DerivedClass dc = new DerivedClass();
dc.TheData = new DerivedClass.DerivedData(4, 2, 2, "DerivedString");
var dcdata = dc.Load(@"C:\Users\test_user\Desktop\Deriveddata.xml", dc.TheData.GetType());
I am sure this can be improved
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali
This is the scenario & I was able to make 1/2 of it work: Programmatically launch Outlook 365, send an message & quit Outlook; it must exit. The quitting is the problematic part-- it likes to keep running so I'm thinking I'm not releasing the resources fully forcing it to keep running.
Tons of samples to launch & send a simple message & this is not about that. Outlook 365 has to quit.
This works (simplified for this post though & should be accurate enough): Outlook launches, sends, quits---
Question part 1: Outlook does not quit whenever the EventHandler is subscribed to so the reminders window is suppressed. I'm adding & immediately removing the EventHandler because that's what I've narrowed it down to as the issue for not closing for me. Commenting out the 2 event lines is what's above btw.
privatevoid Reminders_BeforeReminderShow(refbool Cancel)
Cancel = true; //suppresses Outlook reminders from opening
Part 2 of this question is where I am right now: Once I add an attachment & send the message, Outlook again does not quit.
What am I missing with releasing these resources? Why is adding & then removing this EventHandler causing issues with quitting Outlook? This is tricky because there are a gazillion "how to send mail" posts but much fewer "how to send mail & quit Outlook" posts.
Also, anything related to killing a task is not being considered because that's a dirty shutdown & will only cause deeper issues with mailboxes etc. over time, so don't post it as a solution.
Hi, I apologize if a solution for something like this has been posted somewhere in the forums already. I've looked.
I have a large string which will include text such as:
"..just random text 5:43 and more random text 9:25..and even more random text 3:00.."
I'd like to be able to store these times in an array or even just get each as an individual string. I've thought about searching the text for colons and just getting the two characters before and after each. Any help would be greatly appreciated. Thanks in advance.