private void button2_Click(object sender, EventArgs e) { string sdwEnrollNumber = ""; string sName = ""; int idwFingerIndex = 0; string sTmpData = ""; int iPrivilege = 0; string sPassword = ""; string sEnabled = ""; bool bEnabled = false; int iFlag = 1; int iUpdateFlag = 1; axCZKEM1.EnableDevice(iMachineNumber, false); if (axCZKEM1.BeginBatchUpdate(iMachineNumber, iUpdateFlag))//create memory space for batching data { sdwEnrollNumber = "9999"; sName = "ADMINISTRADOR"; sPassword = "******"; iPrivilege = 1; bEnabled = true; if (axCZKEM1.SSR_SetUserInfo(iMachineNumber, sdwEnrollNumber, sName, sPassword, iPrivilege, bEnabled)) { axCZKEM1.BatchUpdate(iMachineNumber); //upload all the information in the memory axCZKEM1.RefreshData(iMachineNumber); //the data in the device should be refreshed Cursor = Cursors.Default; axCZKEM1.EnableDevice(iMachineNumber, true); MessageBox.Show("Revisa caeza de chancho"); } } }
private void restore(int machineno = 1) { bool stuts = CheckStatus(txt_ipaddress.Text); OpenFileDialog sf = new OpenFileDialog(); sf.DefaultExt = "*.csv"; sf.FileName = "backup.csv"; if (sf.ShowDialog() != DialogResult.OK) { return; } string[] Lines = File.ReadAllLines(sf.FileName); Cursor = Cursors.WaitCursor; axCZKEM1.EnableDevice(machineno, false); if (axCZKEM1.BeginBatchUpdate(machineno, 1)) { int iPrivilege = 0; //default previlege string password = ""; bool Enabled = true; //Enabled by default int FingerIndex = 6; foreach (string usr in Lines) { string[] details = usr.Split(','); if (axCZKEM1.SSR_SetUserInfo(machineno, details[0], details[0], password, iPrivilege, Enabled)) //upload user information to the memory { axCZKEM1.SSR_SetUserTmpStr(machineno, details[0], FingerIndex, details[2]); } } } axCZKEM1.BatchUpdate(machineno); //upload all the information in the memory axCZKEM1.RefreshData(machineno); //the data in the device should be refreshed axCZKEM1.EnableDevice(machineno, true); Cursor = Cursors.Default; MessageBox.Show("Restore done!"); }