Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
AnswerRe: Switching to Embedded programming? Pin
Luc Pattyn20-Jan-10 1:10
sitebuilderLuc Pattyn20-Jan-10 1:10 
Questionerror Pin
djsproject19-Jan-10 20:40
djsproject19-Jan-10 20:40 
AnswerRe: error Pin
Estys19-Jan-10 20:51
Estys19-Jan-10 20:51 
AnswerRe: error Pin
Abhinav S19-Jan-10 21:52
Abhinav S19-Jan-10 21:52 
QuestionMessage Removed Pin
19-Jan-10 20:39
prithaa19-Jan-10 20:39 
GeneralRe: Update method problem Pin
Abhinav S19-Jan-10 21:56
Abhinav S19-Jan-10 21:56 
GeneralRe: Update method problem Pin
prithaa20-Jan-10 6:25
prithaa20-Jan-10 6:25 
QuestionHow to avoid repeated output statement... Pin
<<Tash18>>19-Jan-10 20:28
<<Tash18>>19-Jan-10 20:28 
Hi guyz.. Im still on my project as the final touch up i have a task to be added to my project.. As i have mentioned in my previous post my project is on console application.. Thank you 2 all in code project because from the help and advice that i got from everyone at code project i was able 2 completed 90% of my project.. now the issue in my project it that my project migrates all the records stored in xml to the database its fine with it, certain records in the xml file are stored in another file in xml my application catches the file exactly and inserts the records from it. now i have a verification coded in my application which checks whether that particular file is present in the folder, if the file is present the records from it are migrated if the file is not present, on the output window it displays the name of the file stating that the file is missing in the folder.. now since my application has nested for loops and if condition the verification for the same file takes place more than once so in the output window the same missing file name is printed more than one(may be 10times) it becomes messy 2 see the output window..
Now what i would try to implement is that even if it checks the same file for the second time and if the file is not present it should display the message on the output window only one.. my coding is as follows:

class Class1
	{
		
		XmlDataDocument doc1 = new XmlDataDocument();
		doc1.Load(ConfigurationSettings.AppSettings["fun"]);
		XmlNodeList nodes1 = doc1.GetElementsByTagName("Row");
		foreach(XmlNode node1 in nodes1)
		{
			if(node1.HasChildNodes && node1.ChildNodes.Count > 0)
			{
				XmlElement Element1 = (XmlElement) node1;
				string f_ID = Element1.GetElementsByTagName("Id")[0].InnerText;
				string f_AppId = Element1.GetElementsByTagName("AppId")[0].InnerText;
				string f_FileName = Element1.GetElementsByTagName("FileName")[0].InnerText;
				if(f_AppId==app)
				{
					string path = ConfigurationSettings.AppSettings["funfile"]+"\\"+f_FileName+".xml";
					if (File.Exists(path))
					{
						XmlDataDocument doc2 = new XmlDataDocument();
						doc2.Load(ConfigurationSettings.AppSettings["funfile"]+"\\"+f_FileName+".xml");
						XmlNodeList nodes2 = doc2.GetElementsByTagName("Function");
						foreach(XmlNode node2 in nodes2)
						{
							if(node2.HasChildNodes && node2.ChildNodes.Count > 0)
							{
								XmlElement Element2 = (XmlElement) node2;
								string ff_Id = Element2.GetElementsByTagName("Id")[0].InnerText;
								string ff_Url = Element2.GetElementsByTagName("Url")[0].InnerText;
								string ff_AppId = Element2.GetElementsByTagName("AppId")[0].InnerText;
								string ff_Status = Element2.GetElementsByTagName("Status")[0].InnerText;
								if(f_ID==ff_Id && f_AppId==ff_AppId)
								{
									if(ff_Status=="Active" || ff_Status=="A" || ff_Status=="P")
									{
										cmd = new OdbcCommand("insert into EACS_Function_1 values('"+ff_Id+"','"+ff_FunctionDescription+"','"+ff_Url+"','"+ff_AppId+"','"+ff_Type+"','"+ff_MenuCommand+"','A','','','')",con);
										cmd.ExecuteNonQuery();
									}
								}
								else
								{
									Console.WriteLine("Please check Function file-{0} fields do not match",f_FileName);
														//break;
								}
							}
						}
					}
					else
					{
						Console.WriteLine("Function file {0} not present",f_FileName);
											//break;
					}
				}
			}
		}


This is only a part of my coding.. My application has 860 lines of code.. so just imagine that how long my coding will be.. so plz advice me, when the for loop is traversed again and again the same missing file name is displayed on the screen which i have to aviod.. plz guide me..

Thanx in advance..
Regards,
Tash
AnswerRe: How to avoid repeated output statement... Pin
Calla19-Jan-10 20:38
Calla19-Jan-10 20:38 
GeneralRe: How to avoid repeated output statement... Pin
<<Tash18>>19-Jan-10 20:41
<<Tash18>>19-Jan-10 20:41 
AnswerRe: How to avoid repeated output statement... Pin
Martin#19-Jan-10 21:04
Martin#19-Jan-10 21:04 
GeneralRe: How to avoid repeated output statement... Pin
<<Tash18>>19-Jan-10 21:16
<<Tash18>>19-Jan-10 21:16 
AnswerRe: How to avoid repeated output statement... Pin
Martin#19-Jan-10 22:06
Martin#19-Jan-10 22:06 
GeneralRe: How to avoid repeated output statement... Pin
<<Tash18>>19-Jan-10 23:06
<<Tash18>>19-Jan-10 23:06 
GeneralRe: How to avoid repeated output statement... Pin
Martin#19-Jan-10 23:23
Martin#19-Jan-10 23:23 
AnswerRe: How to avoid repeated output statement... Pin
Martin#19-Jan-10 23:46
Martin#19-Jan-10 23:46 
GeneralRe: How to avoid repeated output statement... Pin
<<Tash18>>20-Jan-10 0:02
<<Tash18>>20-Jan-10 0:02 
GeneralRe: How to avoid repeated output statement... Pin
<<Tash18>>20-Jan-10 0:09
<<Tash18>>20-Jan-10 0:09 
GeneralRe: How to avoid repeated output statement... Pin
Martin#20-Jan-10 0:35
Martin#20-Jan-10 0:35 
Questionremote desktop Pin
v_neil8719-Jan-10 19:44
v_neil8719-Jan-10 19:44 
GeneralRe: remote desktop Pin
Calla19-Jan-10 20:29
Calla19-Jan-10 20:29 
GeneralRe: remote desktop Pin
v_neil8719-Jan-10 21:08
v_neil8719-Jan-10 21:08 
GeneralRe: remote desktop Pin
Calla19-Jan-10 21:22
Calla19-Jan-10 21:22 
GeneralRe: remote desktop Pin
v_neil8719-Jan-10 23:24
v_neil8719-Jan-10 23:24 
GeneralRe: remote desktop Pin
Calla20-Jan-10 0:42
Calla20-Jan-10 0:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.