private void toolStripButtonDownLoadControllerInfo_Click(object sender, EventArgs e)
        {
            AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo();
            if (MyMessageBox.MessageBoxOkCancel("ÏÂÔØ¿ØÖÆÆ÷ÐÅÏ¢ÖÁÉ豸?") == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            int    selectIndex  = kryptonDataGridView1.CurrentRow.Index;
            string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim();

            AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID));

            int doorUnitCounts = (modelControllerInfo.DoorUnitEnable1 == true ? 1 : 0) +
                                 (modelControllerInfo.DoorUnitEnable2 == true ? 1 : 0) +
                                 (modelControllerInfo.DoorUnitEnable3 == true ? 1 : 0) +
                                 (modelControllerInfo.DoorUnitEnable4 == true ? 1 : 0);
            int expansionBoardCounts =
                (modelControllerInfo.ExpansionBoardEnable1 == true ? 1 : 0) +
                (modelControllerInfo.ExpansionBoardEnable2 == true ? 1 : 0) +
                (modelControllerInfo.ExpansionBoardEnable3 == true ? 1 : 0) +
                (modelControllerInfo.ExpansionBoardEnable4 == true ? 1 : 0);

            string data =
                "ControllerID=" + modelControllerInfo.ControllerID + "," +
                "ControllerType=" + modelControllerInfo.ControllerType + "," +
                "ControllerName='" + modelControllerInfo.ControllerName + "'," +
                "ControllerLocation='" + modelControllerInfo.ControllerLocation + "'," +
                "EncryptionType=" + modelControllerInfo.CommunicateType + "," +
                "ControllerVersion='" + modelControllerInfo.ControllerVersion + "'," +
                "ControllerMAC='" + modelControllerInfo.ControllerMAC + "'," +
                "ControllerIP='" + modelControllerInfo.ControllerIP + "'," +
                "ControllerSubnetMask='" + modelControllerInfo.ControllerSubnetMask + "'," +
                "ControllerGateway='" + modelControllerInfo.ControllerGateway + "'," +
                "ControllerPort=" + modelControllerInfo.ControllerPort + "," +
                "ControllerDNS='" + modelControllerInfo.ControllerDNS + "'," +
                "ControllerBUDNS='" + modelControllerInfo.ControllerBUDNS + "'," +
                "ControllerAddr485=" + modelControllerInfo.ControllerAddr485 + "," +
                "ControllerBaudrate=" + modelControllerInfo.ControllerBaudrate + "," +
                "ControllerDataBits=" + modelControllerInfo.ControllerDataBits + "," +
                //"ControllerStopBits="+modelControllerInfo.ControllerStopBits+","+
                "ControllerStopBits=" + 1 + "," +
                "ControllerParityCheck='" + modelControllerInfo.ControllerParityCheck + "'," +
                "ControllerFlowControl='" + modelControllerInfo.ControllerFlowControl + "'," +
                "ControllerSAM=" + modelControllerInfo.ControllerSAM + "," +
                "ControllerSAMType=" + modelControllerInfo.ControllerSAMType + "," +
                "DoorUnitCounts=" + doorUnitCounts + "," +
                "ExpansionBoardCounts=" + expansionBoardCounts;

            Dll.DllC0402.setDeviceData(modelControllerInfo.ControllerIP, "", data, "");

            /*
             * µ÷ÓÃAPIº¯Êý
             */
        }
        /*
         * public  void updateGridViewWithCheckBoxRow(object sender, DataGridViewCellEventArgs e)
         * {
         *  if (kryptonDataGridView1.Rows.Count <= 0)
         *      return;
         *  AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo();
         *  int selectIndex = kryptonDataGridView1.CurrentRow.Index;
         *
         *  string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim();
         *
         *  AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID));
         *  FormController formController = new FormController(modelControllerInfo, OpenMode.Update);
         *  formController.ShowDialog();
         *
         *  this.refreshDataGridView();
         * }*/
        private void toolStripButtonUpdateUserInfo_Click(object sender, EventArgs e)
        {
            if (kryptonDataGridView1.CurrentRow == null)
            {
                return;
            }

            AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo();
            int selectIndex = kryptonDataGridView1.CurrentRow.Index;

            string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim();

            AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID));
            FormController formController = new FormController(modelControllerInfo, OpenMode.Update);

            formController.ShowDialog();

            refreshDataGridView();
        }
Пример #3
0
        private void toolStripButtonDownLoadUserInfo_Click(object sender, EventArgs e)
        {
            AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo();
            if (MyMessageBox.MessageBoxOkCancel("下载用户信息至设备?") == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            foreach (DataGridViewRow i in dataGridViewWithCheckBox1.Rows)
            {
                if (dataGridViewWithCheckBox1.GetRowCheckBoxState(i.Index))
                {
                    string userID = dataGridViewWithCheckBox1["UserID", i.Index].Value.ToString().Trim();

                    AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(userID));

                    /*
                     *
                     * 调用API函数
                     */
                }
            }
        }
Пример #4
0
        private void toolStripButtonDownLoadUserInfo_Click(object sender, EventArgs e)
        {
            AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo();
            if (MyMessageBox.MessageBoxOkCancel("�����û���Ϣ���豸��") == System.Windows.Forms.DialogResult.Cancel)
                return;
            foreach (DataGridViewRow i in dataGridViewWithCheckBox1.Rows)
            {
                if (dataGridViewWithCheckBox1.GetRowCheckBoxState(i.Index))
                {
                    string userID = dataGridViewWithCheckBox1["UserID", i.Index].Value.ToString().Trim();

                    AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(userID));
                    /*

                     ����API����
                     */
                }

            }
        }
        /*
        public  void updateGridViewWithCheckBoxRow(object sender, DataGridViewCellEventArgs e)
        {
            if (kryptonDataGridView1.Rows.Count <= 0)
                return;
            AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo();
            int selectIndex = kryptonDataGridView1.CurrentRow.Index;

            string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim();

            AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID));
            FormController formController = new FormController(modelControllerInfo, OpenMode.Update);
            formController.ShowDialog();

            this.refreshDataGridView();
        }*/
        private void toolStripButtonUpdateUserInfo_Click(object sender, EventArgs e)
        {
            if (kryptonDataGridView1.CurrentRow == null)
                return;

            AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo();
            int selectIndex = kryptonDataGridView1.CurrentRow.Index;

            string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim();

            AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID));
            FormController formController = new FormController(modelControllerInfo,OpenMode.Update);
            formController.ShowDialog();

            refreshDataGridView();
        }
        private void toolStripButtonDownLoadControllerInfo_Click(object sender, EventArgs e)
        {
            AccessDataBase.BLL.ControllerInfo bllControllerInfo = new AccessDataBase.BLL.ControllerInfo();
            if (MyMessageBox.MessageBoxOkCancel("���ؿ�������Ϣ���豸?") == System.Windows.Forms.DialogResult.Cancel)
                return;
            int selectIndex = kryptonDataGridView1.CurrentRow.Index;
            string controllerID = kryptonDataGridView1["ControllerID", selectIndex].Value.ToString().Trim();

            AccessDataBase.Model.ControllerInfo modelControllerInfo = bllControllerInfo.GetModel(int.Parse(controllerID));

            int doorUnitCounts =    (modelControllerInfo.DoorUnitEnable1 == true ? 1 : 0) +
                                    (modelControllerInfo.DoorUnitEnable2 == true ? 1 : 0) +
                                    (modelControllerInfo.DoorUnitEnable3 == true ? 1 : 0) +
                                    (modelControllerInfo.DoorUnitEnable4 == true ? 1 : 0);
            int expansionBoardCounts =
                (modelControllerInfo.ExpansionBoardEnable1 == true ? 1 : 0) +
                (modelControllerInfo.ExpansionBoardEnable2 == true ? 1 : 0) +
                (modelControllerInfo.ExpansionBoardEnable3 == true ? 1 : 0) +
                (modelControllerInfo.ExpansionBoardEnable4 == true ? 1 : 0);

            string data =
                "ControllerID=" + modelControllerInfo.ControllerID+","+
                "ControllerType="+modelControllerInfo.ControllerType+","+
                "ControllerName='"+modelControllerInfo.ControllerName+"',"+
                "ControllerLocation='"+modelControllerInfo.ControllerLocation+"',"+
                "EncryptionType="+modelControllerInfo.CommunicateType+","+
                "ControllerVersion='"+modelControllerInfo.ControllerVersion+"',"+
                "ControllerMAC='"+modelControllerInfo.ControllerMAC+"',"+
                "ControllerIP='"+modelControllerInfo.ControllerIP+"',"+
                "ControllerSubnetMask='"+modelControllerInfo.ControllerSubnetMask+"',"+
                "ControllerGateway='"+modelControllerInfo.ControllerGateway+"',"+
                "ControllerPort="+modelControllerInfo.ControllerPort+","+
                "ControllerDNS='"+modelControllerInfo.ControllerDNS+"',"+
                "ControllerBUDNS='"+modelControllerInfo.ControllerBUDNS+"',"+
                "ControllerAddr485="+modelControllerInfo.ControllerAddr485+","+
                "ControllerBaudrate="+modelControllerInfo.ControllerBaudrate+","+
                "ControllerDataBits="+modelControllerInfo.ControllerDataBits+","+
                //"ControllerStopBits="+modelControllerInfo.ControllerStopBits+","+
                "ControllerStopBits=" + 1 + "," +
                "ControllerParityCheck='"+modelControllerInfo.ControllerParityCheck+"',"+
                "ControllerFlowControl='"+modelControllerInfo.ControllerFlowControl+"',"+
                "ControllerSAM="+modelControllerInfo.ControllerSAM+","+
                "ControllerSAMType="+modelControllerInfo.ControllerSAMType+","+
                "DoorUnitCounts=" + doorUnitCounts+ "," +
                "ExpansionBoardCounts=" + expansionBoardCounts;
            Dll.DllC0402.setDeviceData(modelControllerInfo.ControllerIP, "", data, "");
            /*
             * ����API����
             */
        }