示例#1
0
        /// <summary>
        /// This constructor creates an initial RGReport based on an existing fpTemplate. It does not check whether
        /// an existing RG Report exists, so make sure of that before calling this method
        /// </summary>
        /// <param name="fpTemplate"></param>
        /// <param name="ctx">Database Context with reference which to create the object</param>
        public RGReport(FixedPatternTemplate fpTemplate, string RTNo, string ReportNo, RadiographyContext ctx)
        {
            //shallow copy properties
            fpTemplate.CopyTo(this, "ID");
            this.DateOfTest = this.ReportDate = DateTime.Now;
            this.Shift      = Shift.getShift("DAY", ctx); //defaulting so it can be saved
            this.Status     = RGStatus.getStatus("PENDING", ctx);
            this.RTNo       = RTNo;
            this.ReportNo   = ReportNo;

            RGReportRowType freshRowType = RGReportRowType.getRowType("FRESH", ctx);

            if (fpTemplate.FPTemplateRows == null)
            {
                return;
            }

            this.RGReportRows = new List <RGReportRow>();

            //some default values as suggested by Shankaran (10-Apr-2012)
            this.Film            = "AGFA D7";
            this.LeadScreen      = "0.125mm/0.25mm"; //Default for Leadscreen changed as per requirements shared on 30-Jun-12.
            this.ReportTypeAndNo = this.ReportType = "Fresh";
            this.ReshootNo       = 0;                //explicitly setting this, even though this is the default value

            //since this is the first report for this FP and RT No
            this.First       = true;
            this.RowsDeleted = false;

            foreach (var row in fpTemplate.FPTemplateRows.OrderBy(p => p.SlNo))
            {
                var rgReportRow = new RGReportRow
                {
                    RowType      = freshRowType,
                    Energy       = Energy.getEnergyForThickness(row.Thickness, ctx),
                    Observations = " ",                       //for grid to work fine
                    FilmCount    = 1                          // default for the new film count
                };
                row.CopyTo(rgReportRow, "ID,FilmSizeString");

                //for future reports, so that ordering can be done on this basis
                rgReportRow.FPSLNo = row.SlNo;

                this.RGReportRows.Add(rgReportRow);
            }
        }
 private bool FilterStatus(RGStatus entity)
 {
     return (entity.ID == this.StatusID);
 }