public void Add(Rank entity) { using (SqlCommand cmd = new SqlCommand("INSERT INTO Ranks VALUES (@RankName)")) { cmd.Parameters.AddWithValue("RankName", entity.RankName); VTYS.SqlExecuteNonQuery(cmd); } }
public void Delete(Employee entity) { using (SqlCommand cmd = new SqlCommand("DELETE FROM Employees where Id = @Id")) { cmd.Parameters.AddWithValue("Id", entity.Id); VTYS.SqlExecuteNonQuery(cmd); } }
public void Delete(Rank entity) { using (SqlCommand cmd = new SqlCommand("DELETE FROM Ranks where RankId = @RankId")) { cmd.Parameters.AddWithValue("Id", entity.RankId); VTYS.SqlExecuteNonQuery(cmd); } }
public void Update(Rank entity) { using (SqlCommand cmd = new SqlCommand("UPDATE Ranks set RankId = @RankId, RankName = @RankName, where RankId = @RankId")) { cmd.Parameters.AddWithValue("RankId", entity.RankId); cmd.Parameters.AddWithValue("RankName", entity.RankName); VTYS.SqlExecuteNonQuery(cmd); } }
public void Add(Employee entity) { using (SqlCommand cmd = new SqlCommand("INSERT INTO Employees (FirstName,LastName,Salary, RankId) VALUES (@FirstName,@LastName,@salary, @RankIdd)")) { cmd.Parameters.AddWithValue("FirstName", entity.FirstName); cmd.Parameters.AddWithValue("LastName", entity.LastName); cmd.Parameters.AddWithValue("Salary", entity.Salary); cmd.Parameters.AddWithValue("RankId", entity.RankId); VTYS.SqlExecuteNonQuery(cmd); } }
public void Update(Employee entity) { using (SqlCommand cmd = new SqlCommand("UPDATE Employees set FirstName = @FirstName, LastName = @LastName, Salary = @Salary, RankId = @RankId, where Id = @Id")) { cmd.Parameters.AddWithValue("Id", entity.Id); cmd.Parameters.AddWithValue("FirstName", entity.FirstName); cmd.Parameters.AddWithValue("LastName", entity.LastName); cmd.Parameters.AddWithValue("Salary", entity.Salary); cmd.Parameters.AddWithValue("RankId", entity.RankId); VTYS.SqlExecuteNonQuery(cmd); } }