Exemplo n.º 1
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            if (!CheckInfo())
            {
                return;
            }

            DAL.DAL_Device    devicedal = new DAL.DAL_Device();
            DAL.DAO.DeviceDao devicedao = new DAL.DAO.DeviceDao();

            devicedao.Devicename     = txb_DeviceName.Text;
            devicedao.Devicetype     = cmb_DeviceType.Text;
            devicedao.Code           = txb_DeviceCode.Text;
            devicedao.Deviceposition = cmb_DevicePosition.Text;
            devicedao.Netaddress     = txb_addr_part1.Text + "." + txb_addr_part2.Text + "." + txb_addr_part3.Text + "." + txb_addr_part4.Text;

            if (devicedal.insertDeviceInfo(devicedao))
            {
                MessageBox.Show("添加成功");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("添加失败");
            }
        }
Exemplo n.º 2
0
        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 + "的用户通过验证");
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void EditDeviceForm_Load(object sender, EventArgs e)
        {
            LoadLanguage("");

            this.txb_addr_part1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);
            this.txb_addr_part4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(new Smart.ToolUtil.StringControlUtil().NumTextKeyPress);

            DAL.DAL_Device devicedal = new DAL.DAL_Device();

            DAL.DAO.DeviceDao devicedao = devicedal.selectDeviceInfoWithID(deviceid);

            if (devicedao == null)
            {
                MessageBox.Show("获取设备信息失败!");
                this.Close();
            }
            else
            {
                this.txb_DeviceName.Text = devicedao.Devicename;
                this.txb_DeviceCode.Text = devicedao.Code;

                string[] address = devicedao.Netaddress.Split('.');

                this.txb_addr_part1.Text = address[0];
                this.txb_addr_part2.Text = address[1];
                this.txb_addr_part3.Text = address[2];
                this.txb_addr_part4.Text = address[3];

                this.cmb_DevicePosition.Text = devicedao.Deviceposition;
            }
            DAL.DAL_Position positiondal = new DAL.DAL_Position();

            //DataTable _dt = devicedal.GetDeviceTypeList();
            //if (_dt != null)
            //{
            //    cmb_DeviceType.Items.Clear();

            //    foreach (DataRow _row in _dt.Rows)
            //    {
            //        cmb_DeviceType.Items.Add(_row[0]);
            //    }

            //}
            DataTable _dt = positiondal.selectPositionListInfo("");

            if (_dt != null)
            {
                cmb_DevicePosition.Items.Clear();

                foreach (DataRow _row in _dt.Rows)
                {
                    cmb_DevicePosition.Items.Add(_row[1]);
                }
            }
        }
Exemplo n.º 4
0
        private void DeviceAuthorize_Load(object sender, EventArgs e)
        {
            DAL.DAL_Device    devicedal = new DAL.DAL_Device();
            DAL.DAO.DeviceDao devicedao = devicedal.selectDeviceInfoWithID(deviceid);

            this.lab_DeviceName.Text = devicedao.Devicename;
            this.lab_DevceType.Text  = devicedao.Devicetype;
            this.lab_Position.Text   = devicedao.Deviceposition;
            GetDeviceAuthrizeList("");
        }
Exemplo n.º 5
0
        private void DeviceAuthorize_Load(object sender, EventArgs e)
        {
            LoadLanguage("");

            DAL.DAL_Device    devicedal = new DAL.DAL_Device();
            DAL.DAO.DeviceDao devicedao = devicedal.selectDeviceInfoWithID(deviceid);

            this.lab_DeviceName.Text = devicedao.Devicename;
            this.lab_DevceType.Text  = devicedao.Devicetype;
            this.lab_Position.Text   = devicedao.Deviceposition;

            DAL.DAL_Group groupdal = new DAL.DAL_Group();

            DataTable _dt = groupdal.selectGroupListInfo();

            GetDeviceAuthorizeList("");
        }
Exemplo n.º 6
0
        private void btn_OK_Click(object sender, EventArgs e)
        {
            DAL.DAL_Device devicedal = new DAL.DAL_Device();

            devicedao = new DAL.DAO.DeviceDao();

            devicedao.Devicename     = txb_DeviceName.Text;
            devicedao.Code           = txb_DeviceCode.Text;
            devicedao.Deviceposition = cmb_DevicePosition.Text;
            devicedao.Netaddress     = txb_addr_part1.Text + "." + txb_addr_part2.Text + "." + txb_addr_part3.Text + "." + txb_addr_part4.Text;

            if (devicedal.updateDeviceInfo(deviceid, devicedao))
            {
                MessageBox.Show("修改成功");
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            else
            {
                MessageBox.Show("修改失败");
            }
        }
Exemplo n.º 7
0
        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
                {
                }
            }
        }