예제 #1
0
        public static Data.Model.Report CopyLatestReport(Data.Model.Report latestReport, ReportBL.Status defaultStatus = Status.InProgress)
        {
            Data.Model.Report report = new Data.Model.Report()
            {
                idReport = Business.Utility.GuidHelper.GenerateGuid(),
                idCustomerProspect = latestReport.idCustomerProspect,
                DateCreated = DateTime.Now,
                DateUpdated = DateTime.Now, //needed in orderbydescending dateupdated (case get latest report) ?
                IsOriginal = true,
                Status = defaultStatus.ToString(),
            };

            try
            {
                //Create report
                report = ReportBL.CreateReport(report);

                //Copy values : get latest and copy them to new report
                List<ReportOptionValue> reportOptionValues = ReportOptionBL.GetOptionValuesByIdReport(latestReport.idReport);
                ReportOptionBL.SaveReportOptionValues(report, reportOptionValues);
            }
            catch (Exception ex)
            {
                Business.Log.Log.AppendException(ex);
            }

            return report;
        }
예제 #2
0
        public static Data.Model.Report CreateEmptyReport(Guid idCustomer, ReportBL.Status defaultStatus = Status.InProgress)
        {
            var report = new Data.Model.Report()
            {
                idReport = Business.Utility.GuidHelper.GenerateGuid(),
                idCustomerProspect = idCustomer,
                DateCreated = DateTime.Now,
                DateUpdated = DateTime.Now, //needed in orderbydescending dateupdated (case get latest report) ?
                IsOriginal = true,
                Status = defaultStatus.ToString(),
            };
            report = ReportBL.CreateReport(report);

            return report;
        }