Exemple #1
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        clsStaff Staff = new clsStaff();

        //variable to store primary key
        Int32 StaffID;

        //variable to store result of find operation
        Boolean found = false;

        //get primary key entered by user
        StaffID = Convert.ToInt32(txtStaffID.Text);

        //find the record
        found = Staff.Find(StaffID);

        //if found
        if (found == true)
        {
            //display values in the form
            txtFullName.Text    = Staff.FullName;
            txtDateOfBirth.Text = Staff.DateOfBirth.ToString();
            txtAddress.Text     = Staff.Address;
            txtContactNo.Text   = Staff.ContactNo;
        }
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        //creates new instance of staff class
        clsStaff StaffMember = new clsStaff();

        if (StaffMember.ValidStaffNumber(txtStaffNumber.Text) != "") //checks to see whether staff number is in correct format.
        {
            lblStaffNumberError.Text = StaffMember.ValidStaffNumber(txtStaffNumber.Text);
        }
        else //runs this bit if the format is correct
        {
            int     StaffNumber;
            Boolean Found = false;
            StaffNumber = Convert.ToInt32(txtStaffNumber.Text);
            Found       = StaffMember.Find(StaffNumber);

            if (Found)
            {
                //fill in the rest of the slots
                txtFirstName.Text    = StaffMember.FirstName;
                txtLastName.Text     = StaffMember.LastName;
                txtHourlyRate.Text   = StaffMember.HourlyRate.ToString();
                txtPhoneNumber.Text  = StaffMember.PhoneNumber;
                txtStartDate.Text    = StaffMember.StartDate.ToString();
                chkIsManager.Checked = StaffMember.IsManager;
            }
        }
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        // create an instance of the Staff class
        clsStaff AStaff = new clsStaff();
        //variable to store the primary key
        Int32 StaffID;
        //variable to store the results of the primary key
        Boolean Found = false;

        // get thre primary key entered by the user
        StaffID = Convert.ToInt32(txtStaffID.Text);
        //Find the record
        Found = AStaff.Find(StaffID);
        //if found
        if (Found == true)
        {
            // display the values of the poperties in the form
            txtFirstName.Text      = AStaff.FirstName;
            txtLastName.Text       = AStaff.LastName;
            txtGender.Text         = AStaff.Gender;
            txtEmail.Text          = AStaff.Email;
            txtContactNo.Text      = AStaff.ContactNo;
            txtAddress1.Text       = AStaff.Address1;
            txtAddress2.Text       = AStaff.Address2;
            txtPostCode.Text       = AStaff.PostCode;
            txtCity.Text           = AStaff.City;
            txtStartDate.Text      = AStaff.StartDate.ToString();
            chkEmployeeStatus.Text = AStaff.EmployeeStatus.ToString();
        }
    }
    protected void FindButton_Click(object sender, EventArgs e)
    {
        clsStaff aStaff = new clsStaff();
        Int32    StaffNo;
        Boolean  Found = false;

        StaffNo = Convert.ToInt32(IDAppearBox.Text);
        try
        {
            Found = aStaff.Find(StaffNo);
            if (Found == true)
            {
                FirstNameAppearBox.Text = aStaff.FirstName;
                SurnameAppearBox.Text   = aStaff.Surname;
                MobileAppearBox.Text    = Convert.ToString(aStaff.MobileNumber);
                PositionAppearBox.Text  = aStaff.Position;
                DateAppearBox.Text      = Convert.ToString(aStaff.DOB);
                DeleteStaffLabel.Text   = Convert.ToString(aStaff.toDelete);
            }
            else
            {
                IDAppearBox.Text = "Staff Not Found";
            }
        }
        catch (System.FormatException)
        {
            IDAppearBox.Text = "Invalid Input";
        }
    }
Exemple #5
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        // Create an instances of the Staff class.
        clsStaff staff = new clsStaff();
        // Variable to store the primary key.
        Int32 StaffId;
        // Variable to store the result of the find operation.
        Boolean Found = false;

        // Get the primary key entered by the user.
        StaffId = Convert.ToInt32(txtStaffID.Text);
        // Find the record.
        Found = staff.Find(StaffId);

        // If found
        if (Found)
        {
            // Display the values of the properties in the form.
            txtStaffName.Text      = staff.StaffName;
            txtDateOfBirth.Text    = staff.DateOfBirth.ToString();
            txtWage.Text           = staff.Wage.ToString();
            txtEmail.Text          = staff.Email.ToString();
            chkGrantAccess.Checked = staff.GrantAccess;
        }
    }
    protected void btnFind_Click(object sender, EventArgs e)
    {
        lblError.Text = "";
        //create and instance of the staff class
        clsStaff AStaff = new clsStaff();
        //variable to store the primary key
        Int32 StaffID;
        //Variable to store the result of the find operation
        Boolean Found = false;

        StaffID = Convert.ToInt32(txtStaffID.Text);
        //find the record
        Found = AStaff.Find(StaffID);
        //if found
        if (Found == true)
        {
            txtStaffID.Text       = AStaff.StaffID.ToString();
            txtFullName.Text      = AStaff.FullName;
            txtSalary.Text        = AStaff.Salary.ToString();
            txtDateOfJoining.Text = AStaff.DateOfJoining.ToString();
            txtPositon.Text       = AStaff.Position;
            chkFullTime.Checked   = AStaff.FullTime;
            chkActive.Checked     = AStaff.Active;
        }
        else
        {
            lblError.Text = "Staff member not found";
        }
    }
Exemple #7
0
    protected void BtnFind_Click(object sender, EventArgs e)
    {
        //creste an instance of the staff class
        clsStaff AnStaff = new clsStaff();
        //variable to store the primary key
        Int32 StaffID;
        //variable to store the result of the find operation
        Boolean Found = false;

        //get the primary key entered by the user
        StaffID = Convert.ToInt32(txtStaffID.Text);
        //find the record
        Found = AnStaff.Find(StaffID);
        //if found
        if (Found == true)
        {
            //display the values of the properties in the form
            txtStaffFirstName.Text = AnStaff.StaffFirstName;
            txtStaffLastName.Text  = AnStaff.StaffLastName;
            txtGender.Text         = AnStaff.Gender;
            txtDateOfBirth.Text    = AnStaff.DateOfBirth.ToString();
            txtNINo.Text           = AnStaff.NINo;
            txtPhoneNo.Text        = AnStaff.PhoneNo;
            txtAddress.Text        = AnStaff.Address;
            txtPostCode.Text       = AnStaff.PostCode;
        }
        else
        {
            txtStaffID.Text = "No Staff with that ID";
        }
    }
    protected void btnFind_Click1(object sender, EventArgs e)
    {
        //create a new instance of class
        clsStaff aStaff = new clsStaff();
        //variable to store the primary key
        Int32 vsID;
        //variable to store the result of the find operation
        Boolean Found = false;

        //get the primary key entered by the user
        vsID = Convert.ToInt32(sID.Text);
        //find the record
        Found = aStaff.Find(vsID);
        //if Found
        if (Found == true)
        {
            //dispay the values of the staff in the form
            sID.Text          = aStaff.sID.ToString();
            sName.Text        = aStaff.sName;
            sAddress.Text     = aStaff.sAddress;
            sJoiningDate.Text = aStaff.sJoinD.ToString();
            Yes.Text          = aStaff.sTutorOrNot.ToString();
            sPhone.Text       = aStaff.sPhone;
        }
    }
Exemple #9
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        //create a new instance of clsStaff
        clsStaff AStaff = new clsStaff();
        //variable to store the primary key
        Int32 StaffID;
        //variable to store the result of the find operation
        Boolean Found = false;

        //get the primary key entered by the user
        StaffID = Convert.ToInt32(txtStaffID.Text);
        //find the record
        Found = AStaff.Find(StaffID);
        //if found
        if (Found == true)
        {
            //display the values of the properties in the form
            txtDepartment.Text    = AStaff.Department;
            txtJobTitle.Text      = AStaff.JobTitle;
            txtName.Text          = AStaff.Name;
            txtExtension.Text     = AStaff.Extension;
            txtPhoneNo.Text       = AStaff.PhoneNo;
            txtHomeAddress.Text   = AStaff.HomeAddress;
            txtPostcode.Text      = AStaff.Postcode;
            txtCity.Text          = AStaff.City;
            txtEnrolmentDate.Text = AStaff.EnrolmentDate.ToString();
        }
    }
Exemple #10
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        //create an instance of the Staff class
        clsStaff StaffMember = new clsStaff();
        //variable to store the primary key
        Int32 StaffID;
        //variable to store the result of the find operation
        Boolean Found = false;

        //get the primary key entered by the user
        StaffID = Convert.ToInt32(txtStaffID.Text);
        //find the record
        Found = StaffMember.Find(StaffID);
        //if found
        if (Found == true)
        {
            //display the values of the properties in the form
            txtStaffName.Text   = StaffMember.StaffName;
            txtStaffID.Text     = StaffMember.StaffID.ToString();
            txtStaffEmail.Text  = StaffMember.StaffEmailAddress;
            txtStaffSalary.Text = StaffMember.StaffSalary.ToString();
            txtStaffDOB.Text    = StaffMember.StaffDOB.ToString();
        }

        else
        {
            //error if id number doesnt exist
            lblError.Text = "Staff Member does not exist";
        }
    }
Exemple #11
0
    protected void btnFind_Click(object sender, EventArgs e)
    {
        //create an instance of the staff class
        clsStaff AStaff = new clsStaff();
        //variable to store the primary key
        Int32 StaffID;
        //variable to store the result of the find operation
        Boolean Found = false;

        //get the primary key entered by the user
        StaffID = Convert.ToInt32(txtStaffID.Text);
        //find the record
        Found = AStaff.Find(StaffID);
        //if found
        if (Found == true)
        {
            //display the values of the properties in the form
            txtFirstName.Text   = AStaff.FirstName;
            txtLastName.Text    = AStaff.LastName;
            txtDateOfBirth.Text = AStaff.DateOfBirth.ToString();
            txtDepartment.Text  = AStaff.Department;
            txtEmail.Text       = AStaff.Email;
            txtPassword.Text    = AStaff.Password;
        }
        else
        {
            lblError.Text = "Staff not found";
        }
    }
 public void FindMethodOK()
 {
     clsStaff AStaff = new clsStaff();
     Boolean Found = false;
     Int32 StaffID = 1;
     Found = AStaff.Find(StaffID);
     Assert.IsTrue(Found);
 }
Exemple #13
0
        public void FindMethodOK()
        {
            clsStaff AStaff = new clsStaff();
            Boolean  Found  = false;
            int      Id     = 2;

            Found = AStaff.Find(Id);
            Assert.IsTrue(Found);
        }
        public void FindMethodOK()
        {
            clsStaff AStock    = new clsStaff();
            Boolean  Found     = false;
            int      ProductId = 1;

            Found = AStock.Find(ProductId);
            Assert.IsTrue(Found);
        }
Exemple #15
0
        public void FindOK()
        {
            clsStaff staffMember = new clsStaff();
            Boolean  Found       = false;
            int      StaffNumber = 10001;

            Found = staffMember.Find(StaffNumber);
            Assert.IsTrue(Found);
        }
Exemple #16
0
        public void FindMethodOK()
        {
            clsStaff staff = new clsStaff();
            Boolean  Found = false;
            int      id    = 1;

            staff.ID = id;
            Found    = staff.Find(id);
            Assert.IsTrue(Found);
        }
        public void FindMethodOk()
        {
            //check that the Find Method property is ok and can be found
            clsStaff AStaff  = new clsStaff();
            Boolean  Found   = false;
            Int32    StaffNo = 1;

            Found = AStaff.Find(StaffNo);
            Assert.IsTrue(Found);
        }
Exemple #18
0
    // Event handler for the Find button.
    protected void btnFind_Click(object sender, EventArgs e)
    {
        // Create an instance of clsStaff.
        var staff = new clsStaff();

        Int32 staffID;

        Boolean found = false;

        // Prevents crash if user enters a value other than an integer.
        try
        {
            staffID = Convert.ToInt32(txtStaffID.Text);
        }
        catch (System.FormatException)
        {
            staffID = -1; // Set a default value that would not exist.
        }

        found = staff.Find(staffID);

        // If the staff ID exists...
        if (found)
        {
            // If the user has admin privileges.
            if ((bool)Session["isAdmin"])
            {
                // Admin view - all data is available.
                txtStaffUsername.Text  = staff.Username;
                txtStaffPassword.Text  = staff.Password;
                txtStaffName.Text      = staff.Name;
                txtStaffAddress.Text   = staff.Address;
                txtDateOfCreation.Text = Convert.ToString(staff.DateOfCreation);
                txtStaffAge.Text       = Convert.ToString(staff.Age);
                chkAdmin.Checked       = staff.Admin;
            }
            else
            {
                // Staff member without admin privileges - some data is redacted.
                txtStaffUsername.Text  = staff.Username;
                txtStaffPassword.Text  = "REDACTED";
                txtStaffName.Text      = staff.Name;
                txtStaffAddress.Text   = "REDACTED";
                txtDateOfCreation.Text = Convert.ToString(staff.DateOfCreation);
                txtStaffAge.Text       = Convert.ToString(staff.Age);
                chkAdmin.Checked       = staff.Admin;
            }
        }
        else
        {
            // Return an user-friendly error message.
            lblError.Text = "<b>ERROR - THIS RECORD DOES NOT EXIST!</b>";
        }
    }
Exemple #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Checks to see if the key "isLoggedIn" exists within the Session array.
        if (Session["isLoggedIn"] == null)
        {
            // Redirect to StaffLogin.
            Response.Redirect("StaffLogin.aspx");
        }
        else
        {
            // Checks to see if the user is logged in.
            if (!(bool)Session["isLoggedIn"] || Session["isLoggedIn"] == null)
            {
                // Redirect to StaffLogin.
                Response.Redirect("StaffLogin.aspx");
            }
        }

        // Create an instance of clsStaff.
        var staff = new clsStaff();

        /*
         * Check to see if the selected staff member's ID is within the database,
         * if so, populate clsStaff's properties.
         */
        staff.Find((int)Session["selectedStaffID"]);

        // Checks to see if the staff member has admin privileges or the if the selected user is the actual user itself.
        if ((bool)Session["isAdmin"] || (int)Session["selectedStaffID"] == (int)Session["staffID"])
        {
            // Admin view - all data is available.
            Response.Write("Staff ID: " + staff.ID + "<br>");
            Response.Write("Staff Username: "******"<br>");
            Response.Write("Staff Password: "******"<br>");
            Response.Write("Staff Name: " + staff.Name + "<br>");
            Response.Write("Staff Address: " + staff.Address + "<br>");
            Response.Write("Date of Creation: " + staff.DateOfCreation + "<br>");
            Response.Write("Staff Age: " + staff.Age + "<br>");
            Response.Write("Is Admin: " + staff.Admin);
        }
        else
        {
            // Staff member without admin privileges - some data is redacted.
            Response.Write("Staff ID: " + staff.ID + "<br>");
            Response.Write("Staff Username: "******"<br>");
            Response.Write("Staff Password: REDACTED" + "<br>");
            Response.Write("Staff Name: " + staff.Name + "<br>");
            Response.Write("Staff Address: REDACTED" + "<br>");
            Response.Write("Date of Creation: " + staff.DateOfCreation + "<br>");
            Response.Write("Staff Age: " + staff.Age + "<br>");
            Response.Write("Is Admin: " + staff.Admin);
        }
    }
 public void TestStaffDOBFound()
 {
     clsStaff AStaff = new clsStaff();
     Boolean Found = false;
     Boolean OK = true;
     Found = AStaff.Find(StaffID);
     if (AStaff.StaffDOB != Convert.ToDateTime("16/09/2015"))
     {
         OK = false;
     }
     Assert.IsTrue(OK);
 }
Exemple #21
0
        public void FindMethodOk()
        {
            clsStaff Staff = new clsStaff();

            Boolean found = false;

            Int32 StaffID = 6;

            found = Staff.Find(StaffID);

            Assert.IsTrue(found);
        }
Exemple #22
0
        public void FindMethodOK()
        {
            clsStaff staff = new clsStaff();
            //Boolean value to store the results of validation
            Boolean Found = false;
            //test data
            Int32 StaffId = 1;

            //invoking the method
            Found = staff.Find(StaffId);
            //test the result
            Assert.IsTrue(Found);
        }
 public void TestStaffIDFound()
 {
     clsStaff AStaff = new clsStaff();
     Boolean Found = false;
     Boolean OK = true;
     Int32 StaffID = 21;
     Found = AStaff.Find(StaffID);
     if (AStaff.StaffID != 21)
     {
         OK = false;
     }
     Assert.IsTrue(OK);
 }
        public void TestStaffIDFound()
        {
            clsStaff AStaff  = new clsStaff();
            Boolean  Found   = false;
            Boolean  OK      = true;
            Int32    staffId = 20;

            Found = AStaff.Find(staffId);
            if (AStaff.staffId != 20)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
        public void TestPasswordFound()
        {
            clsStaff AStaff  = new clsStaff();
            Boolean  Found   = false;
            Boolean  OK      = true;
            Int32    staffId = 20;

            Found = AStaff.Find(staffId);
            if (AStaff.password != "bruh")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
        public void TestManagerOrStaffFound()
        {
            clsStaff AStaff  = new clsStaff();
            Boolean  Found   = false;
            Boolean  OK      = true;
            Int32    staffId = 20;

            Found = AStaff.Find(staffId);
            if (AStaff.managerOrStaff != true)
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
        public void TestSurnameFound()
        {
            clsStaff AStaff  = new clsStaff();
            Boolean  Found   = false;
            Boolean  OK      = true;
            Int32    staffId = 20;

            Found = AStaff.Find(staffId);
            if (AStaff.surname != "Marston")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
        public void TestFirstNameFound()
        {
            clsStaff AStaff  = new clsStaff();
            Boolean  Found   = false;
            Boolean  OK      = true;
            Int32    staffId = 20;

            Found = AStaff.Find(staffId);
            if (AStaff.firstName != "Chris")
            {
                OK = false;
            }
            Assert.IsTrue(OK);
        }
Exemple #29
0
        public void FindMethodOK()
        {
            //create an instance of the class we want to create
            clsStaff AStaff = new clsStaff();
            //boolean variable to store the results of the validation
            Boolean Found = false;
            //create some test data to use with the method
            Int32 StaffID = 1;

            //invoke the method
            Found = AStaff.Find(StaffID);
            //test to see if the result is true
            Assert.IsTrue(Found);
        }
Exemple #30
0
        public void FindMethodOK()
        {
            //instance of class created
            clsStaff aStaff = new clsStaff();
            // Bollean variable to store the results of the validation
            Boolean Found = false;
            //create test data
            string Name = "Michael";

            // invoke find method
            Found = aStaff.Find(Name);
            //test to see if the result is true
            Assert.IsTrue(Found);
        }