示例#1
0
        public void SaveReport(PartReport i_PartReport)
        {
            var dbPartReport = new DbPartReport();

            if (i_PartReport.Id == -1)
            {
                dbPartReport.InsertPartReport(i_PartReport);
            }
            else
            {
                dbPartReport.UpdatePartReport(i_PartReport);
            }


            var dbDimension = new DbDimension();

            foreach (var dimension in i_PartReport.Dimensions)
            {
                dimension.PartReport = i_PartReport;
                if (dimension.Id == -1)
                {
                    dbDimension.InsertDimension(dimension);
                }
                else
                {
                    dbDimension.UpdateDimension(dimension);
                }
            }
        }
示例#2
0
        public List <PartReport> GetPartReports(Task i_Task)
        {
            var dbPartReport = new DbPartReport();
            var result       = dbPartReport.GetPartReports(i_Task);

            foreach (var partReport in result)
            {
                partReport.Task = i_Task;
            }
            return(result);
        }
示例#3
0
        public List <PartReport> GetPartReports()
        {
            var dbPartReport = new DbPartReport();
            var result       = dbPartReport.GetPartReports();
            var dbTask       = new DbTask();

            foreach (var partReport in result)
            {
                partReport.Task = dbTask.GetTask(partReport.Task);
            }
            return(result);
        }
示例#4
0
        public void InsertGetUpdate()
        {
            DbPartReport target = new DbPartReport();
            PartReport   report = new PartReport()
            {
                Task = new Task()
                {
                    Id = 0
                },
                Operator = "tester", OperatorComment = "TestComment", MeasurementDatetime = new DateTime(2014, 10, 10),
                Auditor  = "Auditor", AuditComment = "Audit comment", AuditDatetime = new DateTime(2014, 10, 10),
                Approver = "Approver", ApproveComment = "Approve comment", ApproveDatetime = new DateTime(2014, 10, 10)
            };

            target.InsertPartReport(report);

            var insertedTask = target.GetPartReports(report.Task);

            Assert.AreEqual(report.Id, insertedTask.Id);
            report.Task.Id = 2;
            target.UpdatePartReport(report);

            Assert.AreEqual(report.Task.Id, 2);
        }