Ejemplo n.º 1
0
        public static void searchInspacificList()
        {
            IDAL adal = new LINQ_DAL();
            IBL  abl  = new E_Mart_BL(adal);

            Department dp1 = new Department("dep1");

            dp1.DepartmentID = 1;
            Department dp2 = new Department("dep2");

            dp1.DepartmentID = 2;
            abl.add(dp1);
            Product       p1    = new Product("Banana", "Food", "1", "500", "3.5", "300");
            Product       p2    = new Product("Apple", "Food", "1", "800", "5", "1000");
            Product       p3    = new Product("T-Shirt", "Fashion", "1", "500", "3.5", "300");
            List <Object> listP = new List <Object>();

            listP.Add(p1);
            listP.Add(p2);
            listP.Add(p3);

            List <Object>  findDep1 = abl.queryByString(Classes.Product, stringFields.location, "1", listP);
            List <Product> testList = abl.queryByString(Classes.Product, stringFields.type, "Fashion", findDep1).Cast <Product>().ToList();


            Assert.IsTrue(testList.Count == 1);
        }
Ejemplo n.º 2
0
        public static void isUserAdmin()
        {
            IDAL adal     = new LINQ_DAL();
            IBL  abl      = new E_Mart_BL(adal);
            User isAdmin1 = new User("Admin", "1234*");

            Assert.IsTrue(abl.isUserAdmin(isAdmin1) != null);
        }
Ejemplo n.º 3
0
        public static void checkDefultHierarchy()
        {
            IDAL adal    = new LINQ_DAL();
            IBL  abl     = new E_Mart_BL(adal);
            User theUser = new User("testUser", "1111");

            Assert.IsTrue(theUser.Hierarchy == Hierarchy.Customer);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            IDAL adal = new LINQ_DAL();
            IBL  abl  = new E_Mart_BL(adal);
            // INewPL anpl = new NewPL_CLI(abl);
            EnterScreen letsBegin = new EnterScreen(abl);
            //letsBegin.Show();
            App test = new App();

            test.Run();


            //anpl.Run();
        }
Ejemplo n.º 5
0
        public static void addAndRemovingInList()
        {
            IDAL       adal = new LINQ_DAL();
            IBL        abl  = new E_Mart_BL(adal);
            Department d1   = new Department("Department 1");

            abl.add(d1);
            Departments Deps = abl.getAllDepartments();

            Assert.IsTrue(Deps.Departmentss.Count == 1);
            abl.remove(d1);
            Departments Deps2 = abl.getAllDepartments();

            Assert.IsTrue(Deps2.Departmentss.Count == 0);
        }
Ejemplo n.º 6
0
        public static void isEditOK()
        {
            IDAL   adal       = new LINQ_DAL();
            IBL    abl        = new E_Mart_BL(adal);
            User   user       = new User("Naharda", "Kawabanga");
            string s1         = user.UserName;
            string s2         = user.Password;
            User   editedUser = new User(user);

            editedUser.Password = "******";
            abl.add(user);
            abl.edit(editedUser);
            Users users = abl.getAllUsers();

            Assert.IsTrue(users.Userss.ElementAt(0).Password.Equals("Banana"));
            Assert.IsTrue(users.Userss.ElementAt(0).UserName.Equals("Naharda"));
        }
Ejemplo n.º 7
0
        //[STAThread]
        public MainWindow()
        {
            InitializeComponent();



            IDAL adal = new LINQ_DAL();
            IBL  abl  = new E_Mart_BL(adal);
            // INewPL anpl = new NewPL_CLI(abl);
            EnterScreen letsBegin = new EnterScreen(abl);

            letsBegin.Show();
            //App test = new App();
            //test.Run();
            this.Close();

            //anpl.Run();
        }
Ejemplo n.º 8
0
        public MainProgram()
        {
            IDAL myDal = new LINQ_DAL();

            IBL clubMember  = new ClubMember_BL(myDal);
            IBL customer    = new Customer_BL(myDal);
            IBL department  = new Department_BL(myDal);
            IBL employee    = new Employee_BL(myDal);
            IBL product     = new Product_BL(myDal);
            IBL transaction = new Transaction_BL(myDal);
            IBL user        = new User_BL(myDal);

            IPL myPL = new PL_GUI(clubMember, customer, department, employee, product, transaction, user);
            //myPL.Run();


            ///////////////////
            //Purchase p = new Purchase(product);
            //p.Show();
            ///////////////////
        }
Ejemplo n.º 9
0
        public static void isEncyptionOK()
        {
            IDAL       adal = new LINQ_DAL();
            IBL        abl  = new E_Mart_BL(adal);
            Department d1   = new Department("Department 1");

            d1.DepartmentID = 1;
            User       user = new User("Naharda", "Kawabanga");
            Employee   emp  = new Employee(305, "Yair", "LAnd", 1, 50000.5, "Male", -1);
            Product    prod = new Product("Banana", "Food", 1, 1, InStock.True, 300, 2.5, 100);
            ClubMember clu  = new ClubMember("2516", "Googi", "Sheldi", "Male", "08/10/1989");

            clu.MemberID = 1;
            Receipt     rec = new Receipt();
            ProductSale ps  = new ProductSale(prod, 3);

            rec.addProductSale(ps);
            Transaction tranc = new Transaction(rec, "Cash");

            tranc.TransactionID = 1;
            E_Mart_Store e = new E_Mart_Store();

            e.addClubMember(clu);
            e.addDepartment(d1);
            e.addEmployee(emp);
            e.addProduct(prod);
            e.addTransaction(tranc);
            e.addUser(user);
            Serialize b   = new Serialize();
            AES       aes = new AES();
            String    s1  = "password";

            byte[] a        = b.SerializeObjectToByteArray(e);
            byte[] password = new byte[s1.Length * sizeof(char)];
            System.Buffer.BlockCopy(s1.ToCharArray(), 0, password, 0, password.Length);
            byte[] ans = aes.AES_Encrypt(a, password);
            Assert.IsFalse(ByteArrayCompare(a, ans));
            byte[] ans2 = aes.AES_Decrypt(ans, password);
            Assert.IsTrue(ByteArrayCompare(ans2, a));
        }