/// <summary> /// 增加识别器 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void simpleButtonOk_Click(object sender, EventArgs e) { if (!dxValidationProvider1.Validate()) { return; } RecognizerInfo ri = new RecognizerInfo(); ri.Id = Id; ri.Name = textEditname.Text; ri.Port = int.Parse(textEditport.Text); ri.Ip = textEditIp.Text; ri.MaxRecogNumber = int.Parse(textEditmax.Text); if (comboBoxEdit_Type.Text == "Event") ri.RecogType = (int)E_Type.E_Event; if (comboBoxEdit_Type.Text == "Vehicle") ri.RecogType = (int)E_Type.E_Vehicle; if (comboBoxEdit_Type.Text == "Face") ri.RecogType = (int)E_Type.E_Face; switch (Opt) { case Util.Operateion.Add: RecognizerBusiness.Instance.Insert(ref errMessage, ri); OperateLog ol = new OperateLog { HappenTime = DateTime.Now, OperateTypeId = (int)(OperateLogTypeId.RecognizerAdd), OperateTypeName = OperateLogTypeName.RecognizerAdd, Content = ri.ToString(), Id = ri.Id, OperateUserName = MainForm.CurrentUser.UserName, ClientUserName = MainForm.CurrentUser.UserName, ClientUserId = MainForm.CurrentUser.UserId }; OperateLogBusiness.Instance.Insert(ref errMessage, ol); break; case Util.Operateion.Update: ri = RecognizerBusiness.Instance.GetRecognizerInfoByRecognizerId(ref errMessage,Id); ri.Name = textEditname.Text; ri.Port = int.Parse(textEditport.Text); ri.Ip = textEditIp.Text; ri.MaxRecogNumber = int.Parse(textEditmax.Text); Id = RecognizerBusiness.Instance.Update(ref errMessage, ri); OperateLogBusiness.Instance.Insert(ref errMessage, new OperateLog { HappenTime = DateTime.Now, OperateTypeId = (int)(OperateLogTypeId.RecognizerUpdate), OperateTypeName = OperateLogTypeName.RecognizerUpdate, Content = ri.ToString(), Id = ri.Id, OperateUserName = MainForm.CurrentUser.UserName, ClientUserName = MainForm.CurrentUser.UserName, ClientUserId = MainForm.CurrentUser.UserId }); break; case Util.Operateion.Delete: break; default: break; } Close(); Dispose(); }