private static ReportData ImportJson (ReportData data, ReportJson json)
        {
            data.TotalGrand = json.TotalGrand;
            data.TotalBillable = json.TotalBillable;
            data.Activity = MakeActivityList (json.ActivityContainer);
            data.Projects = MakeProjectList (json.Projects);
            data.TotalCost = new List<string> ();

            if (json.TotalCurrencies != null) {
                json.TotalCurrencies.Sort ((x, y) => y.Amount.CompareTo (x.Amount));
                foreach (var row in json.TotalCurrencies) {
                    data.TotalCost.Add (String.Format ("{0} {1}", row.Amount, row.Currency));
                }
            }
            return data;
        }
        private static ReportData ImportJson(ReportData data, ReportJson json)
        {
            data.TotalGrand    = json.TotalGrand;
            data.TotalBillable = json.TotalBillable;
            data.Activity      = MakeActivityList(json.ActivityContainer);
            data.Projects      = MakeProjectList(json.Projects);
            data.TotalCost     = new List <string> ();

            if (json.TotalCurrencies != null)
            {
                json.TotalCurrencies.Sort((x, y) => y.Amount.CompareTo(x.Amount));
                foreach (var row in json.TotalCurrencies)
                {
                    data.TotalCost.Add(String.Format("{0} {1}", row.Amount, row.Currency));
                }
            }
            return(data);
        }
Esempio n. 3
0
        public IHttpActionResult Add([FromBody] ReportJson reportJson)
        {
            var result = new ResultMessage <TblReportDataDto>();

            try
            {
                var reportDataDto = new TblReportDataDto
                {
                    TestQueueId    = reportJson.TestQueueId,
                    ExecutionGroup = reportJson.ExecutionGroup,
                    Value          = JsonConvert.SerializeObject(reportJson)
                };

                result = this.reportDataService.SaveOrUpdate(reportDataDto, this.UserId);
            }
            catch (Exception ex)
            {
                this.LoggerService.LogException(ex);
                result.Messages.Add(new Message(null, ex.Message));
            }

            return(this.CreateCustomResponse(result));
        }
 public ReportData Import(ReportJson json)
 {
     return(ImportJson(new ReportData(), json));
 }
        private async void HandleGenerateJsonReportCommand(object parameter)
        {
            try
            {
                var reporter = new ReportJson();
                var msg = await reporter.GenerateJsonReport();

                MessageBox.Show(msg);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Json report");
            }
        }
 public ReportData Import (ReportJson json)
 {
     return ImportJson (new ReportData (), json);
 }
Esempio n. 7
0
        public static ReportData Import(this ReportJson json)
        {
            var converter = ServiceContainer.Resolve <ReportJsonConverter> ();

            return(converter.Import(json));
        }