示例#1
0
        public void PhoneIDPropertyOK()

        {
            //create an instance of the class we want to create
            clsAdministrator AnAdministrator = new clsAdministrator();
            //create some test data to assign to the property
            int TestData = 3;

            //assign the data to the property
            AnAdministrator.PhoneID = TestData;
            //test to see that it exists
            Assert.AreEqual(AnAdministrator.PhoneID, TestData);
        }
示例#2
0
        public void ActivePropertyOK()

        {
            //create an instance of the class we want to create
            clsAdministrator AnAdministrator = new clsAdministrator();
            //create some test data to assign to the property
            Boolean TestData = true;

            //assign the data to the property
            AnAdministrator.Active = TestData;
            //test to see that it exists
            Assert.AreEqual(AnAdministrator.Active, TestData);
        }
示例#3
0
        public void FindMethodOK()

        {
            //create an instance of the class we want to create
            clsAdministrator AnAdministrator = new clsAdministrator();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //create some test data to use with the method
            int AdministratorID = 10;

            //invoke the method
            Found = AnAdministrator.Find(AdministratorID);
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
示例#4
0
        public void TestPhoneIDFound()

        {
            //create an instance of the class we want to create
            clsAdministrator AnAdministrator = new clsAdministrator();
            //boolean variable to store the result of the validation
            Boolean Found = false;
            //boolean variable to record if data is OK (assume it is )
            Boolean OK = true;
            //create some test data to use with the method
            int AdministratorID = 10;

            //invoke the method
            Found = AnAdministrator.Find(AdministratorID);
            //check the administrator id
            if (AnAdministrator.PhoneID != 3)
            {
                OK = false;
            }
            //test to see that the result is correct
            Assert.IsTrue(Found);
        }
示例#5
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            clsAdministrator administrator = new clsAdministrator();
            int id = clsGlobal.tbAdministrators.Rows.Count;

            administrator.Name     = txtNom.Text;
            administrator.Email    = txtEmail.Text;
            administrator.Phone    = txtPhone.Text;
            administrator.Ssn      = txtNAS.Text;
            administrator.Password = txtPassword.Text;
            if (mode == "Ajout")
            {
                administrator.Id = (Convert.ToInt32(clsGlobal.tbAdministrators.Rows[id - 1]["AdminID"]) + 1);
                administrator.AddAdministrator(administrator);
            }
            else if (mode == "Modifier")
            {
                administrator.Id = Convert.ToInt32(clsGlobal.tbAdministrators.Rows[courant]["AdminID"]);
                administrator.EditAdministrator(administrator);
            }
            clsDataAdmin.UpdateAdmin(clsGlobal.tbAdministrators);
            mode = "";
            Row2Txt();
        }
示例#6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            clsAdministrator admin = new clsAdministrator();
            clsAgent         agent = new clsAgent();

            agent.Name      = txtNom.Text;
            agent.Email     = txtEmail.Text;
            agent.Phone     = txtPhone.Text;
            agent.Ssn       = txtNAS.Text;
            agent.Password  = txtPassword.Text;
            agent.Hire_date = dateTimeEmbauche.Value;
            agent.Id        = clsGlobal.tbAgents.Rows.Count + 1;
            clsAgent agent2 = new clsAgent(clsGlobal.tbAgents.Rows.Count + 1, txtNom.Text, txtEmail.Text, txtPhone.Text, dateTimeEmbauche.Value, txtNAS.Text, txtPassword.Text);

            if (mode == "Ajout")
            {
                DataRow myRow = clsGlobal.tbAgents.NewRow();
                myRow["AgentID"]      = 50;
                myRow["Nom"]          = agent.Name;
                myRow["Email"]        = agent.Email;
                myRow["Cellulaire"]   = agent.Phone;
                myRow["NAS"]          = agent.Ssn;
                myRow["DateEmbauche"] = agent.Hire_date;
                myRow["Password"]     = agent.Password;
                clsGlobal.tbAgents.Rows.Add(myRow);

                //admin.AddAgent(agent2);
            }
            else if (mode == "Modifier")
            {
                admin.EditAgent(agent);
            }
            clsDataAdmin.UpdateAgents();
            mode = "";
            Row2Txt();
        }