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; } }