private void BtnPrint_Click(object sender, EventArgs e)
        {
            ProductsModel objP = productsModelBindingSource.Current as ProductsModel;

            if (objP != null)
            {
                using (IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString))
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                        string query = "Select ProductCode,ProductName,ProductUnit,RetailPrice,CostPrice,Category,Supplier,CreatedDate,Description from [ProductDetails] " +
                                       $" where ProductCode = '{objP.ProductCode}'";
                        List <ProductDetails> list1 = connection.Query <ProductDetails>(query, commandType: CommandType.Text).ToList();
                        using (frmPrint frm = new frmPrint())
                        {
                            frm.PrintProductInvoice(objP, list1);

                            frm.ShowDialog();
                        }
                    }
                }
            }
        }
        private void BtnPrint_Click(object sender, EventArgs e)
        {
            SalesModel obj = salesModelBindingSource.Current as SalesModel;

            if (obj != null)
            {
                using (IDbConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString))
                {
                    if (connection.State == ConnectionState.Closed)
                    {
                        connection.Open();
                        string query = "Select SalesId,Product,Quantity,Price,Discount from [SalesDetails]  " +
                                       $" where SalesId = '{obj.Id}'";
                        List <SalesDetails> list = connection.Query <SalesDetails>(query, commandType: CommandType.Text).ToList();
                        using (frmPrint frm = new frmPrint())
                        {
                            frm.PrintInvoice(obj, list);

                            frm.ShowDialog();
                        }
                    }
                }
            }
        }