private void btn_Del_Click(object sender, EventArgs e) { if (this.deviceAuthorizeList.SelectedRows.Count <= 0) { MessageBox.Show("请选择要删除的车辆"); return; } else { if (MessageBox.Show("确定要将车辆" + deviceAuthorizeList.SelectedRows[0].Cells[1].Value + "从设备" + lab_DeviceName + "删除?", "删除权限", MessageBoxButtons.YesNo) == DialogResult.No) { return; } DAL.DAL_Authorize authrize = new DAL.DAL_Authorize(); if (authrize.DeleteCustomerAuthrize(deviceAuthorizeList.SelectedRows[0].Cells[0].Value.ToString())) { MessageBox.Show("删除权限成功!"); GetDeviceAuthrizeList(""); } else { MessageBox.Show("删除权限失败!"); } } }
private void btn_Add_Click(object sender, EventArgs e) { string selectgroupid = ""; string authorizeendtime = ""; if (SelectGroupGrid.SelectedRows.Count <= 0) { MessageBox.Show("请选择要添加到设备权限的群组"); return; } if (SelectGroupGrid.SelectedRows != null) { if (MessageBox.Show("确定要将群组" + SelectGroupGrid.SelectedRows[0].Cells[1].Value.ToString() + "添加到设备" + lab_DeviceName.Text + "的权限中吗?", "添加权限", MessageBoxButtons.YesNo) == DialogResult.No) { return; } selectgroupid = this.SelectGroupGrid.SelectedRows[0].Cells[0].ToString(); } DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize(); if (authorizedal.InsertGroupAuthrize(selectgroupid, this.deviceid, authorizeendtime)) { MessageBox.Show("添加权限成功!"); GetDeviceAuthorizeList(""); } else { MessageBox.Show("添加权限失败!"); } }
public void RecvData(string recv) { if (recv.Contains("PNO") && recv.Contains("IP")) { DAL.DAL_Authorize _Authorizedao = new DAL.DAL_Authorize(); DAL.DAL_Log _logdal = new DAL.DAL_Log(); string No = recv.Substring(recv.IndexOf("NO") + 2, recv.IndexOf("IP") - recv.IndexOf("NO") - 2); string IP = recv.Substring(recv.IndexOf("IP") + 2, recv.Length - recv.IndexOf("IP") - 2); if (_Authorizedao.CheckPassengerWithDevice(No, IP)) { DAL.DAO.CustomerDao customerdao = (new DAL.DAL_CustomerInfo()).selectCustomerInfoWithCardNum(No); DAL.DAO.DeviceDao devcedao = (new DAL.DAL_Device()).selectDeviceInfoWithIP(IP); string positiondirection = (new DAL.DAL_Position()).GetPositionDirection(devcedao.Deviceposition); int positionid = (new DAL.DAL_Position()).GetPositionID(devcedao.Deviceposition); if (positiondirection == "0") { _logdal.Inster_Log(devcedao.Deviceposition + "位置进门", 0, positionid, No, (int)(DateTime.Now - DateTime.Parse("1970-1-1 00:00:00")).TotalSeconds, DateTime.Now, "卡号" + No + "的用户通过验证"); this.Invoke(new Action(() => { peopleGetin(customerdao.Name, customerdao.Idcard); })); } else if (positiondirection == "1") { _logdal.Inster_Log(devcedao.Deviceposition + "位置出门", 1, positionid, No, (int)(DateTime.Now - DateTime.Parse("1970-1-1 00:00:00")).TotalSeconds, DateTime.Now, "卡号" + No + "的用户通过验证"); } } } }
private void GetDeviceAuthrizeList(string Key) { this.deviceAuthorizeList.DataSource = null; DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize(); DataTable _dt = authorizedal.GetDeviceVehicleAuthorize(this.deviceid, Key); if (_dt != null) { this.deviceAuthorizeList.DataSource = _dt; } }
private void btn_Add_Click(object sender, EventArgs e) { string authorizeendtime = ""; string vehicleid = ""; if (SelectVehicleGrid.SelectedRows.Count <= 0) { MessageBox.Show("请选择要添加到设备的人员"); return; } if (SelectVehicleGrid.SelectedRows != null) { if (MessageBox.Show("确定要将车辆" + SelectVehicleGrid.SelectedRows[0].Cells[1].Value.ToString() + "添加到设备" + lab_DeviceName.Text + "的权限中吗?", "添加权限", MessageBoxButtons.YesNo) == DialogResult.No) { return; } if (SelectVehicleGrid.SelectedRows[0].Cells[1].Value.ToString() == "临时车辆") { MessageBox.Show("临时车辆必须设定权限时间"); AuthorizeTimeForm _form = new AuthorizeTimeForm(); if (_form.ShowDialog() == DialogResult.OK) { authorizeendtime = _form.Selecttime.ToString(); } else { return; } } vehicleid = SelectVehicleGrid.SelectedRows[0].Cells[0].Value.ToString(); } DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize(); if (authorizedal.InsertVehicleAuthrize(vehicleid, this.deviceid, authorizeendtime)) { MessageBox.Show("添加权限成功!"); GetDeviceAuthrizeList(""); } else { MessageBox.Show("添加权限失败!"); } }
private void GetGroupAuthrize() { DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize(); DataTable _dt = authorizedal.GetGroupAuthorize(groupid); if (_dt != null) { AuthrizeGroupHave.DataSource = _dt; } _dt = authorizedal.GetGroupNotHaveAuthrize(groupid); if (_dt != null) { AuthrizeCanGive.DataSource = _dt; } }
private void GetVehicleAuthrize() { DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize(); DataTable _dt = authorizedal.GetVehicleAuthorize(vehicleid); if (_dt != null) { AuthrizeUserHave.DataSource = _dt; } _dt = authorizedal.GetVehicleNotHaveAuthrize(vehicleid); if (_dt != null) { AuthrizeCanGive.DataSource = _dt; } }
private void GetDeviceAuthorizeList(string Key) { DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize(); DataTable _dt = authorizedal.GetDeviceGroupAuthorize(this.deviceid); if (_dt != null) { this.deviceAuthorizeList.DataSource = _dt; } _dt = authorizedal.GetDevcieCanRelationGroup(this.deviceid); if (_dt != null) { this.SelectGroupGrid.DataSource = _dt; } }
private void btn_DeleteAuthrize_Click(object sender, EventArgs e) { if (AuthrizeGroupHave.SelectedRows != null) { if (MessageBox.Show("你确定要为分组" + lab_groupname.Text + "删除设备:" + AuthrizeGroupHave.SelectedRows[0].Cells[1].Value + "的权限吗?", "添加权限", MessageBoxButtons.YesNo) == DialogResult.Yes) { DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize(); if (authorizedal.DeleteGroupAuthrize(AuthrizeGroupHave.SelectedRows[0].Cells[0].Value.ToString())) { MessageBox.Show("删除成功"); GetGroupAuthrize(); } else { MessageBox.Show("删除失败"); } } } }
private void btn_AddAuthrize_Click(object sender, EventArgs e) { if (AuthrizeCanGive.SelectedRows != null) { if (MessageBox.Show("你确定要为分组" + lab_groupname.Text + "添加设备:" + AuthrizeCanGive.SelectedRows[0].Cells[1].Value + "的权限吗?", "添加权限", MessageBoxButtons.YesNo) == DialogResult.Yes) { string authorizeendtime = ""; if (usertype == "临时用户") { MessageBox.Show("临时用户必须设定权限时间"); AuthorizeTimeForm _form = new AuthorizeTimeForm(); if (_form.ShowDialog() == DialogResult.OK) { authorizeendtime = _form.Selecttime.ToString(); } else { return; } } else { authorizeendtime = ""; } DAL.DAL_Authorize authorizedal = new DAL.DAL_Authorize(); if (authorizedal.InsertGroupAuthrize(this.groupid, AuthrizeCanGive.SelectedRows[0].Cells[0].Value.ToString(), authorizeendtime)) { MessageBox.Show("添加成功"); GetGroupAuthrize(); } else { MessageBox.Show("添加失败"); } } } }
public void RecvData(string recv) { if (recv.Contains("VNO") && recv.Contains("IP")) { DAL.DAL_Authorize _Authorizedao = new DAL.DAL_Authorize(); DAL.DAL_Log _logdal = new DAL.DAL_Log(); string No = recv.Substring(recv.IndexOf("NO") + 2, recv.IndexOf("IP") - recv.IndexOf("NO") - 2); string IP = recv.Substring(recv.IndexOf("IP") + 2, recv.Length - recv.IndexOf("IP") - 2); if (_Authorizedao.CheckVehicleInfoWithDevice(No, "", IP)) { DAL.DAO.DeviceDao devcedao = (new DAL.DAL_Device()).selectDeviceInfoWithIP(IP); string positiondirection = (new DAL.DAL_Position()).GetPositionDirection(devcedao.Deviceposition); int positionid = (new DAL.DAL_Position()).GetPositionID(devcedao.Deviceposition); if (positiondirection == "0") { _logdal.Inster_Log(devcedao.Deviceposition + "位置进车", 2, positionid, No, (int)(DateTime.Now - DateTime.Parse("1970-1-1 00:00:00")).TotalSeconds, DateTime.Now, "车牌" + No + "的车辆通过验证"); } else if (positiondirection == "1") { _logdal.Inster_Log(devcedao.Deviceposition + "位置出车", 3, positionid, No, (int)(DateTime.Now - DateTime.Parse("1970-1-1 00:00:00")).TotalSeconds, DateTime.Now, "车牌" + No + "的车辆通过验证"); this.Invoke(new Action(() => { VehicleOut(No); })); } } else { } } }