IZKEM does not add user - zkemkeeper not add user

945 views Asked by At

I have tried to register a person from the code, but always the result of the objZkeeperalways returns false and I don't know what to do help:

Hide Copy Code

   objZkeeper = new zkCliente(RaiseDeviceEvent);
   int MachineNumber = 1;
   int dwEnrollNumbre = 1;
   string EnrollNumber = "3";
   string Name = "Mich";
   string Password = "123";
   int Privilege = 1;
   bool Enabled = true;


   bool result = objZkeeper.SetUserInfo(MachineNumber, dwEnrollNumbre, Name, Password, Privilege, Enabled);
    if (result == true)
   {
       MessageBox.Show("Ok");

   }
   else
   {
       MessageBox.Show("Not Ok :c");
   }

ZkClient

Hide Copy Code

public bool SetUserInfo(int dwMachineNumber, int dwEnrollNumber, string Name, string Password, int Privilege, bool Enabled)
   {
          
 return objCZKEM.SetUserInfo(dwMachineNumber, dwEnrollNumber, Name, Password, Privilege, Enabled);
   }
1

There are 1 answers

1
mhmd.tuhami On
int iMachineNumber = Convert.ToInt32(txtMachineNumber.Text);
int idwErrorCode = 0;
bool bEnabled = true;
string sdwEnrollNumber = employee.EmployeeID_PK.ToString();
string sName = EmpName.Text;
string sPassword = txtPassUser.Text;
int iPrivilege = 0;
string sCardnumber = "0";
objZkeeper.EnableDevice(iMachineNumber, false);
objZkeeper.SetStrCardNumber(sCardnumber);
if (objZkeeper.SSR_SetUserInfo(iMachineNumber, sdwEnrollNumber, sName, sPassword, iPrivilege, bEnabled))//upload the user's information(card number included)
{
    MessageBox.Show("Add succesful");
}
else
{
    objZkeeper.GetLastError(ref idwErrorCode);
    MessageBox.Show("Operation failed,ErrorCode=" + idwErrorCode.ToString(), "Error");
}
objZkeeper.RefreshData(iMachineNumber);
objZkeeper.EnableDevice(iMachineNumber, true);