Exemplo n.º 1
0
        private void doWork()
        {
            int dataCount = Int32.Parse(AddDevNumtextBox.Text);

            IASprogressBar.Maximum = dataCount;
            IASprogressBar.Value   = 0;
            IASprogressBar.Step    = 1;
            string[] sArray     = AddIpAddresstextBox.Text.Split('.');
            int      Port       = Int32.Parse(AddPorttextBox.Text);
            int      IPCount    = Int32.Parse(sArray[3]);
            string   deviceCode = StringUtil.getDateTimeNum();//资产编号起始
            string   name       = "智能分析";

            for (int i = 0; i < dataCount;)
            {
                int           left    = dataCount - i;
                int           count   = left > AddDeviceHelper.ONCE_INSERT ? AddDeviceHelper.ONCE_INSERT : left;
                List <Device> devices = new List <Device>();
                for (int j = 0; j < count; j++, i++)
                {
                    InsightDevice insight = new InsightDevice();
                    insight.setIp(string.Format("{0}.{1}.{2}.{3}", sArray[0], sArray[1], sArray[2], IPCount));
                    insight.setPort(Port++.ToString());
                    insight.setDeviceCode(deviceCode + i.ToString());
                    insight.setDeviceName(name + i.ToString());
                    insight.setIasChnCount(4);
                    devices.Add(insight);

                    IASprogressBar.Value += IASprogressBar.Step;//让进度条增加一次
                }
                AddDeviceHelper.multiExcute(LoginMysqlFm.getNewDbHelper(), devices);
            }
            MessageBox.Show("添加成功");
        }
Exemplo n.º 2
0
        private void doWork()
        {
            string name       = "入侵报警主机";                        //资产名称的前缀
            long   deviceCode = Int32.Parse(textBox1.Text);      //资产编号起始
            int    dataCount  = Int32.Parse(AddNumtextBox.Text); //数据生成数量

            string[] sArray  = IpAddresstextBox.Text.Split('.');
            int      Port    = Int32.Parse(PorttextBox.Text);
            int      IPCount = Int32.Parse(sArray[3]);//ip尾号

            AddAlmDevprogressBar.Maximum = dataCount;
            AddAlmDevprogressBar.Step    = 1;

            for (int i = 0; i < dataCount;)
            {
                int           left    = dataCount - i;
                int           count   = left > AddDeviceHelper.ONCE_INSERT ? AddDeviceHelper.ONCE_INSERT : left;
                List <Device> devices = new List <Device>();
                for (int j = 0; j < count; j++, i++)
                {
                    AlarmDevice alarm = new AlarmDevice();
                    alarm.setIp(string.Format("{0}.{1}.{2}.{3}", sArray[0], sArray[1], sArray[2], IPCount++));
                    alarm.setPort(Port.ToString());
                    alarm.setDeviceCode(deviceCode++.ToString());
                    alarm.setDeviceName(name + i.ToString());
                    alarm.setSectorCount(4);//一个报警主机带4个子系统和4个防区
                    alarm.setSubSysCount(4);
                    devices.Add(alarm);

                    AddAlmDevprogressBar.Value += AddAlmDevprogressBar.Step;//让进度条增加一次
                }
                AddDeviceHelper.multiExcute(LoginMysqlFm.getNewDbHelper(), devices);
            }
            MessageBox.Show("添加成功");
        }
Exemplo n.º 3
0
        private void doWork()
        {
            int dataCount = Int32.Parse(AddIpmicNumtextBox.Text);
            int IpNo      = Int32.Parse(AddIpmicNotextBox.Text);

            string[] sArray  = AddIpmicIpAddresstextBox.Text.Split('.');
            int      IPCount = Int32.Parse(sArray[3]);

            AddIpmicprogressBar.Maximum = dataCount;
            AddIpmicprogressBar.Value   = 0;
            AddIpmicprogressBar.Step    = 1;

            for (int i = 0; i < dataCount;)
            {
                int           left    = dataCount - i;
                int           count   = left > AddDeviceHelper.ONCE_INSERT ? AddDeviceHelper.ONCE_INSERT : left;
                List <Device> devices = new List <Device>();
                for (int j = 0; j < count; j++, i++)
                {
                    CallMic mic = new CallMic();
                    mic.setDeviceCode(IpNo + i.ToString());
                    mic.setDeviceName("对讲话筒" + i.ToString());
                    mic.setParam("ResourceID", IpNo++ + i.ToString());
                    mic.setIp(string.Format("{0}.{1}.{2}.{3}", sArray[0], sArray[1], sArray[2], IPCount++));
                    devices.Add(mic);

                    AddIpmicprogressBar.Value += AddIpmicprogressBar.Step;//让进度条增加一次
                }
                AddDeviceHelper.multiExcute(LoginMysqlFm.getNewDbHelper(), devices);
            }
            MessageBox.Show("添加成功");
        }
Exemplo n.º 4
0
 //已弃用的执行方法
 public virtual new void excute(MySQLDBHelper db)
 {
     deviceBase.excute(db);
     db.ExcuteNoneQuery(buildSqlStr());
     if (childList != null && childList.Count > 0)
     {
         foreach (List <Device> childs in childList)
         {
             AddDeviceHelper.multiExcute(db, childs);
         }
     }
     Console.WriteLine("====================添加一条数据:" + this.getId());
 }
Exemplo n.º 5
0
        private void doWork()
        {
            int dataCount = Int32.Parse(AddDevNumtextBox.Text);//数据生成数量

            //设置进度条
            this.Invoke((EventHandler) delegate { this.AddDevprogressBar.Minimum = 0; });
            this.Invoke((EventHandler) delegate { this.AddDevprogressBar.Step = 1; });
            this.Invoke((EventHandler) delegate { this.AddDevprogressBar.Maximum = dataCount; });
            //AddDevprogressBar.Maximum = dataCount;

            string name       = "视频主机";                      //资产名称的前缀
            string deviceCode = StringUtil.getDateTimeNum(); //资产编码和设备唯一标识码的前缀

            string[] sArray       = AddIpAddresstextBox.Text.Split('.');
            int      Port         = Int32.Parse(AddPorttextBox.Text);
            int      IPCount      = Int32.Parse(sArray[3]);              //ip尾号
            int      channelCount = Int32.Parse(AddChanneltextBox.Text); //通道数量

            for (int i = 0; i < dataCount;)
            {
                int left = dataCount - i;
                //控制一次insert新增的数据量
                int           count   = left > AddDeviceHelper.ONCE_INSERT ? AddDeviceHelper.ONCE_INSERT : left;
                List <Device> devices = new List <Device>();
                for (int j = 0; j < count; j++, i++)
                {
                    VideoDevice video = new VideoDevice();
                    video.setIp(string.Format("{0}.{1}.{2}.{3}", sArray[0], sArray[1], sArray[2], IPCount++));
                    video.setPort(Port.ToString());
                    video.setDeviceCode(deviceCode + i.ToString());
                    video.setDeviceName(name + i.ToString());
                    video.setChannelCount(channelCount);
                    devices.Add(video);

                    this.Invoke((EventHandler) delegate { this.AddDevprogressBar.Value += AddDevprogressBar.Step; });
                    //AddDevprogressBar.Value += AddDevprogressBar.Step;//让进度条增加一次
                }
                AddDeviceHelper.multiExcute(LoginMysqlFm.getNewDbHelper(), devices);//执行数据新增操作
            }
            MessageBox.Show("添加成功");
        }
Exemplo n.º 6
0
        private void doWork()
        {
            string name       = "门禁主机";                                //资产名称的前缀
            string deviceCode = StringUtil.getDateTimeNum();           //资产编号起始
            int    dataCount  = Int32.Parse(AddACSDevNumtextBox.Text); //数据生成数量

            string[] sArray    = AddACSDevIpAddresstextBox.Text.Split('.');
            int      Port      = Int32.Parse(PorttextBox.Text);
            int      IPCount   = Int32.Parse(sArray[3]);//ip尾号
            long     IOTCtrlid = Int64.Parse(AddACSDevUIDtextBox.Text);

            AddACSDevprogressBar.Maximum = dataCount;
            AddACSDevprogressBar.Value   = 0;
            AddACSDevprogressBar.Step    = 1;

            for (int i = 0; i < dataCount;)
            {
                int           left    = dataCount - i;
                int           count   = left > AddDeviceHelper.ONCE_INSERT ? AddDeviceHelper.ONCE_INSERT : left;
                List <Device> devices = new List <Device>();
                for (int j = 0; j < count; j++, i++)
                {
                    AccessDevice acs = new AccessDevice();
                    acs.setIp(string.Format("{0}.{1}.{2}.{3}", sArray[0], sArray[1], sArray[2], IPCount++));
                    acs.setPort(Port.ToString());
                    acs.setDeviceCode(deviceCode + i.ToString());
                    acs.setCtlId(StringToHexString(IOTCtrlid++.ToString(), Encoding.UTF8));
                    acs.setDeviceName(name + i.ToString());
                    acs.setDoorCount(4);//4扇门

                    devices.Add(acs);

                    AddACSDevprogressBar.Value += AddACSDevprogressBar.Step;//让进度条增加一次
                }
                AddDeviceHelper.multiExcute(LoginMysqlFm.getNewDbHelper(), devices);
            }
            MessageBox.Show("添加成功");
        }
Exemplo n.º 7
0
        private void doWork()
        {
            int dataCount = Int32.Parse(AddIpdevNumtextBox.Text);//数据生成数量
            AddIpdevprogressBar.Maximum = dataCount;
            AddIpdevprogressBar.Value = 0;
            AddIpdevprogressBar.Step = 1;

            string name = "IP对讲主机";//资产名称的前缀
            string deviceCode = StringUtil.getDateTimeNum();//资产编号起始

            string[] sArray = AddIpDevIpAddresstextBox.Text.Split('.');
            int IPCount = Int32.Parse(sArray[3]);//ip尾号
            int IpNo = Int32.Parse(AddIpdevNotextBox.Text);

            for (int i = 0; i < dataCount;)
            {
                int left = dataCount - i;
                int count = left > AddDeviceHelper.ONCE_INSERT ? AddDeviceHelper.ONCE_INSERT : left;
                List<Device> devices = new List<Device>();
                for (int j = 0; j < count; j++,i++)
                {
                    IPCallDevice call = new IPCallDevice();
                    call.setIp(string.Format("{0}.{1}.{2}.{3}", sArray[0], sArray[1], sArray[2], IPCount++));
                    call.setPort("8080");
                    call.setDeviceCode(deviceCode + i.ToString());
                    call.setDeviceName(name + i.ToString());
                    call.setResourceId(IpNo++.ToString());
                    call.setPanelCount(6);
                    devices.Add(call);

                    AddIpdevprogressBar.Value += AddIpdevprogressBar.Step;//让进度条增加一次
                }
                AddDeviceHelper.multiExcute(LoginMysqlFm.getNewDbHelper(), devices);
            }
                MessageBox.Show("添加成功");
        }