private void call_Calc_StdHrs(DateTime tFromDt, out string err) { err = string.Empty; using (SqlConnection cn = new SqlConnection(Utils.Helper.constr)) { try { cn.Open(); string sql = string.Empty; sql = "Select EmpUnqID,WrkGrp From MastEmp where WrkGrp in ('Comp','Cont') And Active = 1 "; DataSet dsEmp = Utils.Helper.GetData(sql, Utils.Helper.constr); bool hasRows = dsEmp.Tables.Cast <DataTable>().Any(table => table.Rows.Count != 0); if (hasRows) { foreach (DataRow drEmp in dsEmp.Tables[0].Rows) { //Open EmpAttdRecord sql = "Select tYear,tDate,CompCode,WrkGrp,EmpUnqID,ScheDuleShift,ConsShift,ConsIN,ConsOut,ConsWrkHrs,ConsOverTime," + "Status,HalfDay,LeaveTyp,LeaveHalf,ActualStatus,Earlycome,EarlyGoing,GracePeriod," + "INPunch1,OutPunch1,WrkHrs1,INPunch2,OutPunch2,WrkHrs2,INPunch3,OutPunch3," + "WrkHrs3,INPunch4,OutPunch4,WrkHrs4,TotalWorkhrs,TotalINPunchCount," + "TotalOutPunchCount,LateCome,Rules,CalcOverTime,HalfDRule,partdate,CostCode,StdHrsOT,StdShftHrs,StdWrkHrs,StdWrkShift " + " From AttdData where CompCode = '01' and tYear ='" + tFromDt.Year.ToString() + "'" + " And WrkGrp ='" + drEmp["WrkGrp"].ToString() + "' and tDate ='" + tFromDt.ToString("yyyy-MM-dd") + "'" + " And EmpUnqID ='" + drEmp["EmpUnqID"].ToString() + "'"; //create data adapter DataSet dsAttdData = new DataSet(); SqlDataAdapter daAttdData = new SqlDataAdapter(new SqlCommand(sql, cn)); SqlCommandBuilder AttdCmdBuilder = new SqlCommandBuilder(daAttdData); daAttdData.Fill(dsAttdData, "AttdData"); hasRows = dsAttdData.Tables.Cast <DataTable>().Any(table => table.Rows.Count != 0); if (hasRows) { foreach (DataRow drAttd in dsAttdData.Tables[0].Rows) { clsProcess pr = new clsProcess(); pr.Calc_StdHrs(daAttdData, dsAttdData, drAttd); } } }//foreach employee } } catch (Exception ex) { err = ex.Message; } }//using }