示例#1
0
        public DataSet AdminGetTableData(string selectedTable)
        {
            ctrAdminObj = new CtrAdmin();

            Console.WriteLine();
            Console.WriteLine("AdminGetTableData() " + GetExecutionThreadTime());
            Console.WriteLine("Table: " + selectedTable);

            return ctrAdminObj.GetTableData(selectedTable);
        }
示例#2
0
        public void AdminUpdateAdmins()
        {
            CtrAdmin ctrAdminObj = new CtrAdmin();

            DataSet ds = GetAdminDataSet("admin2", "admin2");

            bool actual = ctrAdminObj.UpdateAdmins(ds);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
示例#3
0
        public void AdminLogin()
        {
            CtrAdmin ctrAdminObj = new CtrAdmin();
            DataSet ds = GetAdminDataSet("admin3", "admin3");
            ctrAdminObj.UpdateAdmins(ds);

            int expected = 1;
            int actual = ctrAdminObj.Login("admin3", "admin3");

            Assert.AreEqual(expected, actual);
        }
示例#4
0
        public void AdminUpdateFlats()
        {
            CtrAdmin ctrAdminObj = new CtrAdmin();

            DataSet ds = ctrAdminObj.GetTableData("Flats");
            ds.Tables[0].Rows[0]["Description"] = "This is changed descrition...";

            bool actual = ctrAdminObj.UpdateFlats(ds);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
示例#5
0
        public void AdminAddApplication()
        {
            CtrAdmin ctrAdminObj = new CtrAdmin();
            DataSet ds = ctrAdminObj.GetTableData("Applications");

            DataRow dr = ds.Tables[0].NewRow();
            dr["StudentEmail"] = "*****@*****.**";
            dr["FlatId"] = 75;
            ds.Tables[0].Rows.Add(dr);

            ctrAdminObj.UpdateApplications(ds);
        }
示例#6
0
        public void AdminUpdateLandlords()
        {
            CtrAdmin ctrAdminObj = new CtrAdmin();

            DataSet ds = ctrAdminObj.GetTableData("Landlords");
            DataRow dr = ds.Tables[0].NewRow();
            dr = AddLandlordRow(dr);
            ds.Tables[0].Rows.Add(dr);

            bool actual = ctrAdminObj.UpdateLandlords(ds);
            bool expected = true;

            Assert.AreEqual(expected, actual);
        }
示例#7
0
        private DataSet GetAdminDataSet(string username, string password)
        {
            CtrAdmin ctrAdminObj = new CtrAdmin();

            DataSet ds = ctrAdminObj.GetTableData("Admins");
            DataRow dr = ds.Tables[0].NewRow();
            dr["Username"] = username;
            dr["Password"] = password;
            dr["Salt"] = "None";
            ds.Tables[0].Rows.Add(dr);

            return ds;
        }
示例#8
0
        //ADMIN
        public int AdminLogin(string username, string password)
        {
            ctrAdminObj = new CtrAdmin();

            //lock (LockObject)
            //{
                Console.WriteLine("STARTED admin login | Thread: " + Thread.CurrentThread.ManagedThreadId.ToString() + " | Time: " + DateTime.Now);
                Thread.Sleep(3000);

                return ctrAdminObj.Login(username, password);
            //}
        }
示例#9
0
        public bool AdminUpdateStudents(DataSet ds)
        {
            ctrAdminObj = new CtrAdmin();

            Console.WriteLine();
            Console.WriteLine("AdminUpdateStudents() " + GetExecutionThreadTime());

            return ctrAdminObj.UpdateStudents(ds);
        }