예제 #1
0
        private void btnProd_Click(object sender, EventArgs e)
        {
            ProductReport objPro  = new ProductReport();
            rptViewer     objView = new rptViewer();

            if (!String.IsNullOrEmpty(txtSearch.Text))
            {
                objPro.SetParameterValue("@ProductID", txtSearch.Text);

                ProductBL obj = new ProductBL()
                {
                    ProductID = Convert.ToInt32(txtSearch.Text)
                };
                var dt = obj.SearchByPRod();
                if (dt != null)
                {
                    objPro.SetDataSource(dt);
                    objView.crptViewer.ReportSource = objPro;
                    objView.WindowState             = FormWindowState.Maximized;
                    objView.ShowDialog();
                    //crptViewerProd.ReportSource = objPro;
                    txtSearch.Clear();
                }
                else
                {
                    MessageBox.Show("No Record Found");
                }
            }
            else
            {
                MessageBox.Show("Please Enter Product ID");
            }
        }
예제 #2
0
        private void loadProductReport()
        {
            try
            {
                // Donnect to the database
                auntRosieDataset = new aunt_rosieDataSet();
                // Set table adapters
                productReportTableAdapter = new aunt_rosieDataSetTableAdapters.productQuantityReportTableAdapter();

                // Set employee Report & load it
                productReportTableAdapter.Fill(auntRosieDataset.productQuantityReport);
                aProductReport.SetDataSource(auntRosieDataset);
                rptProducts.ViewerCore.ReportSource = aProductReport;        // Load the report
            }
            catch (Exception dataException)
            {
                MessageBox.Show("A data error encountered: " + dataException.Message);
            }
        }
예제 #3
0
        private void btnAllRecord_Click(object sender, EventArgs e)
        {
            ProductReport objPro  = new ProductReport();
            rptViewer     objView = new rptViewer();

            ProductBL obj = new ProductBL();
            var       dt  = obj.SearchByPRodCom();

            if (dt != null)
            {
                objPro.SetDataSource(dt);
                objView.crptViewer.ReportSource = objPro;
                objView.WindowState             = FormWindowState.Maximized;
                objView.ShowDialog();
                //crptViewerProd.ReportSource = objPro;
            }
            else
            {
                MessageBox.Show("No Record Found");
            }
        }
예제 #4
0
        private void LoadTable()
        {
            if (!String.IsNullOrEmpty(Table))
            {
                switch (Table)
                {
                case "Product":
                    List <ProductModel> productModels = new List <ProductModel>();
                    ProductReport       rpt           = new ProductReport();
                    var data = from p in db.Products
                               select new ProductModel
                    {
                        Sku           = p.Sku,
                        DisplayName   = p.DisplayName,
                        Quantity      = (int)p.Quantity,
                        PurcharePrice = p.PurchasePrice,
                        Price         = (double)p.Price,
                        Unit          = p.Unit.DisplayName,
                        Brand         = p.Brand.DisplayName,
                        Category      = p.Category.DisplayName,
                        Supplier      = p.Suplier.DisplayName,
                        Status        = p.Quantity == 0 ?"Hết hàng":"Còn hàng"
                    };
                    rpt.SetDataSource(data);

                    crvReport.ReportSource = rpt;
                    crvReport.Show();
                    break;

                case "Categories":
                    List <CategoriesModel> categoriesModels = new List <CategoriesModel>();
                    CategoriesReport       rpc = new CategoriesReport();
                    var datac = from c in db.Categories
                                select new CategoriesModel
                    {
                        Id          = c.Id,
                        DisplayName = c.DisplayName,
                        Status      = c.Status ? "Kích hoạt" : "Ẩn"
                    };
                    rpc.SetDataSource(datac);

                    crvReport.ReportSource = rpc;
                    crvReport.Show();
                    break;

                case "Brand":
                    List <BrandModel> brandModels = new List <BrandModel>();
                    BrandReport       rpb         = new BrandReport();
                    var datab = from b in db.Brands
                                select new BrandModel
                    {
                        Id          = b.Id,
                        DisplayName = b.DisplayName,
                        Status      = b.Status ? "Kích hoạt" : "Ẩn"
                    };
                    rpb.SetDataSource(datab);

                    crvReport.ReportSource = rpb;
                    crvReport.Show();
                    break;

                case "Supplier":
                    List <SuplierModel> suplierModels = new List <SuplierModel>();
                    SuplierReport       rps           = new SuplierReport();
                    var datas = from s in db.Supliers
                                select new SuplierModel
                    {
                        DisplayName   = s.DisplayName,
                        TaxCode       = s.TaxCode,
                        AccountNumber = s.AcountNumber,
                        Phone         = s.Phone,
                        Email         = s.Email,
                        Adress        = s.Adress,
                        ContractDate  = s.ContractDate,
                        Status        = s.Status ? "Kích hoạt" : "Ẩn"
                    };
                    rps.SetDataSource(datas);

                    crvReport.ReportSource = rps;
                    crvReport.Show();
                    break;

                case "Customer":
                    List <CustomerModel> customerModels = new List <CustomerModel>();
                    CustomerReport       rpcu           = new CustomerReport();
                    var datacu = from cu in db.Customers
                                 select new CustomerModel
                    {
                        DisplayName  = cu.DisplayName,
                        Phone        = cu.Phone,
                        Email        = cu.Email,
                        Adress       = cu.Adress,
                        ContractDate = (DateTime)cu.ContractDate,
                        Status       = cu.Status ? "Kích hoạt" : "Ẩn"
                    };
                    rpcu.SetDataSource(datacu);

                    crvReport.ReportSource = rpcu;
                    crvReport.Show();
                    break;

                case "Input":
                    InputReport rpi   = new InputReport();
                    var         datai = from i in db.InputDetails
                                        select new
                    {
                        Id          = i.Input.Id,
                        DisplayName = i.Input.DisplayName,
                        InputDate   = i.Input.InputDate,
                        Status      = i.Input.Status ? "Đã nhập" : "Chờ duyệt",
                        ProductId1  = i.ProductId,
                        Quantity1   = i.Quantity,
                        Price1      = i.Price
                    };
                    rpi.SetDataSource(datai);

                    crvReport.ReportSource = rpi;
                    crvReport.Show();
                    break;

                case "Output":
                    break;

                default:
                    MessageBox.Show("Vui lòng chọn 1 bảng");
                    break;
                }
            }
            else
            {
                MessageBox.Show("Lỗi thao tác", "Vui lòng chọn 1 bảng để in !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }