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)) // return; int iPrivilege = 0; //default previlege string password = ""; bool Enabled = true; //Enabled by default int FingerIndex = 0; DateTime start = DateTime.Now; foreach (string usr in Lines) { string[] details = usr.Split(','); // SSR_SetUserInfo not working if (axCZKEM1.SSR_SetUserInfo(machineno, details[0], details[1], password, iPrivilege, Enabled))//upload user information to the memory { axCZKEM1.SetUserTmpExStr(machineno, details[0], FingerIndex, 1, details[2].Trim()); } } DateTime end = DateTime.Now; TimeSpan span = (end - start); string time = String.Format("it took {0} minutes, {1} seconds", span.Minutes, span.Seconds); //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!\n" + time); }
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!"); }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { string marca = this.GridView1.SelectedDataKey["MARCA"].ToString(); string nume = this.GridView1.SelectedRow.Cells[1].Text.ToString(); string card = this.GridView1.SelectedRow.Cells[5].Text.ToString(); zkemkeeper.CZKEM aa = new zkemkeeper.CZKEM(); Literal2.Text = ""; if (aa.Connect_Net("10.10.13.10", 4370)) { Literal2.Text = Literal2.Text + " " + "Conectat..."; //aa.SetStrCardNumber(""); if (aa.SetStrCardNumber(card)) { Literal2.Text = Literal2.Text + " " + "actualizat card :" + card; } else { Literal2.Text = Literal2.Text + " " + "EROARE actualizare card " + card; } if (aa.SSR_SetUserInfo(1, marca, nume, "", 0, true)) { Literal2.Text = Literal2.Text + " " + "actualizat " + marca + " " + nume; } else { Literal2.Text = Literal2.Text + " " + "EROARE actualizare " + marca + " " + nume; } aa.Disconnect(); } else { Literal2.Text = "nu m-am putrut conecta la aparat"; } }