private void updatetrainingidcomboBox_SelectedValueChanged(object sender, EventArgs e) { t = td.GetEmployeeTraininginfo(int.Parse(updatetrainingidcomboBox.Text)); updatetrainingtopictext.Text = t.topic; updatetrainingreviewtext.Text = t.reviewTraining; }
public bool updateTraining(Training obj) { string insertCommand = "update Training set topic=@topic,reviewOfTraining=@reviewOfTraining " + " where trainingId=@trainingId and EmployeeId=@EmployeeId "; SqlCommand command = new SqlCommand(insertCommand); SqlParameter trainingIdParameter = new SqlParameter("@trainingId", SqlDbType.Int); trainingIdParameter.Value = obj.trainingId; SqlParameter idParameter = new SqlParameter("@EmployeeId", SqlDbType.NVarChar, 50); idParameter.Value = obj.employeeId; SqlParameter topicParameter = new SqlParameter("@topic", SqlDbType.NVarChar, 50); topicParameter.Value = obj.topic; SqlParameter reviewOfTrainingParameter = new SqlParameter("@reviewOfTraining", SqlDbType.NVarChar, 50); reviewOfTrainingParameter.Value = obj.reviewTraining; command.Parameters.Add(trainingIdParameter); command.Parameters.Add(idParameter); command.Parameters.Add(topicParameter); command.Parameters.Add(reviewOfTrainingParameter); if (da.Execution(command)) { return true; } else { return false; } }
public bool insertTraining(Training obj) { string insertCommand = "INSERT INTO Training (trainingId,EmployeeId,topic,reviewOfTraining) " + "VALUES (@trainingId,@EmployeeId,@topic,@reviewOfTraining)"; SqlCommand command = new SqlCommand(insertCommand); SqlParameter trainingIdParameter = new SqlParameter("@trainingId", SqlDbType.Int); trainingIdParameter.Value = obj.trainingId; SqlParameter idParameter = new SqlParameter("@EmployeeId", SqlDbType.NVarChar, 50); idParameter.Value = obj.employeeId; SqlParameter topicParameter = new SqlParameter("@topic", SqlDbType.NVarChar, 50); topicParameter.Value = obj.topic; SqlParameter reviewOfTrainingParameter = new SqlParameter("@reviewOfTraining", SqlDbType.NVarChar, 50); reviewOfTrainingParameter.Value = obj.reviewTraining; command.Parameters.Add(trainingIdParameter); command.Parameters.Add(idParameter); command.Parameters.Add(topicParameter); command.Parameters.Add(reviewOfTrainingParameter); if (da.Execution(command)) { return true; } else { return false; } }
public List<Training> GetAllEmployeeTraining() { List<Training> tList = new List<Training>(); string query = "select trainingId,EmployeeId,topic,reviewOfTraining from training"; SqlCommand cmd = da.GetCommand(query); cmd.Connection.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Training t = new Training(); t.trainingId = reader.GetInt32(0); t.employeeId = reader.GetString(1); t.topic = reader.GetString(2); t.reviewTraining = reader.GetString(3); tList.Add(t); } return tList; }
public Training GetEmployeeTraininginfo(int tid) { Training t = new Training(); string query = "select topic,reviewOfTraining from training where trainingId='" + tid + "'"; SqlCommand cmd = da.GetCommand(query); cmd.Connection.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { t.topic=reader.GetString(0); t.reviewTraining = reader.GetString(1); } return t; }
public bool deleteTraining(Training obj) { string insertCommand = "delete from training " + "where trainingId= @trainingId "; SqlCommand command = new SqlCommand(insertCommand); SqlParameter trainingIdParameter = new SqlParameter("@trainingId", SqlDbType.Int); trainingIdParameter.Value = obj.trainingId; command.Parameters.Add(trainingIdParameter); if (da.Execution(command)) { return true; } else { return false; } }