Exemple #1
0
        private void AddPersonnelbutton_Click(object sender, EventArgs e)
        {
            int           Count     = 0;
            string        Name      = string.Empty;
            List <string> lstStr    = null;
            int           loginName = Int32.Parse(loginNametextBox.Text);

            AddPersonnelprogressBar.Maximum = Int32.Parse(AddPersonneltextBox.Text);
            AddPersonnelprogressBar.Value   = 0;
            AddPersonnelprogressBar.Step    = 1;
            for (Count = 1; Count <= Int32.Parse(AddPersonneltextBox.Text); Count++)
            {
                string PersonnelID = Guid.NewGuid().ToString().Replace("-", "");
                lstStr = GenerateChineseWords(3);
                Name   = lstStr[0] + lstStr[1] + lstStr[2];
                string mysql = "INSERT INTO hr_member (id,bczt,Name,OrgId,AccountType,National,PoliticalLandscape,PostStatus) VALUES ('" + PersonnelID + "','1','" + Name + "','" + _NodeTag + "','2','1','1','1')";
                _Mysql.ExcuteNoneQuery(mysql);
                if (Count <= Int32.Parse(AddUsertextBox.Text))
                {
                    mysql = "INSERT INTO usr_account (id,bczt,username,loginname,password,MemberId) VALUES ('" + Guid.NewGuid().ToString().Replace("-", "") + "','1','" + Name + "','" + loginName.ToString() + "','/fOMjRWQGQ2mGvPcfFNWdA==','" + PersonnelID + "')";
                    _Mysql.ExcuteNoneQuery(mysql);
                    loginName++;
                }
                AddPersonnelprogressBar.Value += AddPersonnelprogressBar.Step;//让进度条增加一次
            }
            MessageBox.Show("添加成功");
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            int  count = 0;
            long start = 10000000;

            iot_storageEventprogressBar.Maximum = Int32.Parse(iot_storagetextBox.Text);
            iot_storageEventprogressBar.Value   = 0;
            iot_storageEventprogressBar.Step    = 1;
            string mysql = null;
            Task   t     = new Task(() =>
            {
                for (count = 1; count <= Int32.Parse(iot_storagetextBox.Text); count++)
                {
                    //写act_hi_actinst表
                    mysql = "INSERT into act_hi_actinst (ID_,PROC_DEF_ID_,PROC_INST_ID_,EXECUTION_ID_,ACT_ID_,TASK_ID_,CALL_PROC_INST_ID_,ACT_NAME_,ACT_TYPE_,ASSIGNEE_,START_TIME_,END_TIME_,DURATION_,TENANT_ID_) VALUES ('" + start.ToString() + "','P59E3EDAF6C451425AFC393C859099821:30:92565','100001','100001','sid-DD4F029D-F4FB-4FEA-B949-13B7FE181B0E','','','','startEvent','','2018-07-23 21:38:11.472','2018-07-23 21:38:11.484','12','');";
                    _Mysql.ExcuteNoneQuery(mysql);
                    //写act_hi_taskinst表
                    mysql = "INSERT INTO act_hi_taskinst (ID_,PROC_DEF_ID_,TASK_DEF_KEY_,PROC_INST_ID_,EXECUTION_ID_,NAME_,PARENT_TASK_ID_,DESCRIPTION_,OWNER_,ASSIGNEE_,START_TIME_,CLAIM_TIME_,END_TIME_,DURATION_,DELETE_REASON_,PRIORITY_,DUE_DATE_,FORM_KEY_,CATEGORY_,TENANT_ID_) VALUES ('" + start.ToString() + "','P59E3EDAF6C451425AFC393C859099821:30:92565','T373550831F3B2E005FC6DA904A14C11D','100001','100001','新增机构','','','','admin','2018-07-23 21:38:11.487',NULL,'2018-07-23 21:38:18.292','6805','completed','50',NULL,'机构主表','','');";
                    _Mysql.ExcuteNoneQuery(mysql);
                    //写act_hi_procinst表
                    mysql = "INSERT INTO act_hi_procinst (ID_,PROC_INST_ID_,BUSINESS_KEY_,PROC_DEF_ID_,START_TIME_,END_TIME_,DURATION_,START_USER_ID_,START_ACT_ID_,END_ACT_ID_,SUPER_PROCESS_INSTANCE_ID_,DELETE_REASON_,TENANT_ID_,NAME_) VALUES ('" + start.ToString() + "','" + start.ToString() + "',NULL,'P59E3EDAF6C451425AFC393C859099821:30:92565','2018-07-23 21:38:11.472','2018-07-23 21:38:35.686','24214','admin','sid-DD4F029D-F4FB-4FEA-B949-13B7FE181B0E','sid-9B616503-2B4D-4B9F-985F-A20503EDBFA6',NULL,NULL,NULL,'新增机构(2018-07-23 21:38:11)');";
                    _Mysql.ExcuteNoneQuery(mysql);
                    start = start + count;
                    iot_storageEventprogressBar.Value += iot_storageEventprogressBar.Step;//让进度条增加一次
                }
                MessageBox.Show("添加成功");
            });

            t.Start();
        }
Exemple #3
0
        private void EventData()
        {
            string    sql      = null;
            DataTable dtDevice = null;

            //查出所有设备
            sql      = "SELECT * FROM sys_devicebase WHERE OrgID = '" + _NodeTag + "' AND DeviceType = '" + _DevCode + "'";
            dtDevice = _Mysql.GetDataTable(sql);
            int pageCount = dtDevice.Rows.Count / 20;

            EventprogressBar.Maximum = pageCount + 1;
            EventprogressBar.Value   = 0;
            EventprogressBar.Step    = 1;
            for (int i = 1; i <= pageCount + 1; i++)
            {
                DataTable dt = Paging(dtDevice, i, 20);

                Event_DetailLinkPolicy DetailLinkPolicy = new Event_DetailLinkPolicy();
                DetailLinkPolicy.id         = Guid.NewGuid().ToString().Replace("-", "");
                DetailLinkPolicy.IsEnable   = "1";
                DetailLinkPolicy.PolicyName = _NodeName + "性能测试视频通道报警事件" + i.ToString();
                DetailLinkPolicy.TimeMode   = _TimeTemplateID;
                DetailLinkPolicy.UserToRecv = _RoleID;
                sql = string.Format("INSERT INTO event_DetailLinkPolicy (id,IsEnable,PolicyName,TimeMode,UserToRecv) VALUES ('{0}','{1}','{2}','{3}','{4}')", DetailLinkPolicy.id, DetailLinkPolicy.IsEnable, DetailLinkPolicy.PolicyName, DetailLinkPolicy.TimeMode, DetailLinkPolicy.UserToRecv);
                _Mysql.ExcuteNoneQuery(sql);

                foreach (DataRow dr in dt.Rows)
                {
                    Event_SourceDevice SourceDevice = new Event_SourceDevice();
                    SourceDevice.id             = Guid.NewGuid().ToString().Replace("-", "");
                    SourceDevice.fid            = DetailLinkPolicy.id;
                    SourceDevice.Org_id         = _NodeTag;
                    SourceDevice.BelongToModule = "VideoManage";
                    SourceDevice.DeviceId       = dr["id"].ToString();
                    SourceDevice.EventType      = _EventInfoCode;
                    sql = string.Format("INSERT INTO event_sourcedevice (id,fid,Org_id,BelongToModule,DeviceId,EventType) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}')", SourceDevice.id, SourceDevice.fid, SourceDevice.Org_id, SourceDevice.BelongToModule, SourceDevice.DeviceId, SourceDevice.EventType);
                    _Mysql.ExcuteNoneQuery(sql);
                }
                //添加联动模板
                Event_DetailPolicySecLink link = new Event_DetailPolicySecLink()
                {
                    id         = Guid.NewGuid().ToString().Replace("-", ""),
                    fid        = DetailLinkPolicy.id,
                    HandleType = "6",
                    LinkMode   = _StrategyTemplateID
                };
                sql = string.Format("INSERT INTO event_DetailPolicySecLink (id,fid,HandleType,LinkMode) VALUES ('{0}','{1}','{2}','{3}')", link.id, link.fid, link.HandleType, link.LinkMode);
                EventprogressBar.Value += EventprogressBar.Step;//让进度条增加一次
            }
            MessageBox.Show("配置成功");
        }
Exemple #4
0
        private void  除组织机构ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int    count = 0;
            string mysql = "SELECT COUNT(*) FROM org_dept WHERE pid='" + _NodeTag + "'";

            count = _Mysql.ExcuteNoneQuery(mysql);
            if (0 == count)
            {
                mysql = "DELETE FROM org_dept WHERE id='" + _NodeTag + "'";
                count = _Mysql.ExcuteNoneQuery(mysql);
                TreeNode node = OrgtreeView.SelectedNode;
                node.Remove();
            }
            else
            {
                MessageBox.Show("该节点下有子节点无法删除");
            }
        }
Exemple #5
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());
 }
Exemple #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string mysql = null;

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

            for (int i = 1; i <= Int32.Parse(CounttextBox.Text); i++)
            {
                string DevIP  = string.Format("{0}.{1}.{2}.{3}", sArray[0], sArray[1], sArray[2], IPCount);
                string Region = DevIP + "下级";
                mysql = mysql = "INSERT INTO uplink_config (NodeType,ScheduledServiceIP,RealTimeServiceIP,Description,Region,id) VALUES ('1','" + DevIP + "','" + DevIP + "','" + DevIP + "','" + Region + "','" + Guid.NewGuid().ToString().Replace("-", "") + "')";

                _Mysql.ExcuteNoneQuery(mysql);
                IPCount++;
            }
        }
Exemple #7
0
        private void AddOrgbutton_Click(object sender, EventArgs e)
        {
            int    count = 0;
            string pid   = null;

            AddOrgprogressBar.Maximum = Int32.Parse(AddOrgCounttextBox.Text);
            AddOrgprogressBar.Value   = 0;
            AddOrgprogressBar.Step    = 1;
            for (count = 1; count <= Int32.Parse(AddOrgCounttextBox.Text); count++)
            {
                //string OrgName = OrgNametextBox.Text + "_" + Guid.NewGuid().ToString().Replace("-", "").Substring(0,16);
                string OrgName = OrgNametextBox.Text + "_" + count.ToString();
                string id      = Guid.NewGuid().ToString().Replace("-", "");
                // if (count == 1) pid = "e0ec2383aa0e410fbc942ddbc6f45f4f";
                string mysql = "INSERT INTO org_dept(id,bczt,Code,DutyMemberId,Province,City,Addr,OrgType,name,pid,name1) VALUES ('" + id + "',1,'" + Guid.NewGuid().ToString().Replace("-", "") + "',NULL,'a2e455be772f4b0eb2a37f29b4755828','2b33927016314ec1ac0014ed15e23505','" + OrgName + "','2','" + OrgName + "',NULL,'" + OrgName + "');";
                SqlStringtextBox.Text += string.Format("{0}{1}", mysql, Environment.NewLine);

                _Mysql.ExcuteNoneQuery(mysql);
                AddOrgprogressBar.Value += AddOrgprogressBar.Step;//让进度条增加一次
            }
            MessageBox.Show("添加成功");
        }
Exemple #8
0
 public new void excute(MySQLDBHelper db)
 {
     db.ExcuteNoneQuery(buildSqlStr() + ";" + state.buildSqlStr());
     Console.WriteLine("====================创建资产及公有附属表数据:资产id = " + getId());
 }
Exemple #9
0
 /// <summary>
 /// 执行insert操作,已弃用,由AddDeviceHelper统一调度执行
 /// </summary>
 /// <param name="db"></param>
 public virtual void excute(MySQLDBHelper db)
 {
     db.ExcuteNoneQuery(buildSqlStr());
     Console.WriteLine("====================添加一条数据:" + id);
 }
Exemple #10
0
        //多合一insert
        public static void multiExcute(MySQLDBHelper db, List <Device> devices)
        {
            if (devices == null || devices.Count <= 0)
            {
                return;
            }
            //父设备列表<子设备种类<子设备列表<子设备>>>
            List <List <List <Device> > > allChilds = new List <List <List <Device> > >();
            StringBuilder asset      = new StringBuilder(devices[0].deviceBase.asset.initHead());
            StringBuilder assetState = new StringBuilder(devices[0].deviceBase.asset.state.initHead());
            StringBuilder deviceBase = new StringBuilder(devices[0].deviceBase.buildSQLHead());
            StringBuilder device     = new StringBuilder(devices[0].initHead());

            foreach (Device d in devices)
            {
                asset.Append(d.deviceBase.asset.buildSQLValue() + ",");
                assetState.Append(d.deviceBase.asset.state.buildSQLValue() + ",");
                deviceBase.Append(d.deviceBase.buildSQLValue() + ",");
                device.Append(d.buildSQLValue() + ",");
                if (d.getChildList() != null && d.getChildList().Count > 0)
                {
                    allChilds.Add(d.getChildList());
                }
            }
            asset.Remove(asset.Length - 1, 1);
            assetState.Remove(assetState.Length - 1, 1);
            deviceBase.Remove(deviceBase.Length - 1, 1);
            device.Remove(device.Length - 1, 1);
            Console.WriteLine("==========excute:-----Asset--------:" + "asset.ToString()");
            db.ExcuteNoneQuery(asset.ToString());
            Console.WriteLine("==========excute:-----AssetState---:" + "assetState.ToString()");
            db.ExcuteNoneQuery(assetState.ToString());
            Console.WriteLine("==========excute:-----DeviceBase---:" + "deviceBase.ToString()");
            db.ExcuteNoneQuery(deviceBase.ToString());
            Console.WriteLine("==========excute:-----Device-------:" + "device.ToString()");
            db.ExcuteNoneQuery(device.ToString());
            if (allChilds != null && allChilds.Count > 0)
            {
                Console.WriteLine("====excute:开始添加子设备:设备种类:" + allChilds[0].Count);
                //子设备种类<子设备列表<子设备>>
                List <List <Device> > allChildDevices = new List <List <Device> >(allChilds[0].Count);
                for (int c = 0; c < allChilds[0].Count; c++)
                {
                    allChildDevices.Add(new List <Device>());
                }
                foreach (List <List <Device> > childDevices in allChilds)
                {
                    for (int i = 0; i < childDevices.Count; i++)
                    {
                        allChildDevices[i].AddRange(childDevices[i]);
                    }
                }
                int num = 1;
                foreach (List <Device> deviceList in allChildDevices)
                {
                    Console.WriteLine("-----添加第" + num++ + "种子设备----");
                    multiExcute(db, deviceList);
                }
                Console.WriteLine("==========excute:-----子设备添加完成-------\n\n");
            }
        }
Exemple #11
0
 public new void excute(MySQLDBHelper db)
 {
     asset.excute(db);
     db.ExcuteNoneQuery(buildSqlStr());
     Console.WriteLine("====================创建设备基类表数据:id = " + getId());
 }