/// <summary> /// Gets and bulk updates project tasks. Called when the "Get and bulk update tasks" button is pressed. /// Expects the CreateProjectTask method to be run first. /// </summary> private bool GetAndBulkUpdateProjectTasks() { // Prepare the parameters string where = "ProjectTaskDisplayName LIKE N'My new task%'"; string orderBy = ""; int topN = 0; string columns = ""; // Get the data DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns); if (!DataHelper.DataSourceIsEmpty(tasks)) { // Loop through the individual items foreach (DataRow taskDr in tasks.Tables[0].Rows) { // Create object from DataRow ProjectTaskInfo modifyTask = new ProjectTaskInfo(taskDr); // Update the properties modifyTask.ProjectTaskDisplayName = modifyTask.ProjectTaskDisplayName.ToUpper(); // Save the changes ProjectTaskInfoProvider.SetProjectTaskInfo(modifyTask); } return(true); } return(false); }
/// <summary> /// Gets and updates project task. Called when the "Get and update task" button is pressed. /// Expects the CreateProjectTask method to be run first. /// </summary> private bool GetAndUpdateProjectTask() { // Prepare the parameters string where = "ProjectTaskDisplayName LIKE N'My new task%'"; string orderBy = ""; int topN = 0; string columns = ""; // Get the data DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns); if (!DataHelper.DataSourceIsEmpty(tasks)) { // Get the project task ProjectTaskInfo updateTask = new ProjectTaskInfo(tasks.Tables[0].Rows[0]); if (updateTask != null) { // Update the properties updateTask.ProjectTaskDisplayName = updateTask.ProjectTaskDisplayName.ToLowerCSafe(); // Save the changes ProjectTaskInfoProvider.SetProjectTaskInfo(updateTask); return(true); } } return(false); }
/// <summary> /// Deletes project task. Called when the "Delete task" button is pressed. /// Expects the CreateProjectTask method to be run first. /// </summary> private bool DeleteProjectTask() { // Prepare the parameters string where = "ProjectTaskDisplayName LIKE N'My new task%'"; string orderBy = ""; int topN = 0; string columns = ""; // Get the data DataSet tasks = ProjectTaskInfoProvider.GetProjectTasks(where, orderBy, topN, columns); if (!DataHelper.DataSourceIsEmpty(tasks)) { // Get the project task ProjectTaskInfo deleteTask = new ProjectTaskInfo(tasks.Tables[0].Rows[0]); // Delete the project task ProjectTaskInfoProvider.DeleteProjectTaskInfo(deleteTask); return(deleteTask != null); } return(false); }