예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DataSet1  ds = new DataSet1();
            DataTable t  = ds.Tables.Add("Items");

            t.Columns.Add("id", Type.GetType("System.Int32"));
            t.Columns.Add("Item", Type.GetType("System.String"));

            DataRow r;
            int     i = 0;

            for (i = 0; i <= 9; i++)
            {
                r         = t.NewRow();
                r["id"]   = i;
                r["Item"] = "Item" + i;
                t.Rows.Add(r);
            }

            CrystalReport1 objRpt = new CrystalReport1();

            objRpt.SetDataSource(ds.Tables[1]);
            crystalReportViewer1.ReportSource = objRpt;
            crystalReportViewer1.Refresh();
        }
예제 #2
0
        private void CustViewbtn_Click(object sender, EventArgs e)
        {
            if (CustIDrbtn.Checked == true)
            {
                CustIDfrmtxt.Text     = "";
                CustIDuptxt.Text      = "";
                CustLasFrmtxt.Text    = "";
                CustLasUptxt.Text     = "";
                CustIDfrmtxt.Enabled  = false;
                CustIDuptxt.Enabled   = false;
                CustLasFrmtxt.Enabled = false;
                CustLasUptxt.Enabled  = false;

                BalloonKingdomDataSetTableAdapters.CustomerTableAdapter cust2 = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.CustomerTableAdapter();
                DataTable datatable = cust2.ViewCustomer();

                Customer_Masterlist rpt = new Customer_Masterlist();


                CrystalReport1 custrpt = new CrystalReport1();
                custrpt.SetDataSource(datatable);

                rpt.AssignCustReport(custrpt);
                rpt.Show();
            }

            else if (Custidbtn.Checked == true)
            {
                if (CustIDfrmtxt.Text != "" && CustIDuptxt.Text == "")
                {
                    MessageBox.Show("Enter up to id first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else if (CustIDfrmtxt.Text == "" && CustIDuptxt.Text != "")
                {
                    MessageBox.Show("Enter from id first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (CustIDfrmtxt.Text == "" && CustIDuptxt.Text == "")
                {
                    MessageBox.Show("Enter from and up to id first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else
                {
                    int a = Convert.ToInt32(CustIDfrmtxt.Text);
                    int b = Convert.ToInt32(CustIDuptxt.Text);

                    BalloonKingdomDataSetTableAdapters.CustomerTableAdapter bend2 = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.CustomerTableAdapter();
                    DataTable datatable = bend2.CustIDBeginEnd(a, b);

                    Customer_Masterlist rpt = new Customer_Masterlist();


                    CustomerFname custrpt2 = new CustomerFname();
                    custrpt2.SetDataSource(datatable);

                    rpt.AssignFname(custrpt2);
                    rpt.Show();
                }
            }



            else
            {
                if (CustLasFrmtxt.Text != "" && CustLasUptxt.Text == "")
                {
                    MessageBox.Show("Enter up to name first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                else if (CustLasFrmtxt.Text == "" && CustLasUptxt.Text != "")
                {
                    MessageBox.Show("Enter from name first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else if (CustLasFrmtxt.Text == "" && CustLasUptxt.Text == "")
                {
                    MessageBox.Show("Enter from and up to name first", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    string a = Convert.ToString(CustLasFrmtxt.Text);
                    string b = Convert.ToString(CustLasUptxt.Text);

                    BalloonKingdomDataSetTableAdapters.CustomerTableAdapter bend = new WindowsApplication1.BalloonKingdomDataSetTableAdapters.CustomerTableAdapter();
                    DataTable datatable = bend.CustBeginEnd(a, b);

                    Customer_Masterlist rpt = new Customer_Masterlist();

                    CustomerLname custrpt3 = new CustomerLname();
                    custrpt3.SetDataSource(datatable);

                    rpt.AssignLname(custrpt3);
                    rpt.Show();
                }
            }
        }