public List <AttendanceBase> GetAttendanceByCondition(int employeeId, DateTime theDayFrom, DateTime theDayTo, AttendanceTypeEmnu AttendaceType) { List <AttendanceBase> attendances = new List <AttendanceBase>(); SqlCommand cmd = new SqlCommand(); //cmd.Parameters.Add(_EmployeeName, SqlDbType.NVarChar, 50).Value = employeeName; cmd.Parameters.Add(_EmployeeId, SqlDbType.Int).Value = employeeId; cmd.Parameters.Add(_DayFrom, SqlDbType.DateTime).Value = theDayFrom; cmd.Parameters.Add(_DayTo, SqlDbType.DateTime).Value = theDayTo; cmd.Parameters.Add(_AttendanceType, SqlDbType.Int).Value = AttendaceType; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAttendanceByCondition", cmd)) { while (sdr.Read()) { switch ((AttendanceTypeEmnu)sdr[_DbAttendanceType]) { case AttendanceTypeEmnu.Absenter: AbsentAttendance absent = new AbsentAttendance(Convert.ToInt32(sdr[_DbEmployeeId]), Convert.ToDateTime(sdr[_DbTheDay]), Convert.ToDecimal(sdr[_DbDays])); absent.AttendanceId = Convert.ToInt32(sdr[_DbPKID]); absent.AddDutyDays = Convert.ToDecimal(sdr[_DbAddDutyDays]); absent.Days = Convert.ToDecimal(sdr[_DbDays]); //absent.EmployeeName = sdr[_DbEmployeeName].ToString(); attendances.Add(absent); break; case AttendanceTypeEmnu.Early: EarlyLeaveAttendance early = new EarlyLeaveAttendance(Convert.ToInt32(sdr[_DbEmployeeId]), Convert.ToDateTime(sdr[_DbTheDay]), Convert.ToInt32(sdr[_DbEarlyAndLateMunite])); early.AttendanceId = Convert.ToInt32(sdr[_DbPKID]); early.AddDutyDays = Convert.ToDecimal(sdr[_DbAddDutyDays]); early.Days = Convert.ToDecimal(sdr[_DbDays]); //early.EmployeeName = sdr[_DbEmployeeName].ToString(); attendances.Add(early); break; case AttendanceTypeEmnu.Late: LaterAttendance late = new LaterAttendance(Convert.ToInt32(sdr[_DbEmployeeId]), Convert.ToDateTime(sdr[_DbTheDay]), Convert.ToInt32(sdr[_DbEarlyAndLateMunite])); late.AttendanceId = Convert.ToInt32(sdr[_DbPKID]); late.AddDutyDays = Convert.ToDecimal(sdr[_DbAddDutyDays]); late.Days = Convert.ToDecimal(sdr[_DbDays]); //late.EmployeeName = sdr[_DbEmployeeName].ToString(); attendances.Add(late); break; } } return(attendances); } }
public List <AttendanceBase> GetAttendanceByEmpId(int EmpId) { List <AttendanceBase> attendances = new List <AttendanceBase>(); SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_EmployeeId, SqlDbType.Int).Value = EmpId; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetAttendanceByEmpId", cmd)) { while (sdr.Read()) { switch ((AttendanceTypeEmnu)sdr[_DbAttendanceType]) { case AttendanceTypeEmnu.Absenter: AbsentAttendance absent = new AbsentAttendance(Convert.ToInt32(sdr[_DbEmployeeId]), Convert.ToDateTime(sdr[_DbTheDay]), Convert.ToDecimal(sdr[_DbDays])); absent.AttendanceId = Convert.ToInt32(sdr[_DbPKID]); absent.AddDutyDays = Convert.ToDecimal(sdr[_DbAddDutyDays]); absent.Days = Convert.ToDecimal(sdr[_DbDays]); attendances.Add(absent); break; case AttendanceTypeEmnu.Early: EarlyLeaveAttendance early = new EarlyLeaveAttendance(Convert.ToInt32(sdr[_DbEmployeeId]), Convert.ToDateTime(sdr[_DbTheDay]), Convert.ToInt32(sdr[_DbEarlyAndLateMunite])); early.AttendanceId = Convert.ToInt32(sdr[_DbPKID]); early.AddDutyDays = Convert.ToDecimal(sdr[_DbAddDutyDays]); early.Days = Convert.ToDecimal(sdr[_DbDays]); attendances.Add(early); break; case AttendanceTypeEmnu.Late: LaterAttendance late = new LaterAttendance(Convert.ToInt32(sdr[_DbEmployeeId]), Convert.ToDateTime(sdr[_DbTheDay]), Convert.ToInt32(sdr[_DbEarlyAndLateMunite])); late.AttendanceId = Convert.ToInt32(sdr[_DbPKID]); late.AddDutyDays = Convert.ToDecimal(sdr[_DbAddDutyDays]); late.Days = Convert.ToDecimal(sdr[_DbDays]); attendances.Add(late); break; } } return(attendances); } }
protected override void ExcuteSelf() { LaterAttendance attendance = new LaterAttendance(_ItsAccount.Id, _TheDay, _LaterMinutes); _CurrentAttendanceId = _AttendanceDal.Insert(attendance); }