Esempio n. 1
0
        private void BindTable()
        {
            DataSource = new ProductTableDataSource();
            DataSource.Products.Add(new Product("1s", string.Format("{0:n0}", onesCount),
                                                string.Format("{0:n0}", onesCount) + " CC"));
            DataSource.Products.Add(new Product("5s", string.Format("{0:n0}", fivesCount),
                                                string.Format("{0:n0}", (fivesCount * 5)) + " CC"));
            DataSource.Products.Add(new Product("25s", string.Format("{0:n0}", qtrCount),
                                                string.Format("{0:n0}", (qtrCount * 25)) + " CC"));
            DataSource.Products.Add(new Product("100s", string.Format("{0:n0}", hundredsCount),
                                                string.Format("{0:n0}", (hundredsCount * 100)) + " CC"));
            DataSource.Products.Add(new Product("250s", string.Format("{0:n0}", twoFiftiesCount),
                                                string.Format("{0:n0}", (twoFiftiesCount * 250)) + " CC"));

            int total       = onesCount + fivesCount + qtrCount + hundredsCount + twoFiftiesCount;
            int totalAmount = onesCount + (fivesCount * 5) + (qtrCount * 25) + (hundredsCount * 100) + (twoFiftiesCount * 250);

            string totalStr = string.Format("{0:n0}", total);

            //totalStr = String.Format("{0:#,###,###.##}", total);
            //totalStr = total.ToString("###,###,####");
            DataSource.Products.Add(new Product("Bank Total", totalStr, string.Format("{0:n0}", totalAmount)
                                                + " CC"));
            //DataSource.Products.Add(new Product("","Bank Total", string.Format("{0:n0}", totalAmount)
            //                                    + " CC"));
            // Populate the Product Table
            ProductTable.DataSource = DataSource;
            ProductTable.Delegate   = new ProductTableDelegate(DataSource);

            //total = 0;

            /*  for (int i = 0; i < multiplier.Length;i++) {
             *    total += Convert.ToInt32(DataSource.Products[i].NotesValue);
             * }
             */
            //lblBankTotal.IntValue = totalAmount;
        }
 public ProductTableDelegate(ProductTableDataSource datasource)
 {
     this.DataSource = datasource;
 }