Ejemplo n.º 1
0
        public void PatientRegisterTest()
        {
            //Arrange
            PatientsDAO patientDAO = new PatientsDAO();

            HomeDAO homeDAO = new HomeDAO();
            Patient patient = new Patient
            {
                PatientId   = 90,
                Name        = "Test Patient 2",
                Email       = "*****@*****.**",
                Password    = "******",
                PhoneNumber = "0888123456",
                Diagnose    = "test",
                BloodGroup  = "B-"
            };

            //Act
            bool result = homeDAO.PatientRegister(patient);

            //Assert
            Assert.IsTrue(result);

            //Clean-Up
            patientDAO.DeletePatient(patient);
        }
Ejemplo n.º 2
0
        public ActionResult Listar(string nome)
        {
            HomeDAO      dao   = new HomeDAO();
            IList <Nome> nomes = dao.Lista(nome);

            return(View(nomes));
        }
Ejemplo n.º 3
0
        public void DonorRegisterTest()
        {
            //Arrange
            DonorsDAO donorsDAO = new DonorsDAO();

            HomeDAO homeDAO = new HomeDAO();
            Donor   donor   = new Donor();

            donor.DonorId     = 7;
            donor.Name        = "Ralitsa Mladenova";
            donor.Email       = "*****@*****.**";
            donor.Password    = "******";
            donor.PhoneNumber = "0888654321";
            donor.Status      = "Available";
            donor.BloodGroup  = "0+";

            //Act
            bool result = homeDAO.DonorRegister(donor);

            //Assert
            Assert.IsTrue(result);

            //Clean-Up
            donorsDAO.DeleteDonor(donor);
        }
Ejemplo n.º 4
0
        public ActionResult DealsOfTheWeek()
        {
            ArrayList model    = new ArrayList();
            var       products = HomeDAO.LoadProductDealsOfTheWeek();

            model.Add(products);
            return(PartialView(model));
        }
Ejemplo n.º 5
0
        public ActionResult Banner()
        {
            ArrayList model   = new ArrayList();
            var       product = HomeDAO.LoadProductsToBaner();

            model.Add(product);
            return(PartialView(model));
        }
Ejemplo n.º 6
0
        public ActionResult Trends()
        {
            ArrayList model        = new ArrayList();
            var       listProducts = HomeDAO.LoadTrends();

            model.Add(listProducts);
            return(PartialView(model));
        }
Ejemplo n.º 7
0
        public ActionResult TatCa()
        {
            Session["KM"] = null;
            var db = new HomeDAO();

            Session["Title"]    = "Tất Cả Sách";
            Session["Products"] = db.GetList();
            return(View("../DanhSachSanPham/Index"));
        }
Ejemplo n.º 8
0
        public ActionResult XemNhieu()
        {
            Session["KM"] = null;
            var db = new HomeDAO();

            Session["Title"]    = "Xem nhiều";
            Session["Products"] = db.GetListXemNhieuAll();
            return(View("../DanhSachSanPham/Index"));
        }
Ejemplo n.º 9
0
        public ActionResult Noibat()
        {
            Session["KM"] = null;
            var db = new HomeDAO();

            Session["Title"]    = "Nổi Bật";
            Session["Products"] = db.GetListNoiBatAll();
            return(View("../DanhSachSanPham/Index"));
        }
Ejemplo n.º 10
0
        public ActionResult SachMoi()
        {
            Session["KM"] = null;
            var db = new HomeDAO();

            Session["Title"]    = "Sách Mới";
            Session["Products"] = db.GetListSachMoiAll();
            return(View("../DanhSachSanPham/Index"));
        }
Ejemplo n.º 11
0
        public ActionResult MHMoi()
        {
            Session["CTBrand"]     = null;
            Session["CTKhuyenMai"] = null;
            HomeDAO dao = new HomeDAO();

            Session["Title"]    = "Mô Hình Mới";
            Session["Products"] = dao.GetListMoiAll();
            return(RedirectToAction("Index", "MoHinhs"));
        }
Ejemplo n.º 12
0
        public ActionResult XemNhieu()
        {
            Session["CTBrand"]     = null;
            Session["CTKhuyenMai"] = null;
            HomeDAO dao = new HomeDAO();

            Session["Title"]    = "Mô Hình Được Xem Nhiều";
            Session["Products"] = dao.GetListXemNhieuAll();
            return(RedirectToAction("Index", "MoHinhs"));
        }
Ejemplo n.º 13
0
        public ActionResult Search(string name, string loai, string nsx, string min, string max)
        {
            Session["CTBrand"]     = null;
            Session["CTKhuyenMai"] = null;
            HomeDAO dao = new HomeDAO();
            string  title;

            Session["Products"] = dao.Search(name, loai, nsx, min, max, out title);
            Session["Title"]    = title;
            return(RedirectToAction("Index", "MoHinhs"));
        }
Ejemplo n.º 14
0
        public ActionResult MoHinh(int id)
        {
            Session["CTBrand"] = null;
            HomeDAO dao = new HomeDAO();
            var     db  = new SanPhamContext();
            var     km  = db.KhuyenMais.Find(id);

            Session["Title"]       = "Mô Hình Của Chương Trình Khuyến Mãi: " + km.TenKM;
            Session["CTKhuyenMai"] = km;
            Session["Products"]    = dao.GetListTheoKM(id);
            return(RedirectToAction("Index", "MoHinhs"));
        }
Ejemplo n.º 15
0
        // GET: Home


        public ActionResult Index()
        {
            var          dao  = new HomeDAO();
            View3Baidang view = new View3Baidang();

            ViewBag.List = dao.ListAll();
            view.v1      = dao.List_baidang("SK");
            view.v2      = dao.List_baidang("TD");
            view.v3      = dao.List_baidang("TS");
            view.v4      = dao.ListAll();
            return(View(view));
        }
Ejemplo n.º 16
0
        public ActionResult Featured()
        {
            ArrayList model    = new ArrayList();
            var       special  = HomeDAO.LoadProductSpecial();
            var       discount = HomeDAO.LoadProductDiscount();
            var       bestSell = HomeDAO.LoadProductBestSell();

            model.Add(special);
            model.Add(discount);
            model.Add(bestSell);
            return(PartialView(model));
        }
Ejemplo n.º 17
0
        public ActionResult MoHinh(int id)
        {
            Session["CTKhuyenMai"] = null;
            HomeDAO dao   = new HomeDAO();
            var     db    = new SanPhamContext();
            var     brand = db.NSXs.Find(id);

            Session["CTBrand"]  = brand;
            Session["Title"]    = "Mô Hình Của " + brand.TenNSX;
            Session["Products"] = dao.GetListTheoNSX(id);
            return(RedirectToAction("Index", "MoHinhs"));
        }
Ejemplo n.º 18
0
        public void EmailDoesNotExistInPatientsTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();
            string  email   = "*****@*****.**";
            bool    isDonor = false;

            //Act
            bool result = homeDAO.EmailAlreadyExists(email, isDonor);

            //Assert
            Assert.IsFalse(result);
        }
Ejemplo n.º 19
0
        public void EmailExistsInPatientsTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();
            string  email   = "*****@*****.**";
            bool    isDonor = false;

            //Act
            bool result = homeDAO.EmailAlreadyExists(email, isDonor);

            //Assert
            Assert.IsTrue(result);
        }
Ejemplo n.º 20
0
        public void EmailDoesNotExistInDonorsTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();
            string  email   = "*****@*****.**";
            bool    isDonor = true;

            //Act
            bool result = homeDAO.EmailAlreadyExists(email, isDonor);

            //Assert
            Assert.IsFalse(result);
        }
Ejemplo n.º 21
0
        public void EmailExistsInDonorsTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();
            string  email   = "*****@*****.**";
            bool    isDonor = true;

            //Act
            bool result = homeDAO.EmailAlreadyExists(email, isDonor);

            //Assert
            Assert.IsTrue(result);
        }
Ejemplo n.º 22
0
 // GET: MoHinhs
 public ActionResult Index(int?page)
 {
     if (Session["Products"] != null)
     {
         var list = Session["Products"] as List <WebApplication30.Models.SanPham>;
         return(View(list.ToPagedList(page ?? 1, 1)));
     }
     else
     {
         Session["Title"] = "Tất Cả";
         HomeDAO dao = new HomeDAO();
         return(View(dao.GetAll().ToPagedList(page ?? 1, 1)));
     }
 }
Ejemplo n.º 23
0
        public static TrendingEntity[] GetTrendingData() //Show the details of the data after insert in HTML Table
        {
            var details = new List <TrendingEntity>();

            try
            {
                details = new HomeDAO().GetTrendingList();
            }
            catch (Exception ex)
            {
                // details.Add(new DbStatusEntity(ex.Message));
            }
            return(details.ToArray());
        }
Ejemplo n.º 24
0
        public void ChangeDonorStatusTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();

            DonorsDAO donorsDAO = new DonorsDAO();
            string    email     = "*****@*****.**";
            string    password  = "******";
            string    expected  = "Available";

            //Act
            Donor donor = homeDAO.DonorLogin(email, password);

            donorsDAO.ChangeDonorStatus(donor);

            //Assert
            Assert.AreEqual(expected, donor.Status);
        }
Ejemplo n.º 25
0
        public void PatientRegisterAlreadyExistingTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();
            Patient patient = new Patient();

            patient.PatientId   = 1;
            patient.Name        = "Test Patient";
            patient.Email       = "*****@*****.**";
            patient.Password    = "******";
            patient.PhoneNumber = "0888123456";
            patient.Diagnose    = "test";
            patient.BloodGroup  = "B-";

            //Act
            bool result = homeDAO.PatientRegister(patient);

            //Assert
            Assert.IsFalse(result);
        }
Ejemplo n.º 26
0
        public void TransfuseBloodTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();

            DonorsDAO donorsDAO   = new DonorsDAO();
            Patient   testPatient = new Patient();

            testPatient.Name = "test";
            string email    = "*****@*****.**";
            string password = "******";

            //Act
            Donor donor = homeDAO.DonorLogin(email, password);

            donorsDAO.TransfuseBlood(donor, testPatient);

            //Assert
            Assert.AreEqual(testPatient.Name, donor.Status);
        }
Ejemplo n.º 27
0
        public void DonorRegisterAlreadyExistingTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();
            Donor   donor   = new Donor
            {
                DonorId     = 2,
                Name        = "Dimitur Petrov",
                Email       = "*****@*****.**",
                Password    = "******",
                PhoneNumber = "0881231234",
                Status      = null,
                BloodGroup  = "0+"
            };

            //Act
            bool result = homeDAO.DonorRegister(donor);

            //Assert
            Assert.IsFalse(result);
        }
Ejemplo n.º 28
0
        public void DeletePatientTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();

            PatientsDAO patientsDAO = new PatientsDAO();
            Patient     testPatient = new Patient();

            testPatient.PatientId   = 102;
            testPatient.Name        = "Test Patient 2";
            testPatient.Email       = "*****@*****.**";
            testPatient.Password    = "******";
            testPatient.PhoneNumber = "0888123456";
            testPatient.Diagnose    = "test";
            testPatient.BloodGroup  = "A+";

            //Act
            homeDAO.PatientRegister(testPatient);
            patientsDAO.DeletePatient(testPatient);

            //Assert
            Assert.IsTrue(homeDAO.PatientLogin(testPatient.Email, testPatient.Password) == null);
        }
Ejemplo n.º 29
0
        public void PatientLoginTest()
        {
            //Arrange
            HomeDAO homeDAO  = new HomeDAO();
            string  email    = "*****@*****.**";
            string  password = "******";
            Patient expected = new Patient
            {
                PatientId   = 14,
                Name        = "Nikolai Petrov",
                Email       = "*****@*****.**",
                Password    = "******",
                PhoneNumber = "0881231234",
                Diagnose    = "Blood Cancer",
                BloodGroup  = "A-"
            };

            //Act
            Patient result = homeDAO.PatientLogin(email, HashPassword(password));

            //Assert
            Assert.AreEqual(expected, result);
        }
Ejemplo n.º 30
0
        public void DeleteDonorFromSystemTest()
        {
            //Arrange
            HomeDAO homeDAO = new HomeDAO();

            DonorsDAO donorsDAO = new DonorsDAO();
            Donor     testDonor = new Donor();

            testDonor.DonorId     = 101;
            testDonor.Name        = "Test Donor 1";
            testDonor.Email       = "*****@*****.**";
            testDonor.Password    = "******";
            testDonor.PhoneNumber = "0888123456";
            testDonor.Status      = null;
            testDonor.BloodGroup  = "B-";

            //Act
            homeDAO.DonorRegister(testDonor);
            donorsDAO.DeleteDonor(testDonor);

            //Assert
            Assert.IsTrue(homeDAO.DonorLogin(testDonor.Email, testDonor.Password) == null);
        }