public void UpdateSourceBasedOnThickness()
 {
     if (RGReport != null && (RGReport.ReshootNo < 1 || chkIsInchCms.IsChecked == true) && RGReportRows != null)
     {
         if (RGReportRows.Select(o => o.EnergyID).Distinct().Count() == 1)
         {
             RGReportRow RGReportRow = RGReportRows.FirstOrDefault();
             if (RGReportRow.EnergyID == 1)
             {
                 this.txtSource.Text     = "Co 60";
                 this.txtSourceSize.Text = "4.1 mm(Effective size)";
             }
             else
             {
                 this.txtSource.Text     = "Ir 192";
                 this.txtSourceSize.Text = "3.6 mm(Effective size)";
             }
         }
         else
         {
             this.txtSource.Text     = "Co 60/Ir 192";
             this.txtSourceSize.Text = "4.1 mm(Effective size)/3.6 mm(Effective size)";
         }
     }
 }
        public void CopyOperation(object sender, RoutedEventArgs e)
        {
            RGReportRowForCopying = new RGReportRow();
            DataGridRow row = DataGridRow.GetRowContainingElement(sender as FrameworkElement);

            RGReportRowForCopying = (RGReportRow)row.DataContext;
        }
        public override void AddOperation(object sender, RoutedEventArgs e)
        {
            //also give a few default empty string values so that UI copy operation is possible
            var rgReportRow = new RGReportRow
            {
                RGReport = this.RGReport,
                //auto increment sl no for each additional row
                SlNo             = RGReportRows.Max(p => p.SlNo) + 1,
                Density          = " ",
                Designation      = " ",
                Location         = " ",
                Segment          = " ",
                Sensitivity      = " ",
                FilmSizeString   = " ",
                RemarkText       = " ",
                TechnicianText   = " ",
                Observations     = " ",
                WelderText       = " ",
                RetakeReasonText = " ",
                FilmCount        = 1, //default value for film counts
                RowType          = ((RadiographyContext)DomainSource.DomainContext)
                                   .RGReportRowTypes
                                   .FirstOrDefault(p => p.Value == "FRESH")
            };

            RGReportRows.Add(rgReportRow);
            OnPropertyChanged("RGReportRows");
        }
        private void btnPaste_Click(object sender, RoutedEventArgs e)
        {
            if (RGReportRowForCopying != null)
            {
                var rgReportRow = new RGReportRow
                {
                    RGReport = this.RGReport,
                    //auto increment sl no for each additional row
                    SlNo             = RGReportRows.Max(p => p.SlNo) + 1,
                    Density          = RGReportRowForCopying.Density,
                    Designation      = RGReportRowForCopying.Designation,
                    Location         = RGReportRowForCopying.Location,
                    Segment          = RGReportRowForCopying.Segment,
                    Sensitivity      = RGReportRowForCopying.Sensitivity,
                    FilmSizeString   = RGReportRowForCopying.FilmSizeString,
                    RemarkText       = RGReportRowForCopying.RemarkText,
                    TechnicianText   = RGReportRowForCopying.TechnicianText,
                    Observations     = RGReportRowForCopying.Observations,
                    WelderText       = RGReportRowForCopying.WelderText,
                    RetakeReasonText = RGReportRowForCopying.RetakeReasonText,
                    FilmCount        = RGReportRowForCopying.FilmCount, //default value for film counts
                    RowType          = ((RadiographyContext)DomainSource.DomainContext)
                                       .RGReportRowTypes
                                       .FirstOrDefault(p => p.Value == "FRESH"),
                    Energy           = RGReportRowForCopying.Energy,
                    EnergyText       = RGReportRowForCopying.EnergyText,
                    FilmSize         = RGReportRowForCopying.FilmSize,
                    Technique        = RGReportRowForCopying.Technique,
                    Remark           = RGReportRowForCopying.Remark,
                    RetakeReason     = RGReportRowForCopying.RetakeReason,
                    Technician       = RGReportRowForCopying.Technician,
                    Welder           = RGReportRowForCopying.Welder,
                    TechniqueText    = RGReportRowForCopying.TechniqueText,
                    ThicknessRange   = RGReportRowForCopying.ThicknessRange,
                    ThicknessRangeUI = RGReportRowForCopying.ThicknessRangeUI,
                    SFD = RGReportRowForCopying.SFD
                };

                RGReportRows.Add(rgReportRow);
                OnPropertyChanged("RGReportRows");
            }
            else
            {
                MessageBox.Show("Please copy any one row to paste!!");
                return;
            }
        }