Esempio n. 1
0
        public static ModelSettings CreateJiraTempoSettings()
        {
            ModelSettings settings = new ModelSettings();
            settings.Name = "Jira";

            return new ModelSettings();
        }
Esempio n. 2
0
        private void CalcGroups(List<WorkLogDataRow> fileData, ObservableCollection<TaskGroup> groups, TaskGroup summary, DateTime dateFrom, DateTime dateTo, ModelSettings settings)
        {
            foreach (WorkLogDataRow row in fileData)
            {
                if (row.Key == null)
                    continue;

                DateTime bookDate = GetDate(row.WorkDateStr, settings.SourceFileSettings.DateField);

                if (bookDate >= dateFrom && bookDate <= dateTo)
                {
                    TaskGroup group = groups.FirstOrDefault(x => x.Id == row.UserName);
                    if (group == null)
                    {
                        group = new TaskGroup();
                        group.Id = row.UserName;
                        group.Title = row.UserName;
                        groups.Add(group);
                    }

                    Task task = CreateTask(row, settings);
                    AddTaskToGroup(group, task);
                    AddTaskToGroup(summary, task);
                }
            }
        }
Esempio n. 3
0
        public static ModelSettings CreateJiraTempoSettings()
        {
            ModelSettings settings = new ModelSettings();

            settings.Name = "Jira";

            return(new ModelSettings());
        }
Esempio n. 4
0
        public ObservableCollection<TaskGroup> LoadTimeSheetReport(string fileName, DateTime dateFrom, DateTime dateTo, ModelSettings settings)
        {
            if (!File.Exists(fileName))
                return null;
            List<WorkLogDataRow> fileData = ReadFile(fileName, settings);
            if (fileData == null)
                return null;

            ObservableCollection<TaskGroup> groups = new ObservableCollection<TaskGroup>();
            TaskGroup summary = new TaskGroup { IsSummary = true, Title = "All" };
            groups.Add(summary);

            CalcGroups(fileData, groups, summary, dateFrom, dateTo, settings);

            CalcTotals(groups, settings);
            return groups;
        }
Esempio n. 5
0
        public static ObservableCollection<TaskGroup> CreateTestData()
        {
            ModelSettings settings = new ModelSettings();
            TaskGroup group1 =  new TaskGroup();
            group1.Title = "Test 1";
            group1.Tasks.Add(CreateTestTask());
            group1.Tasks.Add(CreateTestTask());
            group1.CalculateTotals(settings);

            TaskGroup group2 =  new TaskGroup();
            group2.Title = "Test 2";
            group2.Tasks.Add(CreateTestTask());
            group2.Tasks.Add(CreateTestTask());
            group2.CalculateTotals(settings);
            ObservableCollection<TaskGroup> groups = new ObservableCollection<TaskGroup>();
            groups.Add(group1);
            groups.Add(group2);

            return groups;
        }
Esempio n. 6
0
 private void CalcTotals(ObservableCollection<TaskGroup> groups, ModelSettings settings)
 {
     foreach(var group in groups)
     {
         group.CalculateTotals(settings);
     }
 }
Esempio n. 7
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;
        }
Esempio n. 8
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;
        }
Esempio n. 9
0
 public void SaveSetting(ModelSettings setings)
 {
     string fileName = setings.FileName;
     if (string.IsNullOrEmpty(fileName))
     {
         fileName = setings.Name + SettingsFileExtension;
     }
     string fullFileName = Path.Combine(SettingsDataDirectory,fileName);
     setings.FileName = fileName;
     XmlSerializer ser = new XmlSerializer(typeof(ModelSettings));
     using (TextWriter writer = new StreamWriter(fullFileName, false))
     {
         ser.Serialize(writer, setings);
         writer.Close();
     }
 }
Esempio n. 10
0
        private void ButtonEdit_Click(object sender, RoutedEventArgs e)
        {
            if (Selected == null)
            {
                MessageBox.Show("Select configuration", "Not selected", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            SettingsWindow window = new SettingsWindow();
            var selectedItem = Selected;
            ModelSettings settingsCopy = Selected.MakeCopy();

            window.DataContext = selectedItem;
            window.Owner = this;
            window.ShowDialog();
            if (window.DialogResult == true)
            {
                _fileHelper.SaveSetting(selectedItem);
            }
            else
            {
                bool isActiveConfig = MainViewModel.ActiveConfigutaion == selectedItem;
                int currentIdx = Items.IndexOf(selectedItem);
                Items[currentIdx] = settingsCopy;
                Selected = settingsCopy;

                if (isActiveConfig)
                    MainViewModel.ActiveConfigutaion = settingsCopy;
            }
        }
Esempio n. 11
0
        private void ButtonDelete_Click(object sender, RoutedEventArgs e)
        {
            if (Selected == null)
            {
                MessageBox.Show("Select configuration", "Not selected", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            MessageBoxResult result = MessageBox.Show("Do you want to delete this configuration?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question);
            if (result == MessageBoxResult.Yes)
            {
                var selectedItem = Selected;
                _fileHelper.DeleteSetting(selectedItem);
                if (MainViewModel.ActiveConfigutaion == selectedItem)
                    MainViewModel.ActiveConfigutaion = null;

                Items.Remove(selectedItem);
                Selected = null;
            }
        }
Esempio n. 12
0
 void SettingsListWindow_Loaded(object sender, RoutedEventArgs e)
 {
     this.Loaded -= SettingsListWindow_Loaded;
     Selected = InitalSelected;
 }
Esempio n. 13
0
 private void ButtonNew_Click(object sender, RoutedEventArgs e)
 {
     ModelSettings model = new ModelSettings() { Name = "Data File Settings" };
     SettingsWindow window = new SettingsWindow();
     window.DataContext = model;
     window.Owner = this;
     window.ShowDialog();
     if (window.DialogResult == true)
     {
         _fileHelper.SaveSetting(model);
         Items.Add(model);
     }
 }
Esempio n. 14
0
        public void CalculateTotals(ModelSettings settings)
        {
            CalcItemsTotals();
            ResetTotals();
            _totalEstimationDevelopment = _tasks.Where( x => x.IsTaskRelatesToDevelopment).Sum(x => x.Estimation);

            _totalTimeBooked = _tasks.Sum(x => x.TimeSpentByDev);

            _totalDoneBookedDevelopment = _tasks.Where( x => x.IsDone && x.IsTaskRelatesToDevelopment).Sum(x => x.TimeSpentByDev);
            _totalDoneEstimationDevelopment = _tasks.Where( x => x.IsDone && x.IsTaskRelatesToDevelopment).Sum(x => x.Estimation);

            _totalBookedMeetings = _tasks.Where(x => x.IsTaskRelatesToMettings).Sum(x => x.TimeSpentByDev);
            _totalBookedDevelopment =  _tasks.Where(x => x.IsTaskRelatesToDevelopment).Sum(x => x.TimeSpentByDev);

            if (!settings.SourceFileSettings.AssigneeField.AddAssignedToAnotherToDone)
            {
                double totalDoneButNotManagedByDeveloper = _tasks.Where(x => !x.IsTaskAssigned && x.IsDone && x.IsTaskRelatesToDevelopment).Sum(x => x.TimeSpentByDev);
                double totalEstimationDoneButNotManagedByDeveloper = _tasks.Where(x => !x.IsTaskAssigned && x.IsDone && x.IsTaskRelatesToDevelopment).Sum(x => x.Estimation);
                _totalDoneBookedDevelopment = _totalDoneBookedDevelopment - totalDoneButNotManagedByDeveloper;
                _totalDoneEstimationDevelopment = _totalDoneEstimationDevelopment -
                                                  totalEstimationDoneButNotManagedByDeveloper;
            }

            if (_totalBookedDevelopment > 0)
            {
                _rateDoneBookedToBookedDevelopment = _totalDoneBookedDevelopment / _totalBookedDevelopment;
            }
            else
            {
                if (_totalDoneBookedDevelopment > 0)
                    _rateDoneBookedToBookedDevelopment = 1;
                else
                    _rateDoneBookedToBookedDevelopment = 0;
            }

            if (_totalDoneEstimationDevelopment > 0)
            {
                _rateDoneEstimationToDevelopment = _totalDoneEstimationDevelopment / _totalBookedDevelopment;
            }
            else
            {
                if (_totalDoneEstimationDevelopment > 0)
                    _rateDoneEstimationToDevelopment = 1;
                else
                    _rateDoneEstimationToDevelopment = 0;
            }

            // calculates only done and development.
            _totalUnderEstimate = _tasks.Sum(x => x.UnderEstimate);
            RaisePropertyChanged(string.Empty);
        }