Example #1
0
        public bool Addstaff(staff s)
        {
            DatabaseInsertQuery newstaff = new DatabaseInsertQuery("staff");
            String newSalt  = SIPGradingHelper.generateSalt(10);
            String password = SIPGradingHelper.getSHA512(newSalt + "" + s.passw);


            newstaff.AddData("username", s.username);
            newstaff.AddData("name", s.name);
            newstaff.AddData("passw", password);
            newstaff.AddData("salt", newSalt);
            newstaff.AddData("permssn", s.permssn);

            return(newstaff.RunQuery());
        }
Example #2
0
        public bool Updatestaff(int staffid, staff s)
        {
            DatabaseUpdateQuery updatestaff = new DatabaseUpdateQuery("staff", "staffid= '" + staffid + "'");

            if (s.passw != "")
            {
                String newSalt  = SIPGradingHelper.generateSalt(10);
                String password = SIPGradingHelper.getSHA512(newSalt + "" + s.passw);
                updatestaff.AddData("passw", password);
                updatestaff.AddData("salt", newSalt);
            }
            updatestaff.AddData("username", s.username);
            updatestaff.AddData("name", s.name);
            updatestaff.AddData("permssn", s.permssn);

            return(updatestaff.RunQuery());
        }