// 定义一个全局变量: 通道编号 /// <summary> /// Load 加载 事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FVNForm_Load(object sender, EventArgs e) { try { userContext(); btnUpdate.Enabled = false; btnSelect_Click(btnSelect, null); mf = new MainForm(); LoadData(); // 调用显示DatagridView的方法 BindMenGang(); // 调用绑定门岗的方法 BindFVN(); BindSearchFVN(); BindFVNType(); BindSearchFVNType(); BindMenGang1(); DrivewayName(); if (iFvnID > 0) { // 若通道管理界面中有选择“通道”再跳转的,则显示如下 Expression <Func <View_DrivewayPosition, bool> > funviewinto = n => n.Driveway_ID == iFvnID; foreach (var n in DrivewayDAL.Query(funviewinto)) { if (n.Position_Name != null && n.Driveway_Name != null) { this.cbxPositionName.Text = n.Position_Name; this.cbxDrivewayName.Text = n.Driveway_Name + n.Driveway_Type; //string PName = n.Position_Name; //获取数据库读取到的门岗名称 //string DName = n.Driveway_Name; //var name = DrivewayDAL.GetViewDrivewayName(String.Format("select * from View_DrivewayPosition where Position_Name='{0}' and Driveway_Name='{1}'", PName, DName)); //if (name != null) //{ // foreach (var item in name) // { // if (item.Driveway_Name != null) // { // if (item.Driveway_Type != null) // { // this.cbxDrivewayName.Text = item.Driveway_Name + item.Driveway_Type; // cbxDrivewayName.SelectedIndex = 0; // } // } // } //} } } } } catch { MessageBox.Show("加载地感信息有误,请查看与地感相关的信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
/// <summary> /// 修改查重 /// </summary> /// <returns></returns> private bool btnCheckupdate() { bool rbool = true; try { //定义字段用以保存门岗名称和通道值,读卡器编号 string Position_Name = this.cbxDriveway_PositionName.Text; //门岗名称 string Driveway_Value = this.txtDriveway_Value.Text.Trim(); //通道值 string Driveway_Name = this.txtDriveway_Name.Text.Trim(); string Driveway_ReadCardPort = this.txtDriveway_ReadCardPort.Text.Trim(); //通道读卡器地址码 //判断名称是否已存在 Expression <Func <View_DrivewayPosition, bool> > funviewPosition = n => n.Position_Name == Position_Name && n.Driveway_Value == Driveway_Value && n.Driveway_Value != this.dgvDrivewayList.SelectedRows[0].Cells["Driveway_Value"].Value.ToString(); if (DrivewayDAL.Query(funviewPosition).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该通道值已存在", txtDriveway_Value, this); txtDriveway_Value.Focus(); rbool = false;; } Expression <Func <View_DrivewayPosition, bool> > funviewPosition2 = n => n.Position_Name == Position_Name && n.Driveway_Name == Driveway_Name && n.Driveway_Value != this.dgvDrivewayList.SelectedRows[0].Cells["Driveway_Value"].Value.ToString(); if (DrivewayDAL.Query(funviewPosition2).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该通道名称已存在", txtDriveway_Value, this); txtDriveway_Value.Focus(); rbool = false;; } Expression <Func <View_DrivewayPosition, bool> > funviewPosition1 = n => n.Position_Name == Position_Name && n.Driveway_ReadCardPort == Driveway_ReadCardPort && n.Driveway_ReadCardPort != this.dgvDrivewayList.SelectedRows[0].Cells["Driveway_ReadCardPort"].Value.ToString(); if (DrivewayDAL.Query(funviewPosition1).Count() > 0) { PublicClass.ShowToolTip(ToolTipIcon.Info, "提示", "该通道读卡器地址码已存在", txtDriveway_ReadCardPort, this); txtDriveway_ReadCardPort.Focus(); rbool = false;; } return(rbool); } catch { CommonalityEntity.WriteTextLog("通道管理 btnCheck()"); rbool = false; } return(rbool); }
/// <summary> /// Load 加载事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CameraForm_Load(object sender, EventArgs e) { try { userContext(); btnUpdate.Enabled = false; btnSelect_Click(btnSelect, null); BindCamera(); BindSearchCamera(); BindCameraLoca(); BindCameraLocaSearch(); BindMenGang(); // 调用绑定门岗的方法 BindMenGang1(); DrivewayName(); cmbDVI.SelectedIndex = 0; mf = new MainForm(); LoadData(); // 调用显示DatagridView的方法 if (iCameraID > 0) { // 若通道管理界面中有选择“通道”再跳转的,则显示如下 Expression <Func <View_DrivewayPosition, bool> > funviewinto = n => n.Driveway_ID == iCameraID; foreach (var n in DrivewayDAL.Query(funviewinto)) { if (n.Position_Name != null) { this.cbxPositionName.Text = n.Position_Name; this.cbxDrivewayName.Text = n.Driveway_Name + n.Driveway_Type; string PName = n.Position_Name; //获取数据库读取到的门岗名称 } } } } catch { MessageBox.Show("加载摄像头管理信息有误,请查看相关信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
/// <summary> /// 双击组件时发生 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvDrivewayList_DoubleClick(object sender, EventArgs e) { boo = false; this.btnUpdate.Enabled = true; this.btnSave.Enabled = false; if (this.dgvDrivewayList.SelectedRows.Count > 0)//选中行 { if (dgvDrivewayList.SelectedRows.Count > 1) { MessageBox.Show("修改只能选中一行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { //修改的值 int ID = int.Parse(this.dgvDrivewayList.SelectedRows[0].Cells["Driveway_ID"].Value.ToString()); Expression <Func <View_DrivewayPosition, bool> > funviewinto = n => n.Driveway_ID == ID; foreach (var n in DrivewayDAL.Query(funviewinto)) { if (n.Driveway_Name != null) { //通道名称 this.txtDriveway_Name.Text = n.Driveway_Name; } if (n.Driveway_Value != null) { // 通道值 this.txtDriveway_Value.Text = n.Driveway_Value; } if (n.Driveway_State != null) { // 通道状态 this.cbxDriveway_State.Text = n.Driveway_State; } if (n.Driveway_Type != null) { // 通道类型 this.cbxDriveway_Type.Text = n.Driveway_Type; } if (n.Driveway_WarrantyState != null) { // 通道报修状态 this.comboxDriveway_WarrantyState.Text = n.Driveway_WarrantyState; bdwayState = n.Driveway_WarrantyState; } if (n.Driveway_Remark_Driveway_ID != null) { // 通道备用管理编号 this.cobReserve.SelectedValue = n.Driveway_Remark_Driveway_ID.ToString(); } if (n.Position_Name != null) { // 门岗名称 this.cbxDriveway_PositionName.Text = n.Position_Name; } //if (n.Driveway_UserId != null) //{ // // 通道创建人 // this.txtDriveway_UserId.Text = n.Driveway_UserId; //} //if (n.Driveway_CreatTime != null) //{ // // 通道创建时间 // this.txtDriveway_Remark.Text = n.Driveway_CreatTime.ToString(); //} if (n.Driveway_Address != null) { // 通道地址名称 this.cbodizhima.Text = n.Driveway_Address; } if (n.Driveway_ReadCardPort != null) { // 通道读卡器地址码 this.txtDriveway_ReadCardPort.Text = n.Driveway_ReadCardPort; } if (n.Driveway_CloseAddress != null) { cbmcloseAdd.Text = n.Driveway_CloseAddress; } if (n.Driveway_Remark != null) { // 通道备注 this.txtDriveway_Remark.Text = n.Driveway_Remark; } break; } } } else { MessageBox.Show("请选择要修改的行!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } boo = true; }