示例#1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RpMonAn rpt = new RpMonAn();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        private void btn_view_Click(object sender, EventArgs e)
        {
            DataTable dt       = new DataTable();
            RpMonAn   rp_MonAn = new RpMonAn();

            if (cb_Select.SelectedIndex == 0)
            {
                if (txt_MaMonAn.Text == "")
                {
                    MessageBox.Show("Hãy nhập mã Món Ăn", "Thông Báo");
                }
                else
                {
                    string mama = txt_MaMonAn.Text;
                    dt = db.DocBang(" Select MaMonAn from MonAn where MaMonAn = '" + mama + "'");
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("Mã Món Ăn này không tồn tại. Hãy Nhập Mã khác", "Thông Báo");
                        return;
                    }
                    string sql;
                    sql = " exec RpMonAn '" + mama + "'";
                    dt  = db.DocBang(sql);
                    rp_MonAn.SetDataSource(dt);
                    crystalReportViewer1.ReportSource = rp_MonAn;
                }
            }
            if (cb_Select.SelectedIndex == 1)
            {
                string sql;
                sql = " Select * from MonAn";
                dt  = db.DocBang(sql);
                rp_MonAn.SetDataSource(dt);
                crystalReportViewer1.ReportSource = rp_MonAn;
            }
        }