Ejemplo n.º 1
0
        public void _14_WhenStateIsNotWI_SholudReturnOneString()
        {
            // Arrange
            string  state    = "aa";
            decimal amount   = 15.5m;
            int     expected = 1;
            Ex14    ex       = new Ex14(state, amount);

            // Act
            string[] actual = ex.GetResult();
            // Assert
            Assert.AreEqual(expected, actual.Length);
        }
Ejemplo n.º 2
0
        public PartialViewResult _14([FromBody] Ex14ViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                RedirectToAction(nameof(_14));
            }
            var amount = decimal.Parse(vm.Amount.Replace(".", ","));

            Ex14 ex = new Ex14(vm.State, amount);

            vm.Result = ex.GetResult();

            return(PartialView("_14_partial", vm));
        }
Ejemplo n.º 3
0
        private void btnDangKi_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtName.Text))
            {
                MessageBox.Show("Bạn phải nhập đầy đủ họ tên", "Thông báo");
                txtName.Focus();
                return;
            }
            if (string.IsNullOrEmpty(cboNganh.Text))
            {
                MessageBox.Show("Bạn phải chọn ngành học", "Thông báo");
                cboNganh.Focus();
                return;
            }
            if (string.IsNullOrEmpty(cboKhoa.Text))
            {
                MessageBox.Show("Bạn phải chọn khóa", "Thông báo");
                cboKhoa.Focus();
                return;
            }
            var lstSachMuon = lstSach.SelectedItems;

            if (lstSachMuon.Count == 0)
            {
                MessageBox.Show("Bạn phải giáo trình cần mượn", "Thông báo");
                return;
            }
            var data = new Ex14()
            {
                HoTen = txtName.Text,
                Khoa  = cboKhoa.Text,
                Nganh = cboNganh.Text,
                Sachs = lstSachMuon.Cast <string>().ToList()
            };

            _lstEx14.Add(data);
            LoadData();
        }