public int CreateEmployeeTraining(EmpTrainingDTO Record) { Record.Id = 0; EmpTraining Domain = EmpTrainingRequestFormatter.ConvertRespondentInfoFromDTO(Record); using (TransactionScope Scope = new TransactionScope()) { //for (DateTime Today = Convert.ToDateTime(Record.TrainingVisitStartDate).Date; Today.Date <= Convert.ToDateTime(Record.TrainingVisitEndDate).Date; Today = Today.AddDays(1)) //{ // AttendaceDaily DailyRecord = _unitOfWork.AttendanceDailyRepository.Get(x => x.AttDate == Today && x.AttEmpCode == Record.EmpCode).FirstOrDefault(); // if(DailyRecord != null) // { // DailyRecord.IsTraining = true; // _unitOfWork.AttendanceDailyRepository.Update(DailyRecord); // }else // { // DailyRecord = new AttendaceDaily(); // DailyRecord.AttEmpCode = Record.EmpCode; // DailyRecord.AttDate = Today; // DailyRecord.IsTraining = true; // _unitOfWork.AttendanceDailyRepository.Create(DailyRecord); // } //} var newEntryId = _unitOfWork.EmpTrainingRepository.Create(Domain); Scope.Complete(); return(newEntryId.Id); //Calling stroprocedure for data in attendance daily table // exec Sp_TrainingAttendanceRecord newEntryId,'I' } }
public void UpdateEmployeeTraining(EmpTrainingDTO Record) { EmpTraining Domain = EmpTrainingRequestFormatter.ConvertRespondentInfoFromDTO(Record); _unitOfWork.EmpTrainingRepository.Update(Domain); }