Пример #1
0
        /**
         * Method to update managers profile
         */
        public void managerUpdateProfile(Staff memberToChange, String FirstName, String LastName, DateTime birthDate, String address, String email, double salary, int hoursAvailable, int roleID, int DepartmentID, Contract contract)
        {
            MySqlConnection conn = new MySqlConnection(connString);

            // Open connection
            conn.Open();
            MySqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = "UPDATE person SET Firstname = @FirstN,  Lastname = @LastN, Age = @Age, Address = @Address, Email = @Email, Salary = @Salary," +
                              "HoursAvailable = @HoursAvailable, IsAvailable = @IsAvailable, RoleID = @RoleID, DepartmentID = @DepartmentID, ContractID = @ContractID WHERE Id = @PersonID";

            cmd.Parameters.AddWithValue("@PersonID", memberToChange.dbID);
            cmd.Parameters.AddWithValue("@FirstN", FirstName);
            cmd.Parameters.AddWithValue("@LastN", LastName);
            cmd.Parameters.AddWithValue("@Age", birthDate);
            cmd.Parameters.AddWithValue("@Address", address);
            cmd.Parameters.AddWithValue("@Email", email);
            cmd.Parameters.AddWithValue("@Salary", salary);
            cmd.Parameters.AddWithValue("@HoursAvailable", hoursAvailable);
            cmd.Parameters.AddWithValue("@IsAvailable", "Yes");
            //cmd.Parameters.AddWithValue("@Passcode", passcode);
            cmd.Parameters.AddWithValue("@RoleID", roleID);
            cmd.Parameters.AddWithValue("@DepartmentID", DepartmentID);
            cmd.Parameters.AddWithValue("@ContractID", contract);

            cmd.ExecuteNonQuery();

            memberToChange.editStaffMember(FirstName, LastName, birthDate, address, email);
        }
        /**
         * Method to edit staff meber
         */
        private void btnEditStaff_Click(object sender, EventArgs e)
        {
            ReadInfoFromForm();
            //int passcode = Convert.ToInt32(txtBoxPasscode.Text);

            dataBase.managerUpdateProfile(staffMember, FirstName, LastName, birthDate, address, email, salary, hoursAvailable, roleID, DepartmentID, contract);
            staffMember.editStaffMember(FirstName, LastName, birthDate, address, email, salary, hoursAvailable, role, contract);

            MessageBox.Show("Staff member edited successfully");
            this.Close();
        }
Пример #3
0
        /**
         * Method to user update profile
         */
        public void updateProfile(Staff memberToChange, String FirstName, String LastName, DateTime birthDate, String address, String email)
        {
            MySqlConnection conn = new MySqlConnection(connString);

            // Open connection
            conn.Open();
            MySqlCommand cmd = conn.CreateCommand();

            cmd.CommandText = "UPDATE person SET Firstname = @Firstname, Lastname = @Lastname, Age = @Age, Address = @Address, Email = @Email WHERE Id = @Id";
            cmd.Parameters.AddWithValue("@Firstname", FirstName);
            cmd.Parameters.AddWithValue("@Lastname", LastName);
            cmd.Parameters.AddWithValue("@Age", birthDate);
            cmd.Parameters.AddWithValue("@Address", address);
            cmd.Parameters.AddWithValue("@Email", email);
            cmd.Parameters.AddWithValue("@Id", memberToChange.dbID);

            cmd.ExecuteNonQuery();

            memberToChange.editStaffMember(FirstName, LastName, birthDate, address, email);
        }