using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Data; using HRM.BO; using Ease.Core.DataAccess; namespace HRM.DA { class EmpFieldTrackDA { internal static IDataReader Get(TransactionContext tc, int id) { return tc.ExecuteReader(@"select * from EMPFIELDTRACK where EmpFieldTrackID=%n", id); } internal static IDataReader Get(TransactionContext tc) { return tc.ExecuteReader(@"select * from EMPFIELDTRACK"); } internal static IDataReader Get(TransactionContext tc, DateTime tranDate) { return tc.ExecuteReader(@"select * from EMPFIELDTRACK where TranDateTime=%d", tranDate.Date); } internal static int Insert(TransactionContext tc, EmpFieldTrack empTrack) { tc.ExecuteNonQuery( @"insert into EMPFIELDTRACK(EmpFieldTrackID,EmployeeID,IMENO,NearLocation,Client,Remarks,Zipcode,Latitude,Longitude,TranDateTime) values(%n,%n,%s,%s,%s,%s,%s,%n,%n,%D)", empTrack.ID, empTrack.EmployeeID, empTrack.IMENumber, empTrack.NearLocation, empTrack.Client, empTrack.Remarks, empTrack.Zipcode, empTrack.Longitude, empTrack.Longitude, empTrack.TranDateTime); return empTrack.ID; } internal static void Delete(TransactionContext tc, int nID) { tc.ExecuteNonQuery(@"delete from EMPFIELDTRACK where EmpFieldTrackID=%n", nID); } internal static int Update(TransactionContext tc, EmpFieldTrack empTrack) { tc.ExecuteNonQuery( @"update EMPFIELDTRACK set EmployeeID=%n,IMENO=%s,NearLocation=%s,Client=%s,Remarks=%s,Zipcode=%s,Latitude=%n,Longitude=%n,TranDateTime=%D where EmpFieldTrackID=%n ", empTrack.EmployeeID, empTrack.IMENumber, empTrack.NearLocation, empTrack.Client, empTrack.Remarks, empTrack.Zipcode, empTrack.Longitude, empTrack.Longitude, empTrack.TranDateTime, empTrack.ID); return empTrack.ID; } } }