public void Initialize_WhenThereIsNoBillToIDInDB_ReturnEmptyBillToIDList()
        {
            var         sut = new BMPresenter(databaseConnection, userName, viewer);
            BMViewModel vm  = sut.Initialize();

            Assert.That(vm.BillToIdDt.Rows.Count == 0);
        }
Beispiel #2
0
 public BMPresenter(SqlDatabaseConnection databaseConnection, string userName, IBMViewer view)
 {
     // TODO: Complete member initialization
     this.repository = new BillToIDsRepository(databaseConnection);
     this.userName   = userName;
     this.viewer     = view;
     this.vm         = new BMViewModel {
         InputBillToID = string.Empty
     };
 }
        public void Initialize_WhenThereAreSomeBillToIDsInDB_ReturnNotEmptyBillToIDList()
        {
            var repository = new BillToIDsRepository(databaseConnection);
            var sut        = new BMPresenter(databaseConnection, userName, viewer);

            repository.CreateBillToID("123456", userName, DateTime.Now);
            BMViewModel vm = sut.Initialize();

            Assert.That(vm.BillToIdDt.Rows, Has.Count.GreaterThan(0));
            Assert.That(vm.BillToIdDt.Rows, Has.Count.EqualTo(1));

            databaseConnection.RunSqlCommand("truncate table BillToIDs");
        }
Beispiel #4
0
        public ActionResult BM(BMViewModel model)
        {
            double weight       = model.Weight;
            double height       = model.Height;
            int    age          = model.Age;
            string sex          = model.Sex;
            double maleresult   = 66.47 + 13.75 * weight + 5.033 * height - 6.75 * age;
            double femaleresult = 655.09 + 9.56 * weight + 1.84 * height - 4.67 * age;

            if (sex.Equals("Male"))
            {
                ViewBag.result = string.Format("Your Basic Metabolic Rate is {0} kca", maleresult);
            }
            else
            {
                ViewBag.result = string.Format("Your Basic Metabolic Rate is {0} kca", femaleresult);
            }
            return(View());
        }
 public void Show(BMViewModel viewModel)
 {
     vm = viewModel;
     billToIdFlexGrid.DataSource = vm.BillToIdDt;
 }