예제 #1
0
        private List <WorkLogDataRow> ReadFile(string fileName, ModelSettings settings)
        {
            if (!File.Exists(fileName))
            {
                return(null);
            }

            ExcelFile importFile = ExcelFile.Load(fileName);
            var       ws         = importFile.Worksheets[0];

            if (!string.IsNullOrEmpty(settings.ExcelTabName) && importFile.Worksheets.Contains(settings.ExcelTabName))
            {
                ws = importFile.Worksheets[settings.ExcelTabName];
            }


            List <WorkLogDataRow> rows = new List <WorkLogDataRow>();
            int rowIdx = 0;

            foreach (ExcelRow excelRow in ws.Rows)
            {
                if (rowIdx > 0)
                {
                    WorkLogDataRow row = ImportRow(excelRow, settings.SourceFileSettings);
                    if (row != null)
                    {
                        rows.Add(row);
                    }
                }
                rowIdx++;
            }
            return(rows);
        }
예제 #2
0
        private WorkLogDataRow ImportRow(ExcelRow excelRow, SourceFileSettings settings)
        {
            WorkLogDataRow row   = new WorkLogDataRow();
            CellRange      cells = excelRow.Cells;

            row.Key         = GetStringValue(cells, settings.KeyField.Position - 1);
            row.Title       = GetStringValue(cells, settings.TitleField.Position - 1);
            row.Assignee    = GetStringValue(cells, settings.AssigneeField.Position - 1);
            row.Status      = GetStringValue(cells, settings.StatusField.Position - 1);
            row.WorkDateStr = GetStringValue(cells, settings.DateField.Position - 1);
            row.UserName    = GetStringValue(cells, settings.UserNameField.Position - 1);
            row.Url         = GetStringValue(cells, settings.UrlField.Position - 1);

            if (settings.EstimationField.IsUseStoryPointsFromMainPosition)
            {
                row.OriginalEstimateHours       = GetStringValue(cells, settings.EstimationField.AlternatePosition - 1);
                row.OriginalEstimateStoryPoints = GetStringValue(cells, settings.EstimationField.Position - 1);
            }
            else
            {
                row.OriginalEstimateHours       = GetStringValue(cells, settings.EstimationField.Position - 1);
                row.OriginalEstimateStoryPoints = "0";
            }
            row.OriginalEstimateHours       = RemoveSymbol(row.OriginalEstimateHours, 'h');
            row.OriginalEstimateStoryPoints = RemoveSymbol(row.OriginalEstimateStoryPoints, 'h');

            row.TimeSpent = RemoveSymbol(GetStringValue(cells, settings.TimeSpentField.Position - 1), 'h');

            return(row);
        }
예제 #3
0
        private Task CreateTask(WorkLogDataRow row, ModelSettings settings)
        {
            Task task = new Task();

            task.Key     = row.Key;
            task.KeyName = row.Key;
            if (string.IsNullOrEmpty(settings.SourceFileSettings.UrlField.PrefixToValue))
            {
                task.Url = row.Url;
            }
            else
            {
                task.Url = settings.SourceFileSettings.UrlField.PrefixToValue + row.Url;
            }

            task.Status = row.Status;
            task.Title  = row.Title;
            double estimation = 0;

            if (settings.SourceFileSettings.EstimationField.IsUseStoryPointsFromMainPosition)
            {
                double estimationStoryPoints = GetDouble(row.OriginalEstimateStoryPoints);
                double cost = settings.SourceFileSettings.EstimationField.StoryPointCost;
                estimation = estimationStoryPoints * cost;
                if (estimation < 0.000001)
                {
                    estimation = GetDouble(row.OriginalEstimateHours);
                }
            }
            else
            {
                estimation = GetDouble(row.OriginalEstimateHours);
            }
            task.Estimation     = estimation;
            task.TimeSpentByDev = GetDouble(row.TimeSpent);

            task.IsDone = GetIsDone(row.Status, settings.DoneStatuses);
            task.IsTaskRelatesToMettings    = GetIsMeeting(row.Key, settings.MeetingTasks);
            task.IsTaskRelatesToDevelopment = !task.IsTaskRelatesToMettings;
            task.IsTaskAssigned             = GetIsTaskAssigned(row.UserName, row.Assignee, settings.SourceFileSettings.AssigneeField.NameMapping);
            return(task);
        }
예제 #4
0
        private WorkLogDataRow ImportRow(ExcelRow excelRow, SourceFileSettings settings)
        {
            WorkLogDataRow row = new WorkLogDataRow();
            CellRange cells = excelRow.Cells;

            row.Key = GetStringValue(cells, settings.KeyField.Position - 1);
            row.Title = GetStringValue(cells, settings.TitleField.Position - 1);
            row.Assignee = GetStringValue(cells, settings.AssigneeField.Position - 1);
            row.Status = GetStringValue(cells, settings.StatusField.Position - 1);
            row.WorkDateStr = GetStringValue(cells, settings.DateField.Position - 1);
            row.UserName = GetStringValue(cells, settings.UserNameField.Position - 1);
            row.Url = GetStringValue(cells, settings.UrlField.Position - 1);

            if (settings.EstimationField.IsUseStoryPointsFromMainPosition)
            {
                row.OriginalEstimateHours = GetStringValue(cells, settings.EstimationField.AlternatePosition - 1);
                row.OriginalEstimateStoryPoints = GetStringValue(cells, settings.EstimationField.Position - 1);
            }
            else
            {
                row.OriginalEstimateHours = GetStringValue(cells, settings.EstimationField.Position - 1);
                row.OriginalEstimateStoryPoints = "0";
            }
            row.OriginalEstimateHours = RemoveSymbol(row.OriginalEstimateHours, 'h');
            row.OriginalEstimateStoryPoints = RemoveSymbol(row.OriginalEstimateStoryPoints, 'h');

            row.TimeSpent = RemoveSymbol(GetStringValue(cells, settings.TimeSpentField.Position - 1), 'h');

            return row;
        }
예제 #5
0
        private Task CreateTask(WorkLogDataRow row, ModelSettings settings)
        {
            Task task = new Task();
            task.Key = row.Key;
            task.KeyName = row.Key;
            if (string.IsNullOrEmpty(settings.SourceFileSettings.UrlField.PrefixToValue))
                task.Url = row.Url;
            else
                task.Url = settings.SourceFileSettings.UrlField.PrefixToValue + row.Url;

            task.Status = row.Status;
            task.Title = row.Title;
            double estimation = 0;
            if (settings.SourceFileSettings.EstimationField.IsUseStoryPointsFromMainPosition)
            {
                double estimationStoryPoints =  GetDouble(row.OriginalEstimateStoryPoints);
                double cost = settings.SourceFileSettings.EstimationField.StoryPointCost;
                estimation = estimationStoryPoints * cost;
                if (estimation  < 0.000001)
                {
                    estimation = GetDouble(row.OriginalEstimateHours);
                }
            }
            else
            {
                estimation =  GetDouble(row.OriginalEstimateHours);
            }
            task.Estimation = estimation;
            task.TimeSpentByDev = GetDouble(row.TimeSpent);

            task.IsDone = GetIsDone(row.Status, settings.DoneStatuses);
            task.IsTaskRelatesToMettings = GetIsMeeting(row.Key, settings.MeetingTasks);
            task.IsTaskRelatesToDevelopment = !task.IsTaskRelatesToMettings;
            task.IsTaskAssigned = GetIsTaskAssigned(row.UserName, row.Assignee, settings.SourceFileSettings.AssigneeField.NameMapping);
            return task;
        }