コード例 #1
0
        public void PrintOperation(object sender, RoutedEventArgs e)
        {
            DataGridRow row    = DataGridRow.GetRowContainingElement(sender as FrameworkElement);
            RGReport    report = (RGReport)row.DataContext;

            CheckBox cmb = null;

            if (WebContext.Current.User.Roles.FirstOrDefault() == "Customer")
            {
                cmb = this.RGDataGridCustomer.Columns[7].GetCellContent(row) as CheckBox;
            }
            else
            {
                cmb = this.RGDataGrid.Columns[9].GetCellContent(row) as CheckBox;
            }

            //Get the root path for the XAP
            string src = Application.Current.Host.Source.ToString();

            //Get the application root, where 'ClientBin' is the known dir where the XAP is
            string appRoot = src.Substring(0, src.IndexOf("ClientBin"));

            //Uri reportURI = new Uri(string.Format(appRoot + "RGReportGenerate.aspx?ReportNo={0}", report.ReportNo), UriKind.Absolute);
            Debug.Assert(report != null, "report != null");
            Uri reportURI = new Uri(string.Format(appRoot + "RGReportGenerate.aspx?ReportId={0}&" + "ReportNo={1}&FilmSize={2}", report.ID, report.ReportNo, cmb.IsChecked), UriKind.Absolute);

            HtmlPage.Window.Navigate(reportURI, "_blank");
        }
コード例 #2
0
        public override void domainDataSource_LoadedData(object sender, LoadedDataEventArgs e)
        {
            base.domainDataSource_LoadedData(sender, e);
            //first item returned is the latest RG Report for the combination of inputs
            if (((DomainDataSourceView)((DomainDataSource)sender).Data).IsEmpty)
            {
                MessageBox.Show("Wrong Inputs Or RT No Already Completed\n\nCheck and try again");
                return;
            }

            RGReport     = (RGReport)((DomainDataSourceView)((DomainDataSource)sender).Data).GetItemAt(0);
            RGReportRows = RGReport.RGReportRows;

            //now that fixedpatternid is available
            FixedPatternsSource.Load();
            UpdateEnergyWiseArea();
            OnPropertyChanged("TotalArea");
            SetViewing();

            //if edit mode, add a clone of original RGReport to original entities for change tracking
            if (IsEditMode)
            {
                OriginalEntities.Add(RGReport.ID, RGReport.Clone(ExcludePropertiesFromTracking));
            }
        }
コード例 #3
0
        public void ExcelExportOperation(object sender, RoutedEventArgs e)
        {
            DataGridRow row    = DataGridRow.GetRowContainingElement(sender as FrameworkElement);
            RGReport    report = (RGReport)row.DataContext;

            ctx = (RadiographyContext)RGDomainDataSource.DomainContext;
            busyIndicator.IsBusy = true;
            this.ctx.Load(this.ctx.GetRGReportsQuery(report.ReportNo)).Completed += loadCompleted;;
        }
コード例 #4
0
        public void PrintOperation(object sender, RoutedEventArgs e)
        {
            DataGridRow row    = DataGridRow.GetRowContainingElement(sender as FrameworkElement);
            RGReport    report = (RGReport)row.DataContext;

            //Get the root path for the XAP
            string src = Application.Current.Host.Source.ToString();

            //Get the application root, where 'ClientBin' is the known dir where the XAP is
            string appRoot = src.Substring(0, src.IndexOf("ClientBin"));

            Uri reportURI = new Uri(string.Format(appRoot + "RGReportGenerate.aspx?ReportNo={0}", report.ReportNo), UriKind.Absolute);

            HtmlPage.Window.Navigate(reportURI, "_blank");
        }
コード例 #5
0
        //Kept here only for the template column to work fine
        public override void DeleteOperation(object sender, RoutedEventArgs e)
        {
            if (WebContext.Current.User.Roles.FirstOrDefault() == "Customer")
            {
                return;
            }

            DataGridRow row    = DataGridRow.GetRowContainingElement(sender as FrameworkElement);
            RGReport    report = (RGReport)row.DataContext;

            if (!report.CanDelete)
            {
                MessageBox.Show("Can Delete only latest report for any RT");
                return;
            }

            base.DeleteOperation(sender, e);
            //save this, since there is no separate save button
            this.SaveOperation(sender, e);
        }
コード例 #6
0
        //Added by praveen to fix date issue that was causing.(Requirement:3rd july, 2014)
        protected void UpdateReportDate()
        {
            var    ctx       = (RadiographyContext)this.DomainSource.DomainContext;
            int    reShootNo = RGReport.ReshootNo - 1;
            String rTNo      = RGReport.RTNo;

            if (RGReport.ReshootNo > 0)
            {
                ctx.Load(ctx.GetRGReportsOnRtNoAndReshootNoQuery(rTNo, reShootNo));
                RGReport rGReport = ctx.RGReports.Where(p => p.ReshootNo == reShootNo &&
                                                        p.RTNo == rTNo).FirstOrDefault();

                if (RGReport != null && rGReport != null)
                {
                    if (rGReport.ReportDate.ToString("dd-MM-yyyy") == Convert.ToDateTime(ReportDatePicker.Text).ToString("dd-MM-yyyy"))
                    {
                        RGReport.ReportDate = rGReport.ReportDate.AddMinutes(1);
                    }
                }
            }
        }
コード例 #7
0
        public void ExcelExportOperation(object sender, RoutedEventArgs e)
        {
            DataGridRow row    = DataGridRow.GetRowContainingElement(sender as FrameworkElement);
            RGReport    report = (RGReport)row.DataContext;

            CheckBox cmb = null;

            if (WebContext.Current.User.Roles.FirstOrDefault() == "Customer")
            {
                cmb = this.RGDataGridCustomer.Columns[7].GetCellContent(row) as CheckBox;
            }
            else
            {
                cmb = this.RGDataGrid.Columns[9].GetCellContent(row) as CheckBox;
            }

            ctx = (RadiographyContext)RGDomainDataSource.DomainContext;
            busyIndicator.IsBusy = true;
            IsFilmSizeInCms      = cmb.IsChecked.Value;
            this.ctx.Load(this.ctx.GetRGReportsQuery(report.ID)).Completed += loadCompleted;
        }
コード例 #8
0
        public override void domainDataSource_LoadedData(object sender, LoadedDataEventArgs e)
        {
            base.domainDataSource_LoadedData(sender, e);
            //first item returned is the latest RG Report for the combination of inputs
            if (((DomainDataSourceView)((DomainDataSource)sender).Data).IsEmpty)
            {
                MessageBox.Show("Wrong Inputs Or RT No Already Completed\n\nCheck and try again");
                return;
            }

            RGReport     = (RGReport)((DomainDataSourceView)((DomainDataSource)sender).Data).GetItemAt(0);
            RGReportRows = RGReport.RGReportRows;
            //now that fixedpatternid is available
            FixedPatternsSource.Load();

            UpdateEnergyWiseArea();
            OnPropertyChanged("TotalArea");
            SetViewing();
            UpdatedStatus();
            if (isFromFetchMethod)
            {
                var      ctx      = (RadiographyContext)this.DomainSource.DomainContext;
                Coverage coverage = (Coverage)cmbCoverage.SelectedItem;
                ctx.Load(ctx.GetFixedPatternDetailsQuery(txtFPNo.Text, coverage.CoverageName, txtRTNo.Text));

                UpdateSourceBasedOnThickness();
                RGReport.FixedPattern = ctx.FixedPatterns.FirstOrDefault();
            }
            isFromFetchMethod = false;
            //if edit mode, add a clone of original RGReport to original entities for change tracking
            if (IsEditMode)
            {
                OriginalEntities.Add(RGReport.ID, RGReport.Clone(ExcludePropertiesFromTracking));
            }
            //ProcedureReference();
            BindToPage(cmbProcedureRef, ComboBox.SelectedValueProperty, "ProcedureReferences");
            BindToPage(cmbSpecifications, ComboBox.SelectedValueProperty, "Specifications");
            BindToPage(cmbAcceptance, ComboBox.SelectedValueProperty, "AcceptanceAsPers");
        }
コード例 #9
0
        void FilmConsumptionReport_Completed(object sender, EventArgs e)
        {
            int foundryId = cmbFoundry.SelectedIndex == -1 ? -1 : ((Foundry)cmbFoundry.SelectedItem).ID;

            List <FilmConsumptionReportRow> FilmConsumptionReportRowList = new List <FilmConsumptionReportRow>();


            EntityQuery <FilmConsumptionReportRow> query = ctx.GetCastingHandledReportQuery(foundryId, (DateTime)fromDatePicker.SelectedDate,
                                                                                            (DateTime)toDatePicker.SelectedDate);

            LoadOperation <FilmConsumptionReportRow> loadOp = ctx.Load(query, loadOpN =>
            {
                foreach (var filmConsumptionReportRow in loadOpN.Entities)
                {
                    FilmConsumptionReportRowList.Add(filmConsumptionReportRow);
                }
                if (FilmConsumptionReportRowList.Count > 0)
                {
                    reportTable = new DataTable("Report");
                    var cols    = reportTable.Columns;
                    var rows    = reportTable.Rows;

                    var headerRow = new DataRow();
                    rows.Add(headerRow);

                    var subHeaderRow = new DataRow();
                    rows.Add(subHeaderRow);

                    AddTextColumn(reportTable, "ReportNo", "Report No");
                    AddTextColumn(reportTable, "ReportDate", "Report Date");
                    AddTextColumn(reportTable, "DateOfTest", "Date of Test");
                    AddTextColumn(reportTable, "RTNo", "RT No");

                    headerRow["ReportNo"]   = "Report No";
                    headerRow["ReportDate"] = "Report Date";
                    headerRow["DateOfTest"] = "Date of Test";
                    headerRow["RTNo"]       = "RT No";

                    subHeaderRow["ReportNo"]   = "";
                    subHeaderRow["ReportDate"] = "";
                    subHeaderRow["DateOfTest"] = "";
                    subHeaderRow["RTNo"]       = "";

                    int highestNoOfRepair = FilmConsumptionReportRowList.Select(p => p.ReshootNo).Max();

                    int rowIndexForFresh = 0;
                    foreach (var row in ctx.Energies)
                    {
                        var colName        = "Fresh" + row.Name;
                        headerRow[colName] = rowIndexForFresh == 0 ? "Fresh " : string.Empty;
                        AddTextColumn(reportTable, colName, colName);
                        subHeaderRow[colName] = row.Name;
                        rowIndexForFresh++;
                    }

                    //Repair columns
                    for (int i = 0; i < highestNoOfRepair; i++)
                    {
                        int rowIndex = 0;
                        foreach (var row in ctx.Energies)
                        {
                            var colName = "Repair" + (i + 1) + row.Name;
                            AddTextColumn(reportTable, colName, colName);
                            headerRow[colName]    = rowIndex == 0 ? "Repair " + (i + 1) : string.Empty;
                            subHeaderRow[colName] = row.Name;
                            rowIndex++;
                        }
                    }

                    //Reshoot columns
                    for (int i = 0; i < highestNoOfRepair; i++)
                    {
                        int rowIndex = 0;
                        foreach (var row in ctx.Energies)
                        {
                            var colName = "Reshoot" + (i + 1) + row.Name;
                            AddTextColumn(reportTable, colName, colName);
                            headerRow[colName]    = rowIndex == 0 ? "Reshoot " + (i + 1) : string.Empty;
                            subHeaderRow[colName] = row.Name;
                            rowIndex++;
                        }
                    }

                    //Retake columns
                    for (int i = 0; i < highestNoOfRepair; i++)
                    {
                        int rowIndex = 0;
                        foreach (var row in ctx.Energies)
                        {
                            var colName = "Retake" + (i + 1) + row.Name;
                            AddTextColumn(reportTable, colName, colName);
                            headerRow[colName]    = rowIndex == 0 ? "Retake " + (i + 1) : string.Empty;
                            subHeaderRow[colName] = row.Name;
                            rowIndex++;
                        }
                    }

                    //Retake columns
                    for (int i = 0; i < highestNoOfRepair; i++)
                    {
                        int rowIndex = 0;
                        foreach (var row in ctx.Energies)
                        {
                            var colName = "Checkshot" + (i + 1) + row.Name;
                            AddTextColumn(reportTable, colName, colName);
                            headerRow[colName]    = rowIndex == 0 ? "Checkshot " + (i + 1) : string.Empty;
                            subHeaderRow[colName] = row.Name;
                            rowIndex++;
                        }
                    }
                    int countForInnerLoop        = 0;
                    int noOfInnerLoops           = FilmConsumptionReportRowList.Where(p => p.ReshootNo != 0).Count();
                    List <RGReport> rgReportList = new List <RGReport>();

                    foreach (var filmConsumptionReportRow in FilmConsumptionReportRowList)
                    {
                        if (filmConsumptionReportRow.ReshootNo == 0)
                        {
                        }
                        else
                        {
                            EntityQuery <RGReport> queryInner = ctx.GetRGReportsOnRtNoAndReshootNoForReportQuery(filmConsumptionReportRow.RTNo,
                                                                                                                 (filmConsumptionReportRow.ReshootNo - 1));

                            LoadOperation <RGReport> loadOpInner = ctx.Load(queryInner, loadOpNInner =>
                            {
                                countForInnerLoop++;
                                foreach (var rgReport in loadOpNInner.Entities)
                                {
                                    rgReportList.Add(rgReport);
                                }

                                if (noOfInnerLoops == countForInnerLoop)
                                {
                                    foreach (var filmConsumptionReportRowInner in FilmConsumptionReportRowList)
                                    {
                                        string prevReportNo = "";
                                        DataRow dataRow     = null;
                                        string prevEnergy   = String.Empty;
                                        if (filmConsumptionReportRowInner.ReportNo != prevReportNo)
                                        {
                                            if (filmConsumptionReportRowInner.ReshootNo == 0)
                                            {
                                                dataRow                = new DataRow();
                                                dataRow["ReportNo"]    = prevReportNo = filmConsumptionReportRowInner.ReportNo; //set prevReportNo for next time
                                                dataRow["ReportDate"]  = filmConsumptionReportRowInner.Date;
                                                dataRow["DateOfTest"]  = filmConsumptionReportRowInner.DateOfTest;
                                                dataRow["RTNo"]        = filmConsumptionReportRowInner.RTNo;
                                                dataRow["FreshCo 60"]  = filmConsumptionReportRowInner.AreaInCo;
                                                dataRow["FreshIr 192"] = filmConsumptionReportRowInner.AreaInIr;
                                                rows.Add(dataRow);
                                            }
                                            else
                                            {
                                                RGReport rgReport = rgReportList.Where(p => p.RTNo == filmConsumptionReportRowInner.RTNo &&
                                                                                       p.ReshootNo == (filmConsumptionReportRowInner.ReshootNo - 1)).FirstOrDefault();
                                                float repairAreaCo    = 0;
                                                float reshootAreaCo   = 0;
                                                float retakeAreaCo    = 0;
                                                float checkshotAreaCo = 0;
                                                float repairAreaIr    = 0;
                                                float reshootAreaIr   = 0;
                                                float retakeAreaIr    = 0;
                                                float checkshotAreaIr = 0;

                                                if (rgReport != null)
                                                {
                                                    foreach (RGReportRow reportRow in rgReport.RGReportRows)
                                                    {
                                                        if (reportRow.RemarkID == 1)
                                                        {
                                                            if (reportRow.EnergyID == 1)
                                                            {
                                                                repairAreaCo += reportRow.FilmSize.Area * reportRow.FilmCount;
                                                            }
                                                            else
                                                            {
                                                                repairAreaIr += reportRow.FilmSize.Area * reportRow.FilmCount;
                                                            }
                                                        }
                                                        else if (reportRow.RemarkID == 3)
                                                        {
                                                            if (reportRow.EnergyID == 1)
                                                            {
                                                                reshootAreaCo += reportRow.FilmSize.Area * reportRow.FilmCount;
                                                            }
                                                            else
                                                            {
                                                                reshootAreaIr += reportRow.FilmSize.Area * reportRow.FilmCount;
                                                            }
                                                        }
                                                        else if (reportRow.RemarkID == 4)
                                                        {
                                                            if (reportRow.EnergyID == 1)
                                                            {
                                                                retakeAreaCo += reportRow.FilmSize.Area * reportRow.FilmCount;
                                                            }
                                                            else
                                                            {
                                                                retakeAreaIr += reportRow.FilmSize.Area * reportRow.FilmCount;
                                                            }
                                                        }
                                                        else if (reportRow.RemarkID == 5)
                                                        {
                                                            if (reportRow.EnergyID == 1)
                                                            {
                                                                checkshotAreaCo += reportRow.FilmSize.Area * reportRow.FilmCount;
                                                            }
                                                            else
                                                            {
                                                                checkshotAreaIr += reportRow.FilmSize.Area * reportRow.FilmCount;
                                                            }
                                                        }
                                                    }
                                                }

                                                dataRow                = new DataRow();
                                                dataRow["ReportNo"]    = prevReportNo = filmConsumptionReportRowInner.ReportNo; //set prevReportNo for next time
                                                dataRow["ReportDate"]  = filmConsumptionReportRowInner.Date;
                                                dataRow["DateOfTest"]  = filmConsumptionReportRowInner.DateOfTest;
                                                dataRow["RTNo"]        = filmConsumptionReportRowInner.RTNo;
                                                dataRow["FreshCo 60"]  = filmConsumptionReportRowInner.AreaInCo;
                                                dataRow["FreshIr 192"] = filmConsumptionReportRowInner.AreaInIr;

                                                foreach (var row in ctx.Energies)
                                                {
                                                    if (row.ID == 1)
                                                    {
                                                        dataRow["Repair" + (filmConsumptionReportRowInner.ReshootNo) + row.Name]    = repairAreaCo;
                                                        dataRow["Reshoot" + (filmConsumptionReportRowInner.ReshootNo) + row.Name]   = reshootAreaCo;
                                                        dataRow["Retake" + (filmConsumptionReportRowInner.ReshootNo) + row.Name]    = retakeAreaCo;
                                                        dataRow["Checkshot" + (filmConsumptionReportRowInner.ReshootNo) + row.Name] = checkshotAreaCo;
                                                    }
                                                    else if (row.ID == 2)
                                                    {
                                                        dataRow["Repair" + (filmConsumptionReportRowInner.ReshootNo) + row.Name]    = repairAreaIr;
                                                        dataRow["Reshoot" + (filmConsumptionReportRowInner.ReshootNo) + row.Name]   = reshootAreaIr;
                                                        dataRow["Retake" + (filmConsumptionReportRowInner.ReshootNo) + row.Name]    = retakeAreaIr;
                                                        dataRow["Checkshot" + (filmConsumptionReportRowInner.ReshootNo) + row.Name] = checkshotAreaIr;
                                                        rows.Add(dataRow);
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    //totals row
                                    var totalRow = new DataRow();

                                    totalRow["FreshCo 60"]  = rows.Select(p => (p["FreshCo 60"] as float?) ?? 0).Sum();
                                    totalRow["FreshIr 192"] = rows.Select(p => (p["FreshIr 192"] as float?) ?? 0).Sum();

                                    //Repair columns
                                    for (int i = 0; i < highestNoOfRepair; i++)
                                    {
                                        int rowIndex = 0;
                                        foreach (var row in ctx.Energies)
                                        {
                                            var colName       = "Repair" + (i + 1) + row.Name;
                                            totalRow[colName] = rows.Select(p => (p[colName] as float?) ?? 0).Sum();
                                            rowIndex++;
                                        }
                                    }

                                    //Reshoot columns
                                    for (int i = 0; i < highestNoOfRepair; i++)
                                    {
                                        int rowIndex = 0;
                                        foreach (var row in ctx.Energies)
                                        {
                                            var colName       = "Reshoot" + (i + 1) + row.Name;
                                            totalRow[colName] = rows.Select(p => (p[colName] as float?) ?? 0).Sum();
                                            rowIndex++;
                                        }
                                    }

                                    //Retake columns
                                    for (int i = 0; i < highestNoOfRepair; i++)
                                    {
                                        int rowIndex = 0;
                                        foreach (var row in ctx.Energies)
                                        {
                                            var colName       = "Retake" + (i + 1) + row.Name;
                                            totalRow[colName] = rows.Select(p => (p[colName] as float?) ?? 0).Sum();
                                            rowIndex++;
                                        }
                                    }

                                    //checkshot columns
                                    for (int i = 0; i < highestNoOfRepair; i++)
                                    {
                                        int rowIndex = 0;
                                        foreach (var row in ctx.Energies)
                                        {
                                            var colName       = "Checkshot" + (i + 1) + row.Name;
                                            totalRow[colName] = rows.Select(p => (p[colName] as float?) ?? 0).Sum();
                                            rowIndex++;
                                        }
                                    }

                                    rows.Add(totalRow);

                                    var ds = new DataSet("ReportDataSet");
                                    ds.Tables.Add(reportTable);

                                    reportGrid.DataSource = ds;
                                    reportGrid.DataMember = "Report";
                                    reportGrid.DataBind();
                                    busyIndicator.IsBusy = false;
                                }
                            }, false);
                        }
                    }

                    if (noOfInnerLoops == 0)
                    {
                        DataRow dataRow = null;
                        foreach (var filmConsumptionReportRowInner in FilmConsumptionReportRowList)
                        {
                            dataRow                = new DataRow();
                            dataRow["ReportNo"]    = filmConsumptionReportRowInner.ReportNo; //set prevReportNo for next time
                            dataRow["ReportDate"]  = filmConsumptionReportRowInner.Date;
                            dataRow["DateOfTest"]  = filmConsumptionReportRowInner.DateOfTest;
                            dataRow["RTNo"]        = filmConsumptionReportRowInner.RTNo;
                            dataRow["FreshCo 60"]  = filmConsumptionReportRowInner.AreaInCo;
                            dataRow["FreshIr 192"] = filmConsumptionReportRowInner.AreaInIr;
                            rows.Add(dataRow);
                        }

                        var totalRow = new DataRow();

                        totalRow["FreshCo 60"]  = rows.Select(p => (p["FreshCo 60"] as float?) ?? 0).Sum();
                        totalRow["FreshIr 192"] = rows.Select(p => (p["FreshIr 192"] as float?) ?? 0).Sum();
                        rows.Add(totalRow);

                        var ds = new DataSet("ReportDataSet");
                        ds.Tables.Add(reportTable);

                        reportGrid.DataSource = ds;
                        reportGrid.DataMember = "Report";
                        reportGrid.DataBind();
                        busyIndicator.IsBusy = false;
                    }
                }

                else
                {
                    var ds      = new DataSet("ReportDataSet");
                    reportTable = new DataTable("Report");
                    ds.Tables.Add(reportTable);

                    reportGrid.DataSource = ds;
                    reportGrid.DataMember = "Report";
                    reportGrid.DataBind();
                    MessageBox.Show("No records found!!");
                    busyIndicator.IsBusy = false;
                    return;
                }
            }, false);
        }
コード例 #10
0
        public override void SaveOperation(object sender, RoutedEventArgs e)
        {
            //validations on each row
            foreach (var row in RGReportRows)
            {
                row.ThicknessRangeUI = row.ThicknessRange;
                row.TechnicianText   = row.Technique;
                //sl no should be unique
                var duplicateRow = RGReportRows.FirstOrDefault(p => p.SlNo == row.SlNo && p != row);
                if (duplicateRow != null)
                {
                    MessageBox.Show(string.Format("Sl no {0} has been repeated twice, Correct this before saving",
                                                  row.SlNo));
                    return;
                }

                //Location + segment uniqueness validation validation
                var conflictingRow =
                    RGReportRows.FirstOrDefault(
                        p => p.SlNo != row.SlNo && p.Location == row.Location && p.Segment == row.Segment);
                if (conflictingRow != null)
                {
                    MessageBox.Show(
                        string.Format(
                            "Rows with Sl No {0} and {1} have the same location and segments. Correct this before saving",
                            row.SlNo, conflictingRow.SlNo));
                    return;
                }
            }

            //set the viewing
            SetViewing();

            /** FOR SIMPLICITY OF DESIGN, SERVER DEPENDS ON THE CLIENT TO SET THE STATUS. THIS IS IMPORTANT! WITHOUT THIS THE LOGIC WILL FAIL **/

            MessageBoxResult result;

            if (RGReportRows.Any(p => p.RemarkText.Trim() == String.Empty))
            {
                result = MessageBox.Show("Save Incomplete Report. Fetching this RT No will fetch Same Report again",
                                         "Confirm Save", MessageBoxButton.OKCancel);
            }
            //for the first report, deleted rows do not affect status of the casting but for later reports if even a single row
            // is deleted, then the report can never be the final report (hence the casting will remain in pending state)
            else if (RGReportRows.Any(p => p.RemarkText.ToUpper() != "ACCEPTABLE") ||
                     ((!RGReport.First) && RGReport.RowsDeleted))
            {
                result =
                    MessageBox.Show(
                        "Mark Casting as Pending. At least one report is needed after this for this RT No",
                        "Confirm Save", MessageBoxButton.OKCancel);

                if (result != MessageBoxResult.Cancel)
                {
                    RGReport.Status =
                        ((RadiographyContext)DomainSource.DomainContext).RGStatus.FirstOrDefault(
                            p => p.Status == "CASTING UNDER REPAIR");
                }
            }
            else
            {
                result = MessageBox.Show("Mark Casting as complete. This will be Last Report for this RT No.",
                                         "Confirm Save", MessageBoxButton.OKCancel);

                if (result != MessageBoxResult.Cancel)
                {
                    RGReport.Status =
                        ((RadiographyContext)DomainSource.DomainContext).RGStatus.FirstOrDefault(
                            p => p.Status == "COMPLETE");
                }
            }

            //allow cancel
            if (result == MessageBoxResult.Cancel)
            {
                return;
            }
            UpdateReportDate();
            base.SaveOperation(sender, e);

            //update the energy grid
            UpdateEnergyWiseArea();

            //clear and repopulate the original entities collection
            OriginalEntities.Clear();
            OriginalEntities.Add(RGReport.ID, RGReport.Clone(ExcludePropertiesFromTracking));
        }