/*************************************************************************** Updates a row in the tbl_employee_training table given a populated TrainingVO object. ****************************************************************************/ public TrainingVO UpdateTraining(TrainingVO trainingVO){ try{ DbCommand command = DataBase.GetSqlStringCommand(UPDATE_TRAINING); DataBase.AddInParameter(command, TRAINING_ID, DbType.Int32, trainingVO.TrainingID); DataBase.AddInParameter(command, EMPLOYEE_ID, DbType.Guid, trainingVO.EmployeeID); DataBase.AddInParameter(command, TITLE, DbType.String, trainingVO.Title); DataBase.AddInParameter(command, DESCRIPTION, DbType.String, trainingVO.Description); DataBase.AddInParameter(command, STARTDATE, DbType.DateTime, trainingVO.StartDate); DataBase.AddInParameter(command, ENDDATE, DbType.DateTime, trainingVO.EndDate); switch(trainingVO.Status){ case TrainingVO.TrainingStatus.Passed : DataBase.AddInParameter(command, STATUS, DbType.String, "Passed"); break; case TrainingVO.TrainingStatus.Failed : DataBase.AddInParameter(command, STATUS, DbType.String, "Failed"); break; } DataBase.ExecuteNonQuery(command); }catch(Exception e){ Console.WriteLine(e); } return this.GetTraining(trainingVO.TrainingID); }
/******************************************************************* Inserts a row into tbl_employee_training given populated TrainingVO object. Returns fully-populated TrainingVO object, including primary key. ********************************************************************/ public TrainingVO InsertTraining(TrainingVO trainingVO){ int trainingID = 0; try{ DbCommand command = DataBase.GetSqlStringCommand(INSERT_TRAINING); DataBase.AddInParameter(command, EMPLOYEE_ID, DbType.Guid, trainingVO.EmployeeID); DataBase.AddInParameter(command, TITLE, DbType.String, trainingVO.Title); DataBase.AddInParameter(command, DESCRIPTION, DbType.String, trainingVO.Description); DataBase.AddInParameter(command, STARTDATE, DbType.DateTime, trainingVO.StartDate); DataBase.AddInParameter(command, ENDDATE, DbType.DateTime, trainingVO.EndDate); switch(trainingVO.Status){ case TrainingVO.TrainingStatus.Passed : DataBase.AddInParameter(command, STATUS, DbType.String, "Passed"); break; case TrainingVO.TrainingStatus.Failed : DataBase.AddInParameter(command, STATUS, DbType.String, "Failed"); break; } trainingID = Convert.ToInt32(DataBase.ExecuteScalar(command)); }catch(Exception e){ Console.WriteLine(e); } return this.GetTraining(trainingID); }
public TrainingVO UpdateTraining(TrainingVO training) { EmployeeAdminBO bo = new EmployeeAdminBO(); return(bo.UpdateTraining(training)); }
public TrainingVO UpdateTraining(TrainingVO training){ TrainingDAO dao = new TrainingDAO(); return dao.UpdateTraining(training); }
public TrainingVO CreateTraining(TrainingVO training){ TrainingDAO dao = new TrainingDAO(); return dao.InsertTraining(training); }