public static void download(Model.fingerprint fingerprint) { //实例化指纹验证对象 Printer p = PrinterInstance.getInstance().getPrinter(); Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint(); //p.OpenPort(); int userId = fingerprint.ID; string print = System.Text.Encoding.Default.GetString(fingerprint.USER_FINGERPRINT); string[] pr = print.Split(' '); byte[] finger = new byte[1600]; for (int i = 0; i < pr.Length - 1; i++) { finger[i] = Convert.ToByte(pr[i], 16); } //System.Windows.Forms.MessageBox.Show(fingerByte.Length.ToString()); //下载用户 bool isDownloadUser = false; List <Model.fingerprint> list = fingerPrint_bll.GetModelList("USER_POLICENUMB = " + fingerprint.USER_POLICENUMB); foreach (Model.fingerprint fi in list) { if (fi.IS_UPDATE == 1) { isDownloadUser = true; break; } } if (!isDownloadUser) { p.downloadUser((byte)userId); //while (true) //{ // if (p.Downuserbool) // { // fingerprint.IS_UPDATE = 1; // fingerPrint_bll.Update(fingerprint); // p.Downuserbool = false; // System.Windows.Forms.MessageBox.Show("用户下载成功"); // break; // } //} } //下载指纹 p.downloadfinger(finger, (byte)userId); //while (true) //{ // if (p.Downprinterbool) // { // System.Windows.Forms.MessageBox.Show("指纹下载成功!"); // break; // } //} }
public static void input(Model.fingerprint fingerprint, byte[] finger) { //实例化指纹验证对象 Printer p = PrinterInstance.getInstance().getPrinter(); Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint(); //p.OpenPort(); int userId = fingerprint.ID; //下载用户 //System.Windows.Forms.MessageBox.Show("开始下载用户"); p.downloadUser((byte)userId); while (true) { if (p.Downuserbool) { p.Downuserbool = false; System.Windows.Forms.MessageBox.Show("用户下载成功"); break; } if (!p.DownuserFail) { System.Windows.Forms.MessageBox.Show("用户下载失败"); p.DownuserFail = true; break; } } //System.Threading.Thread.Sleep(5000); //if (p.GetDownuserbool()) //{ // p.Downuserbool = false; // System.Windows.Forms.MessageBox.Show("用户下载成功"); //} //else //{ // System.Windows.Forms.MessageBox.Show("用户下载失败"); //} //下载指纹 //System.Windows.Forms.MessageBox.Show("开始下载用户"); p.downloadfinger(finger, (byte)userId); while (true) { if (p.Downprinterbool) { p.Downprinterbool = false; System.Windows.Forms.MessageBox.Show("指纹录入成功!"); break; } if (!p.DownprinterFail) { p.DownprinterFail = true; System.Windows.Forms.MessageBox.Show("指纹录入失败"); break; } } }
public static void download(Model.fingerprint fingerprint) { //实例化指纹验证对象 Printer p = PrinterInstance.getInstance().getPrinter(); Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint(); //p.OpenPort(); int userId = fingerprint.ID; string print = System.Text.Encoding.Default.GetString(fingerprint.USER_FINGERPRINT); string[] pr = print.Split(' '); byte[] finger = new byte[1600]; for (int i = 0; i < pr.Length - 1; i++) { finger[i] = Convert.ToByte(pr[i], 16); } //System.Windows.Forms.MessageBox.Show(fingerByte.Length.ToString()); //下载用户 bool isDownloadUser = false; List<Model.fingerprint> list = fingerPrint_bll.GetModelList("USER_POLICENUMB = "+fingerprint.USER_POLICENUMB); foreach(Model.fingerprint fi in list) { if (fi.IS_UPDATE == 1) { isDownloadUser = true; break; } } if (!isDownloadUser) { p.downloadUser((byte)userId); //while (true) //{ // if (p.Downuserbool) // { // fingerprint.IS_UPDATE = 1; // fingerPrint_bll.Update(fingerprint); // p.Downuserbool = false; // System.Windows.Forms.MessageBox.Show("用户下载成功"); // break; // } //} } //下载指纹 p.downloadfinger(finger, (byte)userId); //while (true) //{ // if (p.Downprinterbool) // { // System.Windows.Forms.MessageBox.Show("指纹下载成功!"); // break; // } //} }
public static void input(Model.fingerprint fingerprint, byte[] finger) { //实例化指纹验证对象 Printer p = PrinterInstance.getInstance().getPrinter(); Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint(); //p.OpenPort(); int userId = fingerprint.ID; //下载用户 //System.Windows.Forms.MessageBox.Show("开始下载用户"); p.downloadUser((byte)userId); while (true) { if (p.Downuserbool) { p.Downuserbool = false; System.Windows.Forms.MessageBox.Show("用户下载成功"); break; } if (!p.DownuserFail) { System.Windows.Forms.MessageBox.Show("用户下载失败"); p.DownuserFail = true; break; } } //System.Threading.Thread.Sleep(5000); //if (p.GetDownuserbool()) //{ // p.Downuserbool = false; // System.Windows.Forms.MessageBox.Show("用户下载成功"); //} //else //{ // System.Windows.Forms.MessageBox.Show("用户下载失败"); //} //下载指纹 //System.Windows.Forms.MessageBox.Show("开始下载用户"); p.downloadfinger(finger, (byte)userId); while (true) { if (p.Downprinterbool) { p.Downprinterbool = false; System.Windows.Forms.MessageBox.Show("指纹录入成功!"); break; } if(!p.DownprinterFail) { p.DownprinterFail = true; System.Windows.Forms.MessageBox.Show("指纹录入失败"); break; } } }
public static void analysis(WebService.synInfo synInfo) { WebService.gunServices webService = SingleWebService.getWebService(); #region model Model.gunark gunark = new Gunark.Model.gunark(); Model.user user = new Gunark.Model.user(); Model.group group = new Gunark.Model.group(); Model.gbg gbg = new Gunark.Model.gbg(); Model.fingerprint fingerPrint = new Gunark.Model.fingerprint(); #endregion model #region bll Bll.user user_bll = new Gunark.BLL.user(); Bll.gunark gunark_bll = new Gunark.BLL.gunark(); Bll.group group_bll = new Gunark.BLL.group(); Bll.gbg gbg_bll = new Gunark.BLL.gbg(); Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint(); #endregion bll #region attritubes string[] attritubes = null; #endregion attritubes #region 同步类型 switch (synInfo.syn_Type) { #region 枪柜 case "枪柜信息增加"://通过 gunark = analysisGunark(synInfo.syn_Param); gunark_bll.Add(gunark); //获取枪弹绑定关系 attritubes = synInfo.syn_Param.Split('|'); WebService.gunarkGroupGunBullet[] gggb = webService.getGunarkGroupGunBullet(attritubes[0]); for (int i = 0; i < gggb.Length; i++) { Model.gbg ggbg = new Gunark.Model.gbg(); gbg.GGGBID = gggb[i].gggbId; gbg.GROUP_ID = gggb[i].groupId; gbg.GUN_LOCATION = gggb[i].gunLocation; gbg.GUNARK_ID = gggb[i].gunarkId; gbg.BULLET_LOCATION = int.Parse(gggb[i].bulletLocation); gbg_bll.Add(gbg); } break; case "枪柜信息修改"://未通过 gunark = analysisGunark(synInfo.syn_Param); gunark_bll.Update(gunark); break; case "注销"://未通过 attritubes = synInfo.syn_Param.Split('|'); gunark = gunark_bll.GetModel(attritubes[0]); gunark.GUNARK_STATUS = 0; gunark_bll.Update(gunark); break; case "是否枪弹对应"://未通过 break; case "是否使用组权限"://未通过 break; #endregion 枪柜 #region 用户(用户绑定组未通过【寄存组有问题】、新增枪柜增加用户) case "增加用户": user = analysisUser(synInfo.syn_Param); user_bll.Add(user); break; case "更新用户": user = analysisUser(synInfo.syn_Param); user_bll.Update(user); break; case "枪柜增加用户": analysisUser1(synInfo.syn_Param); break; #endregion 用户 #region 组信息(组增加已通过、新增枪柜增加组) case "增加班组": group = analysisGroup(synInfo.syn_Param); group_bll.Add(group); break; case "组注销": attritubes = synInfo.syn_Param.Split('|'); group = group_bll.GetModel(attritubes[0]); group_bll.Update(group); break; case "枪柜增加组": analysisGroup1(synInfo.syn_Param); break; #endregion 组信息 #region 枪弹组绑定关系(未测试) case "枪柜对应修改": attritubes = synInfo.syn_Param.Split('|'); gbg = gbg_bll.GetModel(attritubes[0]); gbg.GUN_LOCATION = int.Parse(attritubes[2]); gbg.BULLET_LOCATION = int.Parse(attritubes[3]); gbg_bll.Update(gbg); break; case "枪位所属组修改": attritubes = synInfo.syn_Param.Split('|'); gbg = gbg_bll.GetModelByGunPos(attritubes[0], attritubes[1]); gbg.GROUP_ID = attritubes[2]; gbg_bll.Update(gbg); break; #endregion 枪弹组绑定关系 #region 指纹信息(未测试) case "指纹增加": fingerPrint = analysisFingerPrint(synInfo.syn_Param); fingerPrint_bll.Add(fingerPrint); break; case "指纹修改": //通过USER_ID查 fingerPrint = fingerPrint_bll.GetModelByUser(attritubes[1], attritubes[4]); fingerPrint.USER_FINGERPRINT = StrToByte(attritubes[6]); fingerPrint.USER_BAN = int.Parse(attritubes[7]); fingerPrint_bll.Update(fingerPrint); break; #endregion 指纹信息 #region 增加任务(测试通过) case "增加任务": addTask(synInfo.syn_Param); break; #endregion 增加任务 default: break; } #endregion 同步类型 }
public static void analysis(WebService.synInfo synInfo) { WebService.gunServices webService = SingleWebService.getWebService(); #region model Model.gunark gunark = new Gunark.Model.gunark(); Model.user user = new Gunark.Model.user(); Model.group group = new Gunark.Model.group(); Model.gbg gbg = new Gunark.Model.gbg(); Model.fingerprint fingerPrint = new Gunark.Model.fingerprint(); #endregion model #region bll Bll.user user_bll = new Gunark.BLL.user(); Bll.gunark gunark_bll = new Gunark.BLL.gunark(); Bll.group group_bll = new Gunark.BLL.group(); Bll.gbg gbg_bll = new Gunark.BLL.gbg(); Bll.fingerprint fingerPrint_bll = new Gunark.BLL.fingerprint(); #endregion bll #region attritubes string[] attritubes = null; #endregion attritubes #region 步类型 switch (synInfo.syn_Type) { #region 枪柜 case "枪柜信息增加": //通过 gunark = analysisGunark(synInfo.syn_Param); gunark_bll.Add(gunark); //获取枪弹绑定关系 attritubes = synInfo.syn_Param.Split('|'); WebService.gunarkGroupGunBullet[] gggb = webService.getGunarkGroupGunBullet(attritubes[0]); for (int i = 0; i < gggb.Length; i++) { Model.gbg ggbg = new Gunark.Model.gbg(); gbg.GGGBID = gggb[i].gggbId; gbg.GROUP_ID = gggb[i].groupId; gbg.GUN_LOCATION = gggb[i].gunLocation; gbg.GUNARK_ID = gggb[i].gunarkId; gbg.BULLET_LOCATION = int.Parse(gggb[i].bulletLocation); gbg_bll.Add(gbg); } break; case "枪柜信息修改": //未通过 gunark = analysisGunark(synInfo.syn_Param); gunark_bll.Update(gunark); break; case "注销": //未通过 attritubes = synInfo.syn_Param.Split('|'); gunark = gunark_bll.GetModel(attritubes[0]); gunark.GUNARK_STATUS = 0; gunark_bll.Update(gunark); break; case "是否枪弹对应": //未通过 break; case "是否使用组权限": //未通过 break; #endregion 枪柜 #region 用户(用户绑定组未通过【寄存组有问题】、新增枪柜增加用户) case "增加用户": user = analysisUser(synInfo.syn_Param); user_bll.Add(user); break; case "更新用户": user = analysisUser(synInfo.syn_Param); user_bll.Update(user); break; case "枪柜增加用户": analysisUser1(synInfo.syn_Param); break; #endregion 用户 #region 组信息(组增加已通过、新增枪柜增加组) case "增加班组": group = analysisGroup(synInfo.syn_Param); group_bll.Add(group); break; case "组注销": attritubes = synInfo.syn_Param.Split('|'); group = group_bll.GetModel(attritubes[0]); group_bll.Update(group); break; case "枪柜增加组": analysisGroup1(synInfo.syn_Param); break; #endregion 组信息 #region 枪弹组绑定关系(未测试) case "枪柜对应修改": attritubes = synInfo.syn_Param.Split('|'); gbg = gbg_bll.GetModel(attritubes[0]); gbg.GUN_LOCATION = int.Parse(attritubes[2]); gbg.BULLET_LOCATION = int.Parse(attritubes[3]); gbg_bll.Update(gbg); break; case "枪位所属组修改": attritubes = synInfo.syn_Param.Split('|'); gbg = gbg_bll.GetModelByGunPos(attritubes[0], attritubes[1]); gbg.GROUP_ID = attritubes[2]; gbg_bll.Update(gbg); break; #endregion 枪弹组绑定关系 #region 指纹信息(未测试) case "指纹增加": fingerPrint = analysisFingerPrint(synInfo.syn_Param); fingerPrint_bll.Add(fingerPrint); break; case "指纹修改": //通过USER_ID查 fingerPrint = fingerPrint_bll.GetModelByUser(attritubes[1], attritubes[4]); fingerPrint.USER_FINGERPRINT = StrToByte(attritubes[6]); fingerPrint.USER_BAN = int.Parse(attritubes[7]); fingerPrint_bll.Update(fingerPrint); break; #endregion 指纹信息 #region 增加任务(测试通过) case "增加任务": addTask(synInfo.syn_Param); break; #endregion 增加任务 default: break; } #endregion 步类型 }