TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
akshay rasalakar
NA
128
9.4k
Time calculation
Feb 18 2015 8:36 AM
I have mentioned my problem below
st = "UPDATE tbl_time set time_out='" + dt1.ToString("hh:mm:ss") + "' WHERE ID=(SELECT MAX(ID) FROM tbl_time)";
db.ExeQuery(st);
st = "Select * from tbl_time where ID=(Select MAX(ID) from tbl_time)";
dr = db.readall(st);
if (dr.Read() == true)
{
txt1.Text = dr["time_in"].ToString();
txt2.Text = dr["time_out"].ToString();
}
TimeSpan t1 = TimeSpan.Parse(txt1.Text);
TimeSpan t2 = TimeSpan.Parse(txt2.Text);
TimeSpan ts = t2 - t1;
dr.Close();
st = "UPDATE tbl_time set tot='" + ts + "' WHERE ID=(SELECT MAX(ID) FROM tbl_time)";
db.ExeQuery(st);
st = "Select * from tbl_time where ID=(Select MAX(ID) from tbl_time)";
dr = db.readall(st);
if (dr.Read() == true)
{
txt3.Text = dr["tot"].ToString();
}
dr.Close();
TimeSpan t3 = TimeSpan.Parse(txt3.Text);
double fee = 0;
// In ts variable i'm storing the start and end time i.e total time
if (ts.TotalMinutes < 60) // Here is my doubt If the user spend time less than 60 min i want make charge of 10Rs i.e i have done
{ //but if the user spend 120 min i want make charge of 20Rs, but in the database it saving like 60rs.
// I'm not getting where my calculation is wrong
st = "UPDATE tbl_time set amt='" + fee + "' WHERE ID=(SELECT MAX(ID) FROM tbl_time)";
db.ExeQuery(st);
}
if (ts.TotalMilliseconds > 60)
{
fee = (ts.TotalMinutes / 10) * 10;
st = "UPDATE tbl_time set amt='" + fee + "' WHERE ID=(SELECT MAX(ID) FROM tbl_time)";
db.ExeQuery(st);
}
}
}
Reply
Answers (
2
)
Can I Parse json Using Key vale pairs in windows phone 8
How to update a .dll file linked to object class?