Click here to Skip to main content
15,900,589 members
Home / Discussions / C#
   

C#

 
AnswerRe: Time conversion Pin
Malcolm Smart2-May-07 3:31
Malcolm Smart2-May-07 3:31 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 3:36
Anka_Ame2-May-07 3:36 
GeneralRe: Time conversion Pin
Malcolm Smart2-May-07 3:46
Malcolm Smart2-May-07 3:46 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 4:21
Anka_Ame2-May-07 4:21 
GeneralRe: Time conversion Pin
Malcolm Smart2-May-07 4:35
Malcolm Smart2-May-07 4:35 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 5:01
Anka_Ame2-May-07 5:01 
GeneralRe: Time conversion Pin
Malcolm Smart2-May-07 5:02
Malcolm Smart2-May-07 5:02 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 5:10
Anka_Ame2-May-07 5:10 
this is the function which reads the Xml File and is part of a class Cities.
public class Cities : List<city>
{
public void OpenCityList(string filename)
{
DataSet cityDS = new DataSet();

try
{
this.Clear();

cityDS.ReadXml(filename);


DataRowCollection cities = cityDS.Tables[0].Rows;

foreach (DataRow city in cities)
{
this.Add(new City(Convert.ToInt32(city["X"], CultureInfo.CurrentCulture), Convert.ToInt32(city["Y"], CultureInfo.CurrentCulture), Convert.ToInt32(city["Demand"], CultureInfo.CurrentCulture), Convert.ToString(city["Open"], CultureInfo.CurrentCulture)));
}
}

finally
{
cityDS.Dispose();
}
}
private TimeSpan startHour;

public TimeSpan StartHour
{
set
{
startHour = value;
}
get
{
return startHour;
}
}

public void ShowCityHour()
{

foreach (City cityhour in this)
{
startHour = cityhour.OpenTime;
}
}
}
And in another class, named City I have :
public class City
{
private int demand;
private TimeSpan openTime;
public City(int x, int y, int citydemand, string open)// I am interested about the string open
{
Location = new Point(x, y);
demand = citydemand;

DateTime oTime = DateTime.Parse(open);
TimeSpan openTime = oTime.TimeOfDay;
}

public TimeSpan OpenTime
{
get
{
return openTime;
}
set
{
openTime = value;
}
}
}


It is something like that. I take the data from the Xml file and I store it in the string open, and I want to convert it to time, because after that I will have to sort the whole list in order of the hours.
GeneralRe: Time conversion Pin
Luc Pattyn2-May-07 5:24
sitebuilderLuc Pattyn2-May-07 5:24 
GeneralRe: Time conversion Pin
Anka_Ame2-May-07 5:36
Anka_Ame2-May-07 5:36 
GeneralRe: Time conversion Pin
Malcolm Smart2-May-07 5:50
Malcolm Smart2-May-07 5:50 
AnswerRe: Time conversion Pin
AFSEKI7-May-07 6:35
AFSEKI7-May-07 6:35 
Generalresult speedy application. Pin
V.2-May-07 2:36
professionalV.2-May-07 2:36 
GeneralRe: result speedy application. Pin
Colin Angus Mackay2-May-07 2:43
Colin Angus Mackay2-May-07 2:43 
GeneralRe: result speedy application. Pin
V.2-May-07 3:09
professionalV.2-May-07 3:09 
AnswerRe: result speedy application. Pin
AFSEKI7-May-07 6:41
AFSEKI7-May-07 6:41 
QuestionNeed solution Pin
DON3452-May-07 2:13
DON3452-May-07 2:13 
AnswerRe: Need solution Pin
Christian Graus2-May-07 2:33
protectorChristian Graus2-May-07 2:33 
GeneralRe: Need solution Pin
DON3452-May-07 2:46
DON3452-May-07 2:46 
GeneralRe: Need solution Pin
Christian Graus2-May-07 10:26
protectorChristian Graus2-May-07 10:26 
AnswerRe: Need solution Pin
Rahul Babu2-May-07 2:54
Rahul Babu2-May-07 2:54 
GeneralRe: Need solution Pin
DON3452-May-07 18:43
DON3452-May-07 18:43 
GeneralRe: Need solution Pin
Rahul Babu2-May-07 19:44
Rahul Babu2-May-07 19:44 
GeneralRe: Need solution Pin
DON3452-May-07 19:57
DON3452-May-07 19:57 
QuestionSocket exception. Pin
Eytukan2-May-07 2:13
Eytukan2-May-07 2:13 

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.