Exemple #1
0
        public UserDTO Find(string userId)
        {
            UserDAO userDAO = FindUserDAO(userId);
            User    user    = ConverterDAOtoDomain.UserDaoToUser(userDAO);
            UserDTO userDTO = ConverterDomainToDTO.UserToUserDTO(user);

            return(userDTO);
        }
        private void Write_list(List <KeyValuePair <String, String> > oneTask)
        {
            ExcelAccountTemplate template = currentAccount.Template.FirstOrDefault();

            if (template == null)
            {
                return;
            }
            TaskMain task = new TaskMain();

            task.TaskID = (from keyValue in oneTask
                           where keyValue.Key == template.TaskID
                           select keyValue.Value).SingleOrDefault <String>();

            task.Summary = (from keyValue in oneTask
                            where keyValue.Key == template.Summary
                            select keyValue.Value).SingleOrDefault <String>();

            task.SubtaskType = (from keyValue in oneTask
                                where keyValue.Key == template.SubtaskType
                                select keyValue.Value).SingleOrDefault <String>();

            task.Status = (from keyValue in oneTask
                           where keyValue.Key == template.Status
                           select keyValue.Value).SingleOrDefault <String>();

            task.Priority = (from keyValue in oneTask
                             where keyValue.Key == template.Priority
                             select keyValue.Value).SingleOrDefault <String>();

            task.CreatedDate = (from keyValue in oneTask
                                where keyValue.Key == template.CreatedDate
                                select keyValue.Value).SingleOrDefault <String>();

            task.CreatedBy = (from keyValue in oneTask
                              where keyValue.Key == template.CreatedBy
                              select keyValue.Value).SingleOrDefault <String>();

            task.Description = (from keyValue in oneTask
                                where keyValue.Key == template.Description
                                select keyValue.Value).SingleOrDefault <String>();

            task.Product = (from keyValue in oneTask
                            where keyValue.Key == template.Product
                            select keyValue.Value).SingleOrDefault <String>();

            task.Project = (from keyValue in oneTask
                            where keyValue.Key == template.Project
                            select keyValue.Value).SingleOrDefault <String>();

            task.Estimation = (from keyValue in oneTask
                               where keyValue.Key == template.Estimation
                               select keyValue.Value).SingleOrDefault <String>();

            task.TargetVersion = (from keyValue in oneTask
                                  where keyValue.Key == template.TargetVersion
                                  select keyValue.Value).SingleOrDefault <String>();

            task.Comments = (from keyValue in oneTask
                             where keyValue.Key == template.Comments
                             select keyValue.Value).SingleOrDefault <String>();

            var parentTask = (from keyValue in oneTask
                              where keyValue.Key == template.TaskParent
                              select keyValue.Value).SingleOrDefault <String>();

            if (!String.IsNullOrEmpty(parentTask))
            {
                parentTasks.Add(task.TaskID, parentTask);
            }

            var assigned = (from keyValue in oneTask
                            where keyValue.Key == template.Assigned
                            select keyValue.Value).SingleOrDefault <String>();

            if (!String.IsNullOrEmpty(assigned))
            {
                UserDAO user = UserDAO.FindUserFromDBByName(assigned);
                if (user != null)
                {
                    task.Assigned.Add(ConverterDAOtoDomain.UserDaoToUser(user));
                }
            }

            task.LinkToTracker = (from token in currentAccount.Tokens
                                  where token.TokenId == tokenID
                                  select token.TokenName).SingleOrDefault();


            task.Source = Sources.Excel;

            task.TokenID = tokenID;

            list_task.Add(task);
        }