Ejemplo n.º 1
0
        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; }
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
 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);
     }
 }