コード例 #1
0
        private void disableButton()
        {
            ReportDocument rptDoc = (ReportDocument)crystalReportViewer1.ReportSource;

            if (rptDoc.Equals(listRpt.First()))
            {
                button1.Enabled = false;
                button2.Enabled = false;
            }

            if (rptDoc.Equals(listRpt.Last()))
            {
                button3.Enabled = false;
                button4.Enabled = false;
            }

            if (!rptDoc.Equals(listRpt.First()))
            {
                button1.Enabled = true;
                button2.Enabled = true;
            }

            if (!rptDoc.Equals(listRpt.Last()))
            {
                button3.Enabled = true;
                button4.Enabled = true;
            }
        }
コード例 #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            ReportDocument rptDoc = (ReportDocument)crystalReportViewer1.ReportSource;

            if (!rptDoc.Equals(listRpt.First()))
            {
                if (listObjLog != null)
                {
                    int currentPage = crystalReportViewer1.GetCurrentPageNumber();
                    crystalReportViewer1.ShowLastPage();
                    int lastPage = crystalReportViewer1.GetCurrentPageNumber();
                    crystalReportViewer1.ShowNthPage(currentPage);

                    if ((lastPage > 1) && (currentPage != 1))
                    {
                        crystalReportViewer1.ShowPreviousPage();
                    }
                    else
                    {
                        crystalReportViewer1.ReportSource = listRpt[listRpt.IndexOf(rptDoc) - 1];
                    }
                }
                else
                {
                    crystalReportViewer1.ReportSource = listRpt[listRpt.IndexOf(rptDoc) - 1];
                }
            }
            disableButton();
        }
コード例 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            ReportDocument rptDoc = (ReportDocument)crystalReportViewer1.ReportSource;

            if (!rptDoc.Equals(listRpt.First()))
            {
                crystalReportViewer1.ReportSource = listRpt.First();
            }
            disableButton();
        }
コード例 #4
0
        private static ReportDocument rptDoc(string rptCode)
        {
            ReportDocument cryRpt = new ReportDocument();

            using (InhCheckupDataContext dbc = new InhCheckupDataContext())
            {
                if (Program.CurrentSite != null)
                {
                    var result = (from row in dbc.mst_reports
                                  where row.mrt_code == rptCode
                                  select row).FirstOrDefault();
                    if (result != null)
                    {
                        try
                        {
                            //using (Class.NetworkShareAccesser.Access(Program.serverIP, usernameConnServer, passwordConnServer))
                            //{
                            //string pathRpt = result.mrt_path_file.Replace(@"C:\Checkup_Pathway", @"\\" + Program.serverIP) + @"\" + result.mrt_file_name;
                            string pathRpt = @"\\" + PrePareData.StaticDataCls.ServerReport + @"\" + result.mrt_path_file + @"\" + result.mrt_file_name;
                            if (pathRpt != string.Empty)
                            {
                                if (File.Exists(pathRpt))
                                {
                                    cryRpt.Load(pathRpt);
                                    SetDBLogonForReport(cryRpt);
                                }
                                else
                                {
                                    MessageBox.Show("Connection Server Error : Path File '" + result.mrt_file_name + "' is not found.");
                                    cryRpt = null;
                                }
                            }
                            else
                            {
                                MessageBox.Show("Database Error : Path Name is null.");
                            }
                            //}
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
            if (!cryRpt.Equals(new ReportDocument()))
            {
                cryRpt.Refresh();
            }
            return(cryRpt);
        }