Esempio n. 1
0
        private void InitDoors()
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    var doors = DoorDataHelper.GetDoors();
                    Maticsoft.BLL.SMT_CARD_INFO cardBll = new Maticsoft.BLL.SMT_CARD_INFO();
                    _cards = cardBll.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        AddDoorsToView(doors);
                    }));

                    var facedevs = FaceRecgHelper.GetList("");
                    this.Invoke(new Action(() =>
                    {
                        AddFaceDevsToView(facedevs);
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载门禁异常!" + ex.Message);
                    log.Error("加载门禁异常:", ex);
                }
            });

            waiting.Show(this, 200);
        }
Esempio n. 2
0
        private void Init()
        {
            dtpStart.Value = DateTime.Now.Date;
            dtpEnd.Value   = DateTime.Now.Date;
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                var doors = DoorDataHelper.GetDoors();
                var areas = AreaDataHelper.GetAreas();

                this.Invoke(new Action(() =>
                {
                    var doorNodes = DoorDataHelper.ToTree(areas, doors);
                    //cboDoorTree.Nodes.Add(new Node("--所有门禁--"));
                    cboDoorTree.Nodes.AddRange(doorNodes.ToArray());
                    if (cboDoorTree.Nodes.Count > 0)
                    {
                        cboDoorTree.SelectedNode = cboDoorTree.Nodes[0];
                    }

                    foreach (Node item in cboDoorTree.Nodes)
                    {
                        item.ExpandAll();
                    }
                }));
            });

            waiting.Show(this, 300);
        }
Esempio n. 3
0
 private void DoorTree_Load(object sender, EventArgs e)
 {
     if (!IsDesignMode())
     {
         CtrlWaiting ctrlWaiting = new CtrlWaiting(() =>
         {
             try
             {
                 var doors = DoorDataHelper.GetDoors();
                 var areas = AreaDataHelper.GetAreas();
                 this.Invoke(new Action(() =>
                 {
                     var nodes = DoorDataHelper.ToTree(areas, doors);
                     advDoorTree.Nodes.Clear();
                     advDoorTree.Nodes.AddRange(nodes.ToArray());
                     advDoorTree.ExpandAll();
                     lock (this)
                     {
                         _isloaded = true;
                         if (_loadEnded != null)
                         {
                             _loadEnded(this, e);
                         }
                     }
                 }));
             }
             catch (Exception ex)
             {
                 WinInfoHelper.ShowInfoWindow(this, "门禁列表加载异常:" + ex.Message);
                 this.Invoke(new Action(() =>
                 {
                     lock (this)
                     {
                         _isloaded = true;
                         if (_loadEnded != null)
                         {
                             _loadEnded(this, e);
                         }
                     }
                 }));
             }
         });
         ctrlWaiting.Show(this, 300);
     }
 }
Esempio n. 4
0
        private void Init()
        {
            modelTree.Nodes[0].Nodes.Clear();
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_MAP_INFO mapBll = new Maticsoft.BLL.SMT_MAP_INFO();
                    var maps = mapBll.GetModelListWithDoors("1=1");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in maps)
                        {
                            AddTree(item);
                        }
                        modelTree.ExpandAll();
                    }));
                    try
                    {
                        if (DoorDataHelper.LastDoors == null)
                        {
                            DoorDataHelper.GetDoors();
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Error("初始化门禁异常:", ex);
                    }
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载地图列表异常:" + ex.Message);
                    log.Error("加载地图列表异常:", ex);
                }
            });

            waiting.Show(this);
        }
Esempio n. 5
0
        private void Init()
        {
            dtpStart.Value = DateTime.Now.Date;
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                var depts = DeptDataHelper.GetDepts(false);
                var doors = DoorDataHelper.GetDoors();
                var areas = AreaDataHelper.GetAreas();

                this.Invoke(new Action(() =>
                {
                    var deptNodes = DeptDataHelper.ToTree(depts);
                    Node deptNone = new Node("--无--");
                    deptNodes.Insert(0, deptNone);

                    cboDeptTree.Nodes.AddRange(deptNodes.ToArray());
                    cboDeptTree.SelectedNode = deptNone;

                    foreach (Node item in cboDeptTree.Nodes)
                    {
                        item.Expand();
                    }

                    var doorNodes = DoorDataHelper.ToTree(areas, doors);

                    cboDoorTree.Nodes.AddRange(doorNodes.ToArray());

                    foreach (Node item in cboDoorTree.Nodes)
                    {
                        item.ExpandAll();
                    }
                }));
            });

            waiting.Show(this, 300);
        }
Esempio n. 6
0
        private void InitDoors()
        {
            CtrlWaiting ctrlWaiting = new CtrlWaiting(() =>
            {
                try
                {
                    var doors = DoorDataHelper.GetDoors();
                    var areas = AreaDataHelper.GetAreas();
                    this.Invoke(new Action(() =>
                    {
                        var nodes = DoorDataHelper.ToTree(areas, doors);
                        cboDoor.Nodes.Clear();
                        cboDoor.Nodes.AddRange(nodes.ToArray());
                        cboDoor.AdvTree.ExpandAll();
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "门禁列表加载异常:" + ex.Message);
                }
            });

            ctrlWaiting.Show(this, 300);
        }
Esempio n. 7
0
        private void Init()
        {
            if (_task != null)
            {
                this.Text          = "编辑定时任务";
                tbTaskName.Text    = _task.TASK_NAME;
                tbTaskDesc.Text    = _task.TASK_DESC;
                tbTaskNum.Text     = _task.TASK_NO;
                dtpStartDate.Value = _task.VALID_STARTDATE;
                dtpEndDate.Value   = _task.VALID_ENDDATE;
                dtiTime.Value      = DateTime.Now.Date + _task.ACTION_TIME;
                if (_task.CTRL_STYLE >= 0 && _task.CTRL_STYLE <= 12)
                {
                    cboCtrlStyle.SelectedIndex = _task.CTRL_STYLE;
                }
                cbWeek1.Checked = _task.MON_STATE;
                cbWeek2.Checked = _task.TUE_STATE;
                cbWeek3.Checked = _task.THI_STATE;
                cbWeek4.Checked = _task.WES_STATE;
                cbWeek5.Checked = _task.FRI_STATE;
                cbWeek6.Checked = _task.SAT_STATE;
                cbWeek7.Checked = _task.SUN_STATE;
                if (_isview)
                {
                    tbTaskName.ReadOnly  = true;
                    this.Text            = "查看定时任务";
                    tbTaskDesc.ReadOnly  = true;
                    tbTaskNum.ReadOnly   = true;
                    dtpStartDate.Enabled = false;
                    dtpEndDate.Enabled   = false;
                    dtiTime.Enabled      = false;
                    cboCtrlStyle.Enabled = false;
                    cbWeek1.Enabled      = false;
                    cbWeek2.Enabled      = false;
                    cbWeek3.Enabled      = false;
                    cbWeek4.Enabled      = false;
                    cbWeek5.Enabled      = false;
                    cbWeek6.Enabled      = false;
                    cbWeek7.Enabled      = false;
                    btnOk.Visible        = false;
                    btnCancel.Text       = "关闭";
                }
            }
            else
            {
                this.Text = "添加定时任务";
                cboCtrlStyle.SelectedIndex = 0;
                dtiTime.Value = DateTime.Now;
            }
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                var doors = DoorDataHelper.GetDoors();
                var areas = AreaDataHelper.GetAreas();

                this.Invoke(new Action(() =>
                {
                    var doorNodes = DoorDataHelper.ToTree(areas, doors);
                    //cboDoorTree.Nodes.Add(new Node("--所有门禁--"));
                    doorTree.Nodes.Clear();
                    doorTree.Nodes.AddRange(doorNodes.ToArray());

                    if (_task != null && doorTree.Nodes.Count > 0)
                    {
                        if (!string.IsNullOrWhiteSpace(_task.DOOR_ID))
                        {
                            if (_task.DOOR_ID == "-1")
                            {
                                doorTree.Nodes[0].Checked = true;
                                doorTree.SetAllCheckState(true);
                            }
                            else
                            {
                                string[] doorIds       = _task.DOOR_ID.Split(',');
                                List <decimal> doorIdd = new List <decimal>();
                                foreach (var id in doorIds)
                                {
                                    decimal dd;
                                    if (decimal.TryParse(id, out dd))
                                    {
                                        doorIdd.Add(decimal.Parse(id));
                                    }
                                }
                                var nodes = doorTree.GetNodeList(typeof(Maticsoft.Model.SMT_DOOR_INFO));
                                foreach (var item in nodes)
                                {
                                    if (doorIdd.Contains(((Maticsoft.Model.SMT_DOOR_INFO)item.Tag).ID))
                                    {
                                        item.Checked = true;
                                    }
                                }
                            }
                            ShowDoorText();
                        }
                    }

                    foreach (Node item in doorTree.Nodes)
                    {
                        item.ExpandAll();
                    }
                }));
            });

            waiting.Show(this, 300);
        }