hello sir i want to calculate total working hours of employee in c#.
like IN=10:00
OUT=12:00
IN:1:00
OUT:5:00
duration=2+5=7;
below code calculate only last in and out duration i want all in and out dueation time.
if (dt1.Rows.Count > 0)
{
for (int j = 0; j < dt1.Rows.Count; j++)
{
DateDay = Convert.ToDateTime(dt1.Rows[j]["emp_ToDate"]);
string st = dt1.Rows[j]["emp_InOut"].ToString();
string time1 = (dt1.Rows[j]["emp_Time"]).ToString();
if (st == ("IN"))
{
Input = Convert.ToString((time1));
}else
if (st == "OUT")
{
Output = Convert.ToString((time1));
}
try
{
duration2 = duration + (DateTime.Parse(Input).Subtract(DateTime.Parse(Output)).Duration());
}
catch { }
}
Piyush PansuriyaPosted Feb 27, 2015, 5:13 AM
if It is not exist than you have to give message.
AmitPosted Feb 27, 2015, 4:35 AM
i want to add message when employee click on OUT radio button and display message your input entry is not present first in then out .how to check in in database and display message..
i have following code.
PradeepPosted Feb 25, 2015, 3:20 AM
if (dt1.Rows.Count > 0)
AmitPosted Feb 25, 2015, 1:49 AM
hello
Piyush Pansuriya
i have multiple IN and OUT in my same row column .i want to fetch first In and compare with my maintime=10:00 .If IN is grater than my maintime save late mark in database . i have this code . i want first in from column. when i use this code he get last In from table and compare.
My IN time is in 10:30 PM format i have split this in following format.
string[] PT = Input.Split(Convert.ToChar(" "));
string T=PT[0];
string w = T.Split(Convert.ToChar(":"));
string IT =Convert.ToInt32( w[0]);
if(IT>10)
{
status=LATE;
}
AmitPosted Feb 25, 2015, 12:14 AM
Thanku sir...
Piyush PansuriyaPosted Feb 24, 2015, 7:13 AM
if (dt1.Rows.Count > 0)
Input = Output = null;
AmitPosted Feb 24, 2015, 5:59 AM
when my second loop get second IN that time add previous out time also i dont want this .i want only first in and out + second in and out + third In and Out.when i get second in then first out get clear.
Piyush PansuriyaPosted Feb 18, 2015, 6:19 AM
AmitPosted Feb 18, 2015, 5:30 AM
when employee in and out in company many times and calculate total duration he work in company from in and out time .
if IN=10 out=12 duration is 2
IN=1 out=5 duration 5
total duration is 5+2 in one variable .if number of time in and out in database i want to calculate the total duration. my code code ony give me a last in and out time.
Piyush PansuriyaPosted Feb 18, 2015, 5:19 AM