public void CreateTaskInProject(Task task, int projectID) { try { bool taskPresent = ValidationHelper.IfTaskExist(task.TaskID); bool projectPresent = ValidationHelper.IfProjectExist(projectID); if (projectPresent && taskPresent) { CompanyDBDataContext dc = new CompanyDBDataContext(); ProjectTaskMap projectTask = new ProjectTaskMap(); projectTask.TaskID = task.TaskID; projectTask.ProjectID = projectID; dc.ProjectTaskMaps.InsertOnSubmit(projectTask); dc.SubmitChanges(); } else if (!taskPresent || !projectPresent) { if (taskPresent) { throw new Exception(QueryResource.TechnologyNotexist); } else if (projectPresent) { throw new Exception(QueryResource.TaskNotExist); } else { throw new Exception(QueryResource.TechAndTaskNotExit); } } } catch (Exception ex) { throw ex; } }
public void insertProjectTaskMap(int id, int projectId, int taskId) { DataClasses1DataContext dc = new DataClasses1DataContext(); ProjectTaskMap projectTask = new ProjectTaskMap(); projectTask.ProjectTaskMapID = id; projectTask.ProjectID = projectId; projectTask.TaskID = taskId; dc.ProjectTaskMaps.InsertOnSubmit(projectTask); dc.SubmitChanges(); }
public void AddProjectTaskMap(ProjectTaskMap projectTask) { CompanyDBDataContext dc = new CompanyDBDataContext(); string dataValidate = ValidationHelper.CheckCompulsoryProjectTaskColumn(projectTask); if (dataValidate != QueryResource.AllFieldsPresent) { throw new Exception(dataValidate); } dc.ProjectTaskMaps.InsertOnSubmit(projectTask); dc.SubmitChanges(); }
public static string CheckCompulsoryProjectTaskColumn(ProjectTaskMap projectTask) { if (projectTask.ProjectTaskMapID == 0) { return(QueryResource.ProjectTaskIDMissing); } else if (projectTask.ProjectID == 0) { return(QueryResource.ProjectIdMissing); } else if (projectTask.TaskID == 0) { return(QueryResource.TaskIdMissing); } else { return(QueryResource.AllFieldsPresent); } }