Пример #1
0
        private static void CreateRow([NotNull] ActivityReport report, [NotNull] ISheet sheet, int i, [NotNull] ActivityReportItem item, [NotNull] ICellStyle timeCellStyle)
        {
            var row = sheet.CreateRow(i);

            var    cell = row.CreateCell(0);
            string periodType;

            switch (item.PeriodType)
            {
            case PeriodType.Working:
                periodType = Texts.Working;
                break;

            case PeriodType.Leisure:
                periodType = Texts.Leisure;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(item.PeriodType), item.PeriodType, null);
            }

            cell.SetCellValue(periodType);

            cell = row.CreateCell(1);
            cell.SetCellValue((item.Period ?? report.ReportDate - item.Start).ToPrettyFormat());

            cell           = row.CreateCell(2);
            cell.CellStyle = timeCellStyle;
            cell.SetCellValue(item.Start);

            cell           = row.CreateCell(3);
            cell.CellStyle = timeCellStyle;
            cell.SetCellValue(item.End ?? DateTime.Now);
            AutoSizeRow(row, sheet);
        }
Пример #2
0
        private void CreateTimeReport()
        {
            WorkingTimeReport = new List <RIWorkingTime>();

            foreach (var employee in _params.Employees)
            {
                var schedual = new Schedual(new SchedualParams
                {
                    Name  = employee,
                    Start = _params.Start,
                    End   = _params.End
                }, _config);

                var item = new RIWorkingTime();

                item.EmployeeName = employee;

                item.SchedualeHours = schedual.Hours;

                item.DevOpsHours = ActivityReport.Where(x => x.AssigndTo == employee).Sum(x => x.CompletedWork);

                item.Diff = item.DevOpsHours - item.SchedualeHours;

                WorkingTimeReport.Add(item);
            }
        }
Пример #3
0
        public TimeInfoViewModel(
            [NotNull] ILog logger,
            [NotNull] IActivityProcessor activityProcessor,
            [NotNull] IReportSerializer reportSerializer,
            [NotNull] IStatusChangeEventRepository statusChangeEventRepository)
        {
            _statusChangeEventRepository = statusChangeEventRepository ?? throw new ArgumentNullException(nameof(statusChangeEventRepository));
            activityProcessor            = activityProcessor ?? throw new ArgumentNullException(nameof(activityProcessor));

            ToggleCommand = new CorrelationCommand <ActivityReportItemViewModel>(Toggle);
            _report       = activityProcessor.GenerateReport(DateTime.Now);
            _timer        = new DispatcherTimer
            {
                Interval = TimeSpan.FromSeconds(1)
            };
            _timer.Start();
            _report = activityProcessor.GenerateReport(DateTime.Now);
            ActivityReportItems.Clear();
            foreach (var viewModelItem in _report.Items.Select(item => new ActivityReportItemViewModel(item)))
            {
                ActivityReportItems.Add(viewModelItem);
            }

            SetCurrentTimeInfo();
            _timer.Tick += Timer_Tick;
        }
      public IHttpActionResult activityReport(Guid orgId, Guid projId, Guid? locId) {
        DateTime? startDate = grabStartDate();
        DateTime? endDate = grabEndDate();

        ReportData<ICollection<ActivityReport.Referral>> reportData = ActivityReport.build(orgId, projId, locId, startDate, endDate);
        return Ok(reportData);
      } // actionRequired
        public static testsuiteTestcase ConvertTestcase(ActivityReport activityReport, int index)
        {
            testsuiteTestcase tc = new testsuiteTestcase();

            tc.name = string.Format("#{0,5:00000}: {1}", index + 1, activityReport.Name);
            if (activityReport.ActivityExtensionData != null && activityReport.ActivityExtensionData.VTDType != null)
            {
                tc.classname = activityReport.ActivityExtensionData.VTDType.Value;
            }
            tc.time = activityReport.DurationSeconds;

            if (activityReport.Status == ReportStatus.Failed)
            {
                testsuiteTestcaseFailure failure = new testsuiteTestcaseFailure();

                if (activityReport.CheckpointData != null && activityReport.CheckpointData.Checkpoints != null)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (ExtData data in activityReport.CheckpointData.Checkpoints)
                    {
                        if (data.KnownVTDStatus == VTDStatus.Failure)
                        {
                            string actualValue   = data.VTDActual != null ? data.VTDActual.Value : string.Empty;
                            string expectedValue = data.VTDExpected != null ? data.VTDExpected.Value : string.Empty;
                            string operation     = data.VTDOperation != null ? data.VTDOperation.Value : string.Empty;
                            if (string.IsNullOrEmpty(actualValue) && string.IsNullOrEmpty(expectedValue) && !string.IsNullOrEmpty(operation))
                            {
                                // sample: [Checkpoint 1] Arguments[1]: Array - Fixed (compound)
                                sb.AppendFormat(Properties.Resources.APITest_Checkpoint_CompoundValue,
                                                data.VTDName != null ? data.VTDName.Value : string.Empty,
                                                data.VTDXPath != null ? data.VTDXPath.Value : string.Empty,
                                                !string.IsNullOrEmpty(operation) ? operation : Properties.Resources.APITest_Checkpoint_NoOperation);
                            }
                            else
                            {
                                // sample: [Checkpoint 2] StatusCode: 404 (actual)  =  200 (expected)
                                sb.AppendFormat(Properties.Resources.APITest_Checkpoint_ActExp,
                                                data.VTDName != null ? data.VTDName.Value : string.Empty,
                                                data.VTDXPath != null ? data.VTDXPath.Value : string.Empty,
                                                !string.IsNullOrEmpty(actualValue) ? actualValue : Properties.Resources.APITest_Checkpoint_EmptyValue,
                                                !string.IsNullOrEmpty(operation) ? operation : Properties.Resources.APITest_Checkpoint_NoOperation,
                                                !string.IsNullOrEmpty(expectedValue) ? expectedValue : Properties.Resources.APITest_Checkpoint_EmptyValue);
                            }
                            sb.AppendLine();
                        }
                    }
                    failure.message = sb.ToString();
                }

                if (string.IsNullOrWhiteSpace(failure.message))
                {
                    failure.message = activityReport.Description;
                }
                failure.type = string.Empty;
                tc.Item      = failure;
            }

            return(tc);
        }
      public HttpResponseMessage activityReportCSV(Guid orgId, Guid projId, Guid? locId) {
        DateTime? startDate = grabStartDate();
        DateTime? endDate = grabEndDate();

        var response = csvStream("activity.csv", new PushStreamContent((stream, Content, context) => {
          var writer = new StreamWriter(stream);
          ActivityReport.buildCSV(writer, orgId, projId, locId, startDate, endDate);
        }));

        return response;
      } // actionRequiredcsv
Пример #7
0
        private void CreateActivityReport(ActivityReport activityReport)
        {
            //List<string> headers = new List<string>();
            //headers.Add(GingerDicser.GetTermResValue(eTermResKey.Activities));
            //headers.Add(nameof(activityReport.ActivityName));
            //headers.Add(nameof(activityReport.RunStatus));
            //headers.Add(nameof(activityReport.ElapsedSecs));

            //XNode m = CreateHTMLTable(ll, headers, BizFlowHTMLColumns);
            //mStringBuilder.Append(m.ToString());
        }
Пример #8
0
        public static bool EqualValues(this ActivityReportDto activityReportDto, ActivityReport activityReport)
        {
            bool equal = activityReportDto.Date == activityReport.Date &&
                         activityReportDto.ID == activityReport.ID &&
                         activityReportDto.UserID == activityReport.UserID &&
                         activityReportDto.Steps == activityReport.Steps &&
                         activityReportDto.Distance == activityReport.Distance &&
                         activityReportDto.Duration == activityReport.Duration;

            return(equal);
        }
Пример #9
0
        public void SaveActivity(Guid reporterId, DateTime activityDate, int minutes, bool ingameActivity, string affectedPeople, string narrative)
        {
            ActivityReport activityReport = new ActivityReport();

            activityReport.ReportUserId = reporterId;
            activityReport.Online       = ingameActivity;
            activityReport.ForDate      = activityDate;
            activityReport.Affected     = affectedPeople;
            activityReport.Minutes      = minutes;
            activityReport.Narrative    = narrative;
            _wrapper.ActivityReportRepository.AddOne <ActivityReport>(activityReport);
        }
Пример #10
0
 public static ActivityReportDto FromActivityReport(ActivityReport ar)
 {
     return(new ActivityReportDto()
     {
         Date = ar.Date,
         Distance = ar.Distance,
         Duration = ar.Duration,
         ID = ar.ID,
         Steps = ar.Steps,
         UserID = ar.UserID
     });
 }
Пример #11
0
        private void _UpdateActivityReport(Activity activity, String uid)
        {
            ActivityReport r = new ActivityReport()
            {
                Date     = activity.StartDate,
                Distance = activity.Distance,
                Duration = activity.Duration,
                Steps    = activity.Steps,
                UserID   = uid,
            };

            _arAcc.AddOrUpdate(r);
        }
Пример #12
0
 public void SetReportData(ActivityReport activityReport)
 {
     Seq                 = activityReport.Seq;
     GUID                = Guid.Parse(activityReport.GUID);
     Name                = activityReport.ActivityName;
     Description         = activityReport.Description;
     RunDescription      = activityReport.RunDescription;
     StartTimeStamp      = activityReport.StartTimeStamp;
     EndTimeStamp        = activityReport.EndTimeStamp;
     Elapsed             = activityReport.Elapsed;
     RunStatus           = activityReport.RunStatus;
     VariablesAfterExec  = activityReport.VariablesAfterExec;
     VariablesBeforeExec = activityReport.VariablesBeforeExec;
 }
Пример #13
0
        public void ActivityReportTest()
        {
            string ActivityReportFile = GingerTestHelper.TestResources.GetTestResourcesFile(@"Reports\Activity.txt");

            try
            {
                ActivityReport AR = (ActivityReport)JsonLib.LoadObjFromJSonFile(ActivityReportFile, typeof(ActivityReport));
                Assert.AreEqual("Passed", AR.RunStatus);
                Assert.AreEqual(2044, AR.Elapsed);
            }

            catch (Exception Ex)
            {
                Assert.Fail(Ex.Message);
            }
        }
Пример #14
0
        private void CreateTaskReport()
        {
            TaskReport = new List <RITask>();

            var tasks = ActivityReport.GroupBy(x => new
            {
                x.TaskId,
                x.TaskName,
                x.AssigndTo,
                x.Position,
                x.StartDate,
                x.FinishDate,
                x.ServiceName,
                x.Technology,
                x.TaskState,
                x.OriginalEstimate,
                x.Company,
                x.WorkType,
                x.AreaPath,
                x.Month,
                x.ProjectOnlineName
            });

            foreach (var task in tasks)
            {
                var item = new RITask();

                item.TaskId            = task.Key.TaskId;
                item.TaskName          = task.Key.TaskName;
                item.AssigndTo         = task.Key.AssigndTo;
                item.Position          = task.Key.Position;
                item.StartDate         = task.Key.StartDate;
                item.FinishDate        = task.Key.FinishDate;
                item.ServiceName       = task.Key.ServiceName;
                item.Technology        = task.Key.Technology;
                item.CompletedWork     = task.Sum(x => x.CompletedWork);
                item.TaskState         = task.Key.TaskState;
                item.WorkType          = task.Key.WorkType;
                item.AreaPath          = task.Key.AreaPath;
                item.Month             = task.Key.Month;
                item.Company           = task.Key.Company;
                item.OriginalEstimate  = task.Key.OriginalEstimate;
                item.ProjectOnlineName = task.Key.ProjectOnlineName;

                TaskReport.Add(item);
            }
        }
Пример #15
0
        public override object SetReportActivity(Activity activity, Context context, bool offlineMode, bool isConfEnable)
        {
            ActivityReport AR = GetActivityReportData(activity, context, offlineMode);

            if (isConfEnable)
            {
                if (offlineMode)
                {
                    SaveObjToReporsitory(AR, Path.Combine(activity.ExecutionLogFolder, "Activity.txt"));
                }
                else
                {
                    SaveObjToReporsitory(AR, Path.Combine(ExecutionLogfolder, activity.ExecutionLogFolder, "Activity.txt"));
                }
            }
            return(AR);
        }
Пример #16
0
        internal ActivityReport GetActivityReportData(Activity activity, Context context, bool offlineMode)
        {
            ActivityReport AR = new ActivityReport(activity);

            AR.Seq = context.BusinessFlow.ExecutionLogActivityCounter;
            AR.VariablesBeforeExec = activity.VariablesBeforeExec;

            if ((activity.RunDescription != null) && (activity.RunDescription != string.Empty))
            {
                if (mVE == null)
                {
                    mVE = new GingerCore.ValueExpression(context.Environment, null, new ObservableList <GingerCore.DataSource.DataSourceBase>(), false, "", false);
                }
                mVE.Value         = activity.RunDescription;
                AR.RunDescription = mVE.ValueCalculated;
            }
            return(AR);
        }
Пример #17
0
        public string SerializeReport(ActivityReport report)
        {
            if (report == null)
            {
                throw new ArgumentNullException(nameof(report));
            }

            var reportDirectoryPath = Path.Combine(ReportsPath, report.ReportDate.Year.ToString(), report.ReportDate.Month.ToString());

            if (!Directory.Exists(reportDirectoryPath))
            {
                Directory.CreateDirectory(reportDirectoryPath);
            }

            var reportPath = Path.Combine(reportDirectoryPath, report.ReportDate.ToString("yyyy-MM-dd") + ".xlsx");

            using (var stream = new FileStream(reportPath, FileMode.Create, FileAccess.Write))
            {
                var wb            = new XSSFWorkbook();
                var timeCellStyle = CreateTimeCellStyle(wb);
                var boldCellStyle = CreateBoldStyle(wb);

                var sheet = wb.CreateSheet(Texts.WorkActivity);
                CreateHeader(sheet, boldCellStyle);

                var i = 1;
                foreach (var item in report.Items)
                {
                    CreateRow(report, sheet, i++, item, timeCellStyle);
                }

                CreateSummary(report, sheet, i, boldCellStyle);

                wb.Write(stream);
            }

            return(reportPath);
        }
Пример #18
0
        private static void CreateSummary([NotNull] ActivityReport report, [NotNull] ISheet sheet, int i, [NotNull] ICellStyle boldCellStyle)
        {
            var row  = sheet.CreateRow(i + 1);
            var cell = row.CreateCell(0);

            cell.SetCellValue(Texts.TotalWorking);
            cell.CellStyle = boldCellStyle;

            cell = row.CreateCell(1);
            cell.SetCellValue(report.TotalWorkingTime.ToPrettyFormat());
            cell.CellStyle = boldCellStyle;
            AutoSizeRow(row, sheet);

            row  = sheet.CreateRow(i + 2);
            cell = row.CreateCell(0);
            cell.SetCellValue(Texts.TotalLeisure);
            cell.CellStyle = boldCellStyle;

            cell = row.CreateCell(1);
            cell.SetCellValue(report.TotalLeisureTime.ToPrettyFormat());
            cell.CellStyle = boldCellStyle;
            AutoSizeRow(row, sheet);
        }
Пример #19
0
        public override void ActivityEnd(uint eventTime, Activity activity, bool offlineMode = false)
        {
            ActivityReport activityReport = new ActivityReport(activity);

            SaveObjToJSonFile(activityReport, Path.Combine(mDumpFolder, CurrentActivityFolder, "ActivityReport.txt"));
        }
Пример #20
0
 public void Initialize()
 {
     _sampleActivityReport1 = ActivityReportGenerator.GenerateActivityReport1();
     _sampleActivityReport2 = ActivityReportGenerator.GenerateActivityReport2();
     _manyActivityReports   = ActivityReportGenerator.GenerateManyActivityReports();
 }