private void ReportViewer_Load(object sender, EventArgs e)
        {
            if (!_isReportViewerLoaded)
            {
                var retunbyrow = _mponumner.GetReturnByRowID(clGlobal.NewRGANumber)[0];

                if (retunbyrow.RMANumber == "N/A")
                {
                    forgetdata = new mupdatedForPonumber(retunbyrow.PONumber);

                    Microsoft.Reporting.WinForms.ReportDataSource reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource();
                    //forgetdata._lsReturnDetails1 dataset = new  forgetdata._lsReturnDetails1();


                    // dataset.BeginInit();
                    reportDataSource1.Name = "DataSet1";
                    //Name of the report dataset in our .RDLC file
                    reportDataSource1.Value = forgetdata._lsReturnDetails1;
                    this._reportViewer.LocalReport.DataSources.Add(reportDataSource1);
                    this._reportViewer.LocalReport.ReportPath = "~/KrausRGA/KrausxRGA/UI/MainReport.rdlc";
                    // forgetdata._lsReturnDetails1.EndInit();
                    //fill data into WpfApplication4DataSet
                    //WpfApplication4DataSetTableAdapters.AccountsTableAdapter accountsTableAdapter = new WpfApplication4DataSetTableAdapters.AccountsTableAdapter();

                    //   .ReturnDetailsDTO accountsTableAdapter = new GetRMAServiceRef.ReturnDetailsDTO();

                    //accountsTableAdapter.ClearBeforeFill = true;
                    //accountsTableAdapter.Fill(forgetdata._lsReturnDetails1);
                    _reportViewer.RefreshReport();
                    _isReportViewerLoaded = true;
                }
                else
                {
                    this.Dispatcher.Invoke(new Action(() => { forSRnumber = new mUpdateModeRMA(retunbyrow.RMANumber); }));
                }
            }
        }
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            var retunbyrow = _mponumner.GetReturnByRowID(clGlobal.NewRGANumber)[0];

            if (retunbyrow.RMANumber == "N/A")
            {
                if (retunbyrow.OrderNumber == "N/A")
                {
                    NewRMANumber     = true;
                    forgetdataNewRMA = new mUpdateForNewRMA(retunbyrow.RGAROWID);

                    txtPonumber.Text    = forgetdataNewRMA._ReturnTbl1.PONumber;
                    txtRMA.Text         = forgetdataNewRMA._ReturnTbl1.RMANumber;
                    txtVendorName.Text  = forgetdataNewRMA._ReturnTbl1.VendoeName;
                    txtName.Text        = forgetdataNewRMA._ReturnTbl1.VendoeName;
                    txtAddress.Text     = forgetdataNewRMA._ReturnTbl1.Address1 + " " + forgetdata._ReturnTbl1.Address2 + " " + forgetdata._ReturnTbl1.Address3;
                    txtRequestDate.Text = Convert.ToString(forgetdataNewRMA._ReturnTbl1.CreatedDate);

                    dgPackageInfo.ItemsSource = forgetdataNewRMA._lsReturnDetails1;//.OrderByDescending(q => q.SKU_Sequence);

                    dtLoadUpdate1          = new DispatcherTimer();
                    dtLoadUpdate1.Interval = new TimeSpan(0, 0, 0, 0, 10);
                    dtLoadUpdate1.Tick    += dtLoadUpdate1_Tick;
                    //start the dispacher.
                    dtLoadUpdate1.Start();

                    //   double height = dgPackageInfo.DesiredSize.Height;

                    // Canvas.GetTop(CanvasGrid);

                    //  Canvas.SetTop(CanvasNote,25+ height);

                    _threadPrint.Interval = new TimeSpan(0, 0, 3);
                    _threadPrint.Start();
                    _threadPrint.Tick += _threadPrint_Tick;
                }
                else
                {
                    POnumber   = true;
                    forgetdata = new mupdatedForPonumber(retunbyrow.PONumber);

                    txtPonumber.Text    = forgetdata._ReturnTbl1.PONumber;
                    txtRMA.Text         = forgetdata._ReturnTbl1.RMANumber;
                    txtVendorName.Text  = forgetdata._ReturnTbl1.VendoeName;
                    txtName.Text        = forgetdata._ReturnTbl1.VendoeName;
                    txtAddress.Text     = forgetdata._ReturnTbl1.Address1 + " " + forgetdata._ReturnTbl1.Address2 + " " + forgetdata._ReturnTbl1.Address3;
                    txtRequestDate.Text = Convert.ToString(forgetdata._ReturnTbl1.CreatedDate);

                    dgPackageInfo.ItemsSource = forgetdata._lsReturnDetails1;//.OrderByDescending(q => q.SKU_Sequence);

                    // double height1 = dgPackageInfo.DesiredSize.Height;

                    dtLoadUpdate1          = new DispatcherTimer();
                    dtLoadUpdate1.Interval = new TimeSpan(0, 0, 0, 0, 10);
                    dtLoadUpdate1.Tick    += dtLoadUpdate1_Tick;
                    //start the dispacher.
                    dtLoadUpdate1.Start();

                    //       double height = dgPackageInfo.DesiredSize.Height;

                    // Canvas.GetTop(CanvasGrid);

                    //   Canvas.SetTop(CanvasNote, 25+height);

                    _threadPrint.Interval = new TimeSpan(0, 0, 3);
                    _threadPrint.Start();
                    _threadPrint.Tick += _threadPrint_Tick;
                }
            }
            else
            {
                this.Dispatcher.Invoke(new Action(() => { forSRnumber = new mUpdateModeRMA(retunbyrow.RMANumber); }));

                SRNmumber = true;

                txtPonumber.Text    = forSRnumber._ReturnTbl.PONumber;
                txtRMA.Text         = forSRnumber._ReturnTbl.RMANumber;
                txtVendorName.Text  = forSRnumber._ReturnTbl.VendoeName;
                txtName.Text        = forSRnumber._ReturnTbl.VendoeName;
                txtAddress.Text     = forSRnumber._ReturnTbl.Address1 + " " + forSRnumber._ReturnTbl.Address2 + " " + forSRnumber._ReturnTbl.Address3;
                txtRequestDate.Text = Convert.ToString(forSRnumber._ReturnTbl.CreatedDate);

                //   double height2 = dgPackageInfo.DesiredSize.Height;

                dgPackageInfo.ItemsSource = forSRnumber._lsReturnDetails;//.OrderByDescending(q => q.SKU_Sequence);

                // double height1 = dgPackageInfo.DesiredSize.Height;

                //  Canvas.GetTop(CanvasGrid);

                dtLoadUpdate1          = new DispatcherTimer();
                dtLoadUpdate1.Interval = new TimeSpan(0, 0, 0, 0, 10);
                dtLoadUpdate1.Tick    += dtLoadUpdate1_Tick;
                //start the dispacher.
                dtLoadUpdate1.Start();

                //   double height = dgPackageInfo.DesiredSize.Height;

                // Canvas.SetTop(CanvasNote, 25 + height);

                _threadPrint.Interval = new TimeSpan(0, 0, 3);
                _threadPrint.Start();
                _threadPrint.Tick += _threadPrint_Tick;
            }
        }