In a C# 2010 desktop application, I need to create a dynamic directory
paths based upon the names of some documents I obtain from a web service. Basically if the name of the file type in an xml file is called 'Customer Inventory", I need to place these documents in a folder one level lower than the rest of the documents. Basically most files will end up in a path that looks like:
However the files that are marked in the xml file called "Customer Inventory", need to end up in a file directory path that looks like the following: C:\temp\customers\Customer Inventory.
Thus can you tell me how I can create the correct directory paths I need to work with?
My question is how can I place the files in one directory path or the second directory path that is longer? Basically the output files can go to 2 different locations. Can you tell or show me how to determine and actually place the different type of files in the different directory path locations?
This is all fairly basic stuff. What, exactly, is your background? How did you end up with this task? Judging by the number of questions you have posted recently, it seems that you are turning straight to Code Project for solutions.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
I have 2 years of experience with C# and 1 year with VB. I only ask the simple questions here. I do not place the difficult questions here since I do not think that is what this message board is setup for.
So, how do you think you should solve this problem? Talk me through the problem and potential solutions. Break it down into little steps; you'll be surprised just how easy it is to solve when you know this.
*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington
You were told how to create directories.
You already know the name of the file you must look for. If you don't then you MUST figure that out BEFORE you code.
So now that you know the name, from your example there is one name, so you use an 'if' to compare the name of the file to the file that you have.
So the pseudo code looks like
fileName = GetFileName()
if (fileName equals "Customer Inventory")
if (! Output dir)
I am having a problem using linq to sql in a C# desktop application that connects to sql server 2008. Basically if the CustId already exists in the Trans table, I do not want to insert a new row into the table. However the code listed below does not work.
**Note the CustId is not the primary key of the table. there is an identity key that is the primary key of the table.
eDataContext rptData = new eDataContext();
var eupdate = (from a in rptData.Tran
where a.Cust_ID == CustId
if (eupdate != null)
log.Info(CustId + "already exists in the Trans table");
Trans subCustid = null;
subCustid = new Trans();
subCustid.Package_ID = pkgid;
Thus can you tell me what I can do to not allow a row to be inserted into the Trans table when the CustId already exists in the table?
In a C# 2010 desktop I have one solution file that have 4 separate project folders. In two of the project folders I need to access two of the same tables using linq to sql. I do not know how to make each project folder be aware of the two tables. Thus I embedded basically the same *.dbml files within each separate project folder.
I do not think what I did is the best solution. Due to this fact, I have the following questions:
1. Is there some kind of a way that each project folder can have access to the same *.dbml file? If you can you tell me how to accomplish this goal?
2. One of the project folders is a proxy file. Is it a good or bad idea to have a proxy class (project) folder update a *.dbml? Can you explain your answer to me?
Not really. It's a matter of thinking about the problem the correct way. Think about this... you're writing a library that interacts with the database. What do you have to expose in the way of methods and return types that any application you write can use that library and not worry about how the database is implemented at all??
Try getting a book on the Entity Framework and you'll see what I mean.
hello , i have a question about MdiParent click event , maybe its abit stupid to asking you guys this question , but honestly i don't know it .
i want to write some code in mdiparent click event , that's mean , if i clicked the mdiparent form or the mdiparent(page) , sth w'll happened , noticed (i don't want to put a button or label or what ever else ) i just want to click on the mdiform and some code get run , i have tried the click event _ Mouse Clicked _ and some other events but nothing so far .
any help , i'll appreciate that .
i want to write some code in mdiparent click event , that's mean , if i clicked the mdiparent form or the mdiparent(page) , sth w'll happened , noticed (i don't want to put a button or label or what ever else ) i just want to click on the mdiform and some code get run
The click-event simply isn't fired for a MdiContainer. Hence, what you want is not possible.
Bastard Programmer from Hell
if you can't read my code, try converting it here[^]
Our drac IP list is not accurate and I'd like to have a program that queries a server list and gives an update list from WMI or some other source. I've seen racadm do it locally, so it must be stored somewhere that is accessible from the OS.
I just did a procmon on racadm and could not find anything as far as how it generates the drac ip when it does a query. Thanks for reading.
I'm refactoring a WinForms project. I have 2 forms that do the same thing, except the data entities passed in are slightly different, so the guy who wrote them decided to duplicate the forms instead of making one form that works for both. So I'm refactoring them.
Can't use an interface because most of this code is already in place. Have to work with what I have.
However, I think this will do it:
publicpartialclass Form1<T> : Form
Type type = typeof(T);
var DistrictId = 10;
DataItem = (T)Activator.CreateInstance(typeof(T), DistrictId);
setProperty<string>("Name", "The Name");
setProperty<DateTime>("BillingStartDate", new DateTime(2012, 01, 15));
privatevoid setProperty<T>(string PropertyName, T Value)
var prop = DataItem.GetType().GetProperty(PropertyName);
if (prop != null)
type.GetProperty(PropertyName).SetValue(DataItem, Value, null);
This will allow me to attempt to set a property. Remember that in this case most of the properties exist on both objects. But this code allows me to not have multiple IF blocks. I think it's clean, and it solved the issue.