public void UpdateRecipeDetailsSequencing(int recipeId, string sequencing) { if (recipeId > 0) { _executerVoidCmd executer = new _executerVoidCmd(ExecuteVoidSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("UpdateRecipeDetailsSequencing", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@RecipeId", recipeId); if (sequencing == null) { cmd.Parameters.AddWithValue("@Sequencing", DBNull.Value); } else { cmd.Parameters.AddWithValue("@Sequencing", sequencing); } executer(sqlConnection, cmd); } } } }
public void DeleteCategory(int categoryId) { if (categoryId > 0) { Category category = GetCategoryById(categoryId); List <Category> childCategories = GetChildCategoriesById(categoryId); if (childCategories != null) { if (childCategories.Count > 0) { foreach (Category item in childCategories) { UpdateCategoryParentId(item.CategoryId, category.ParentId); } } } _executerVoidCmd executer = new _executerVoidCmd(ExecuteVoidSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("DeleteCategory", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CategoryId", categoryId); executer(sqlConnection, cmd); } } } }
public void UpdateCategory(Category category) { if (category != null) { _executerVoidCmd executer = new _executerVoidCmd(ExecuteVoidSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("UpdateCategory", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CategoryId", category.CategoryId); cmd.Parameters.AddWithValue("@Name", category.Name); if (category.ParentId == 0) { cmd.Parameters.AddWithValue("@ParentId", DBNull.Value); } else { cmd.Parameters.AddWithValue("@ParentId", category.ParentId); } executer(sqlConnection, cmd); } } } }
private void UpdateCategoryParentId(int categoryId, int parentId) { _executerVoidCmd executer = new _executerVoidCmd(ExecuteVoidSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("UpdateCategoryParentId", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CategoryId", categoryId); cmd.Parameters.AddWithValue("@ParentId", parentId); executer(sqlConnection, cmd); } } }
public void DeleteUser(int userId) { if (userId > 0) { _executerVoidCmd executer = new _executerVoidCmd(ExecuteVoidSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("DeleteUser", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserId", userId); executer(sqlConnection, cmd); } } } }
public void InsertInrgridient(Ingridient ingridient) { if (ingridient != null) { _executerVoidCmd executer = new _executerVoidCmd(ExecuteVoidSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("InsertIngridient", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Name", ingridient.Name); executer(sqlConnection, cmd); } } } }
public void DeleteRecipeIngridient(int recipeId, int ingridientId) { if (recipeId > 0 && ingridientId > 0) { _executerVoidCmd executer = new _executerVoidCmd(ExecuteVoidSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("DeleteRecipeIngridient", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@RecipeId", recipeId); cmd.Parameters.AddWithValue("@IngridientId", ingridientId); executer(sqlConnection, cmd); } } } }
public void UpdateRecipeIngridient(RecipeIngridient recipeIngridient) { if (recipeIngridient != null) { _executerVoidCmd executer = new _executerVoidCmd(ExecuteVoidSqlCmd); using (SqlConnection sqlConnection = new SqlConnection(_connectionString)) { using (SqlCommand cmd = new SqlCommand("UpdateRecipeIngridient", sqlConnection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@RecipeId", recipeIngridient.RecipeId); cmd.Parameters.AddWithValue("@IngridientId", recipeIngridient.IngridientId); cmd.Parameters.AddWithValue("@Weight", recipeIngridient.Weight); executer(sqlConnection, cmd); } } } }