Esempio n. 1
0
        private void btnPreview_Click(object sender, EventArgs e)
        {
            try
            {
                string vWhere = string.Empty;

                Reports.RptReportViewer vForm = new Reports.RptReportViewer();

                if (!string.IsNullOrEmpty(this.txt_ProductID.Text))
                {
                    vWhere = " AND Products.ProductID=" + this.txt_ProductID.Text;
                }

                if (chkConsumable.Checked == true)
                {
                    vWhere += " AND Isnull(Products.IsRawMaterial,0)=1";
                }

                if (chkSaleable.Checked == true)
                {
                    vWhere += " AND Isnull(Products.IsRawMaterial,0)=0";
                }

                DataTable dt = objDAL.getProductList(vWhere);
                if (dt.Rows.Count == 0)
                {
                    MessageBox.Show("No Data To Display", "No Data");
                    return;
                }

                int vStyle = 0;

                if (optBothPrices.Checked)
                {
                    vStyle = 0;
                }
                else if (optPurOnly.Checked)
                {
                    vStyle = 1;
                }
                else if (optSaleOnly.Checked)
                {
                    vStyle = 2;
                }

                vForm.ProductList(dt, vStyle);
                vForm.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "Error");
            }
        }