예제 #1
0
        private void VerCodeInfo_Load(object sender, EventArgs e)
        {
            cboVerType.SelectedIndex = 0;
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_VER_FORMAT verformat = new Maticsoft.BLL.SMT_VER_FORMAT();
                    var list = verformat.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in list)
                        {
                            DoAddToGrid(item);
                        }
                    }));
                }
                catch (System.Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载失败:" + ex.Message);
                    log.Error("加载失败:", ex);
                }
            });

            waiting.Show(this, 300);
        }
예제 #2
0
        private void FrmSelectedUser_Load(object sender, EventArgs e)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_USER_INFO userBll = new Maticsoft.BLL.SMT_USER_INFO();
                    var models = userBll.GetModelList("IS_DELETE!=1");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in models)
                        {
                            Node node = new Node(item.USER_NAME + "[" + item.REAL_NAME + "]");
                            node.Tag  = item;
                            advTree.Nodes[0].Nodes.Add(node);
                            if (_selectUserIds.Contains(item.ID))
                            {
                                node.Checked = true;
                            }
                        }
                        advTree.Nodes[0].ExpandAll();
                    }));
                }
                catch (System.Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载用户异常!" + ex.Message);
                }
            });

            waiting.Show(this);
        }
예제 #3
0
        //初始化树
        private void InitTree()
        {
            modelTree.Nodes[0].Nodes.Clear();
            try
            {
                string path = Path.Combine(Application.StartupPath, "vermodes");
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                else
                {
                    string[] files = Directory.GetFiles(path, "*.fpx");
                    foreach (var item in files)
                    {
                        FileInfo fi   = new FileInfo(item);
                        Node     node = new Node(fi.Name);
                        node.Tag = fi;
                        modelTree.Nodes[0].Nodes.Add(node);
                    }
                }
            }
            catch (Exception ex)
            {
                log.Error("获取示例模板异常:", ex);
            }

            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                InternalInitTree();
            });

            waiting.Show(this, 300);
        }
예제 #4
0
        private void AttendanceInfo_Load(object sender, EventArgs e)
        {
            dtpStart.Value = DateTime.Now.Date.AddDays(-7);
            dtpEnd.Value   = DateTime.Now.Date;
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                var depts = DeptDataHelper.GetDepts(false);
                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();
                    }
                }));
            });

            waiting.Show(this);
        }
예제 #5
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (tbRoleName.Text.Trim() == "")
     {
         WinInfoHelper.ShowInfoWindow(this, "角色名称不能为空!");
         return;
     }
     if (_selectRow != null && dgvData.Rows.Contains(_selectRow))
     {
         Maticsoft.Model.SMT_ROLE_INFO role = (Maticsoft.Model.SMT_ROLE_INFO)_selectRow.Tag;
         role.ROLE_NAME = tbRoleName.Text.Trim();
         role.ROLE_DESC = tbRoleDesc.Text.Trim();
         CtrlWaiting waiting = new CtrlWaiting(() =>
         {
             try
             {
                 Maticsoft.BLL.SMT_ROLE_INFO roleBll = new Maticsoft.BLL.SMT_ROLE_INFO();
                 roleBll.Update(role);
                 SmtLog.InfoFormat("用户", "更新角色:ID={0},名称={1}", role.ID, role.ROLE_NAME);
                 this.Invoke(new Action(() =>
                 {
                     _selectRow.Cells[0].Value = role.ROLE_NAME;
                     _selectRow.Cells[1].Value = role.ROLE_DESC;
                 }));
             }
             catch (Exception ex)
             {
                 log.Error("更新角色异常:", ex);
                 WinInfoHelper.ShowInfoWindow(this, "更新角色异常:" + ex.Message);
             }
         });
         waiting.Show(this);
     }
 }
예제 #6
0
 private void dgvRoleInfos_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
     {
         if (dgvRoleInfos.Columns[e.ColumnIndex].Name != "ColDelete")
         {
             Maticsoft.Model.SMT_ROLE_INFO role = (Maticsoft.Model.SMT_ROLE_INFO)dgvRoleInfos.Rows[e.RowIndex].Tag;
             CtrlWaiting waiting = new CtrlWaiting(() =>
             {
                 try
                 {
                     Maticsoft.BLL.SMT_USER_INFO userBll = new Maticsoft.BLL.SMT_USER_INFO();
                     var list = userBll.GetModelListByPageEx("ROLE_ID=" + role.ID + " and IS_DELETE=0 and IS_ENABLE=1", "USER_NAME", 0, 100);
                     this.Invoke(new Action(() =>
                     {
                         DoShowUsersToGrid2(list);
                     }));
                 }
                 catch (Exception ex)
                 {
                     WinInfoHelper.ShowInfoWindow(this, "加载权限操作人错误:" + ex.Message);
                     log.Error("加载权限操作人错误:", ex);
                 }
             });
             waiting.Show(dgvRoleInfos);
         }
     }
 }
예제 #7
0
        private void Init()
        {
            mapCtrl.ClearDoors();
            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();
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载地图列表异常:" + ex.Message);
                    log.Error("加载地图列表异常:", ex);
                }
            });

            waiting.Show(this);
        }
예제 #8
0
        private void DoSelectRow(DataGridViewRow row)
        {
            selectRow = row;
            Maticsoft.Model.SMT_ALARM_SETTING alarmSetting = (Maticsoft.Model.SMT_ALARM_SETTING)selectRow.Tag;
            tbForcePwd.Text = alarmSetting.CTRL_FORCE_PWD;
            iUnClosedTimeOut.ValueObject = alarmSetting.NOT_CLOSED_TIMEOUT;
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_ALARM_CONNECT connBll        = new Maticsoft.BLL.SMT_ALARM_CONNECT();
                    List <Maticsoft.Model.SMT_ALARM_CONNECT> conns = connBll.GetModelList("CTRL_ID=" + alarmSetting.CTRL_ID);
                    this.Invoke(new Action(() =>
                    {
                        DoShowAlarm(alarmSetting, conns);
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "配置加载异常:" + ex.Message);
                    log.Error("报警联动配置加载异常:", ex);
                }
            });

            waiting.Show(this);
        }
예제 #9
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);
        }
예제 #10
0
        private void pageDataGridView1_PageControl_ExportAll(object sender, Li.Controls.PageEventArgs args)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_LOG_INFO logBll = new Maticsoft.BLL.SMT_LOG_INFO();
                    var models   = logBll.GetModelList(pageDataGridView.SqlWhere + " order by OPR_TIME desc");
                    DataTable dt = new DataTable();

                    foreach (DataGridViewColumn item in dgvData.Columns)
                    {
                        dt.Columns.Add(item.HeaderText);
                    }
                    foreach (var item in models)
                    {
                        string str = "信息";
                        switch (item.LOG_LEVEL)
                        {
                        case 0:
                            str = "调试";
                            break;

                        case 1:
                            str = "信息";
                            break;

                        case 2:
                            str = "警告";
                            break;

                        case 3:
                            str = "错误";
                            break;

                        default:
                            break;
                        }
                        DataRow row = dt.NewRow();
                        row[0]      = item.OPR_REALNAME;
                        row[1]      = item.OPR_TIME;
                        row[2]      = str;
                        row[3]      = item.LOG_TYPE;
                        row[4]      = item.OPR_CONTENT;
                        dt.Rows.Add(row);
                    }
                    this.Invoke(new Action(() =>
                    {
                        ExportHelper.ExportEx(dt, "操作日志" + dtpStart.Value.ToString("yyyyMMddHHmmss") + "_" + dtpEnd.Value.ToString("yyyyMMddHHmmss") + ".xls", "操作日志" + dtpStart.Value.ToString("yyyyMMddHHmmss") + "_" + dtpEnd.Value.ToString("yyyyMMddHHmmss"));
                    }));
                }
                catch (System.Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "导出操作日志异常:" + ex.Message);
                    log.Error("导出操作日志异常:", ex);
                }
            });

            waiting.Show(this);
        }
예제 #11
0
        private void DoSearch(bool searchCount = false)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_LOG_INFO logBll = new Maticsoft.BLL.SMT_LOG_INFO();
                    if (searchCount)
                    {
                        int count = logBll.GetRecordCount(pageDataGridView.SqlWhere);
                        this.Invoke(new Action(() =>
                        {
                            pageDataGridView.Reset();
                            pageDataGridView.PageControl.TotalRecords = count;
                        }));
                    }
                    var ds     = logBll.GetListByPage(pageDataGridView.SqlWhere, "OPR_TIME desc", pageDataGridView.PageControl.StartIndex, pageDataGridView.PageControl.EndIndex);
                    var models = logBll.DataTableToList(ds.Tables[0]);
                    this.Invoke(new Action(() =>
                    {
                        ShowModels(models);
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "查询日志异常:" + ex.Message);
                    log.Error("查询日志异常:", ex);
                }
            });

            waiting.Show(this);
        }
예제 #12
0
        private void DoSearch(int waitminisecond = 0)
        {
            CtrlWaiting ctrlWaiting = new CtrlWaiting("搜索控制器中...", new Action(() =>
            {
                if (waitminisecond > 0)
                {
                    Thread.Sleep(waitminisecond);//需要等待控制器修改IP后重启
                }
                IAccessCore access       = new WGAccess();
                List <Controller> ctrlrs = access.SearchController();
                var dataCtrls            = ControllerHelper.GetList("1=1", false);
                if (ctrlrs == null || ctrlrs.Count == 0)
                {
                    WinInfoHelper.ShowInfoWindow(this, "没有查询到控制器!", 5);
                }
                else
                {
                    this.Invoke(new Action(() =>
                    {
                        AddControllerToGrid(ctrlrs, dataCtrls);
                    }));
                }
            }));

            ctrlWaiting.Show(this);
        }
예제 #13
0
        private void DoAddCtrlr(DataGridViewRow row)
        {
            Controller  ctrlr       = (Controller)row.Tag;
            CtrlWaiting ctrlWaiting = new CtrlWaiting("添加控制...", () =>
            {
                try
                {
                    Maticsoft.Model.SMT_CONTROLLER_INFO info = ControllerHelper.AddController(ctrlr);
                    if (info != null)
                    {
                        log.Info("添加控制器成功:" + ctrlr.sn + "," + ctrlr.ip);
                        WinInfoHelper.ShowInfoWindow(this, "添加/更新控制器成功,请编辑控制器参数.");
                        Changed = true;
                        this.Invoke(new Action(() =>
                        {
                            FrmAddOrModifyCtrlr modify = new FrmAddOrModifyCtrlr(info);
                            modify.ShowDialog(this);
                        }));
                    }
                    else
                    {
                        log.Warn("添加控制器失败:" + ctrlr.sn + "," + ctrlr.ip);
                        WinInfoHelper.ShowInfoWindow(this, "添加/更新控制器失败!");
                    }
                }
                catch (Exception ex)
                {
                    log.Error("添加控制器异常:", ex);
                    WinInfoHelper.ShowInfoWindow(this, "添加/更新控制器失败:" + ex.Message);
                }
            });

            ctrlWaiting.Show(this);
        }
예제 #14
0
        private void tsmiResetRecord_Click(object sender, EventArgs e)
        {
            DataGridViewRow row = GetSelectRow();

            if (row == null)
            {
                WinInfoHelper.ShowInfoWindow(this, "未有选择控制器!");
                return;
            }
            Maticsoft.Model.SMT_CONTROLLER_INFO ctrlInfo = (Maticsoft.Model.SMT_CONTROLLER_INFO)row.Tag;
            if (MessageBox.Show("确定恢复该控制器" + ctrlInfo.NAME + "记录读取?", "确定", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return;
            }

            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    IAccessCore acc = new WGAccess();
                    var c           = ControllerHelper.ToController(ctrlInfo);
                    bool ret        = acc.SetControllerReadedIndex(c, 0);
                    WinInfoHelper.ShowInfoWindow(this, "恢复控制器" + ctrlInfo.NAME + "记录" + (ret ? "成功!" : "失败!"));
                }
                catch (Exception ex)
                {
                    log.Error("恢复控制器记录异常:", ex);
                    WinInfoHelper.ShowInfoWindow(this, "恢复控制器" + ctrlInfo.NAME + "记录异常:" + ex.Message);
                }
            });

            waiting.Show(this);
        }
예제 #15
0
        private void DoSave()
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                decimal?old = _userInfo.ROLE_ID;
                try
                {
                    _userInfo.ROLE_ID = SELECT_ROLE.ID;
                    Maticsoft.BLL.SMT_USER_INFO userBll = new Maticsoft.BLL.SMT_USER_INFO();
                    userBll.Update(_userInfo);
                    SmtLog.InfoFormat("用户", "修改用户:{0},角色:{1}成功.", _userInfo.USER_NAME, _userInfo.ROLE_ID + ":" + SELECT_ROLE.ROLE_NAME);
                    this.Invoke(new Action(() =>
                    {
                        _userInfo.ROLE_NAME = SELECT_ROLE.ROLE_NAME + "(点击修改)";
                        this.DialogResult   = DialogResult.OK;
                        this.Close();
                    }));
                }
                catch (Exception ex)
                {
                    _userInfo.ROLE_ID = old;
                    WinInfoHelper.ShowInfoWindow(this, "保存失败:" + ex.Message);
                    log.Error("保存授权角色失败:", ex);
                }
            });

            waiting.Show(this);
        }
예제 #16
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);
        }
예제 #17
0
        private void dgvRoleInfos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                if (dgvRoleInfos.Columns[e.ColumnIndex].Name == "ColDelete")
                {
                    if (MessageBox.Show("确定删除选择角色?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        var orgInfo = GetSelectOrg();
                        Maticsoft.Model.SMT_ROLE_INFO role = (Maticsoft.Model.SMT_ROLE_INFO)dgvRoleInfos.Rows[e.RowIndex].Tag;

                        CtrlWaiting waiting = new CtrlWaiting(() =>
                        {
                            try
                            {
                                Maticsoft.DBUtility.DbHelperSQL.ExecuteSql("delete from SMT_ROLE_FUN  where FUN_ID=" + orgInfo.ID + " and ROLE_TYPE=2 and ROLE_ID=" + role.ID);
                                this.Invoke(new Action(() =>
                                {
                                    dgvRoleInfos.Rows.RemoveAt(e.RowIndex);
                                }));
                            }
                            catch (System.Exception ex)
                            {
                                WinInfoHelper.ShowInfoWindow(this, "删除角色异常:" + ex.Message);
                                log.Error("删除角色异常", ex);
                            }
                        });
                        waiting.Show(this);
                    }
                }
            }
        }
예제 #18
0
 private void dgvDoorCamera_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         if (e.ColumnIndex == 3)//删除
         {
             if (MessageBox.Show("确定删除该关联关系?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 DoorCamera  dc      = (DoorCamera)dgvDoorCamera.Rows[e.RowIndex].Tag;
                 CtrlWaiting waiting = new CtrlWaiting(() =>
                 {
                     try
                     {
                         Maticsoft.BLL.SMT_DOOR_CAMERA dcBll = new Maticsoft.BLL.SMT_DOOR_CAMERA();
                         dcBll.Delete(dc.DOOR_ID, dc.CAMERA_ID);
                         this.Invoke(new Action(() =>
                         {
                             dgvDoorCamera.Rows.Remove(dgvDoorCamera.Rows[e.RowIndex]);
                         }));
                     }
                     catch (Exception ex)
                     {
                         log.Error("删除门禁相机关系异常:", ex);
                         WinInfoHelper.ShowInfoWindow(this, "删除门禁相机关系异常:" + ex.Message);
                     }
                 });
                 waiting.Show(this);
             }
         }
     }
 }
예제 #19
0
 private void dgvData_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
     {
         if (dgvData.Columns[e.ColumnIndex].Name == "ColDelete")
         {
             Maticsoft.Model.SMT_WEEKEX_INFO info = (Maticsoft.Model.SMT_WEEKEX_INFO)dgvData.Rows[e.RowIndex].Tag;
             if (MessageBox.Show("确定删除该假期约束?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
             {
                 CtrlWaiting waiting = new CtrlWaiting(() =>
                 {
                     try
                     {
                         Maticsoft.BLL.SMT_WEEKEX_INFO wbll = new Maticsoft.BLL.SMT_WEEKEX_INFO();
                         wbll.Delete(info.ID);
                         SmtLog.InfoFormat("设置", "删除假期约束:{0},开始时间:{1},结束时间:{2},描述:{3}", info.WEEKEX_ON_DUTY ? "上班[允许开门]" : "假期[不能开门]", info.WEEKEX_START_DATE, info.WEEKEX_END_DATE, info.WEEKEX_DESC);
                         this.Invoke(new Action(() =>
                         {
                             dgvData.Rows.Remove(dgvData.Rows[e.RowIndex]);
                         }));
                     }
                     catch (System.Exception ex)
                     {
                         WinInfoHelper.ShowInfoWindow(this, "删除假期约束异常:" + ex.Message);
                         log.Error("删除假期约束异常:", ex);
                     }
                 });
                 waiting.Show(this);
             }
         }
     }
 }
예제 #20
0
 private void dgvDoorCamera_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         if (e.ColumnIndex == 2)
         {
             bool        enable  = (bool)dgvDoorCamera.Rows[e.RowIndex].Cells[2].Value;
             DoorCamera  dc      = (DoorCamera)dgvDoorCamera.Rows[e.RowIndex].Tag;
             CtrlWaiting waiting = new CtrlWaiting(() =>
             {
                 try
                 {
                     Maticsoft.BLL.SMT_DOOR_CAMERA dcBll     = new Maticsoft.BLL.SMT_DOOR_CAMERA();
                     Maticsoft.Model.SMT_DOOR_CAMERA dcModel = new Maticsoft.Model.SMT_DOOR_CAMERA()
                     {
                         DOOR_ID    = dc.DOOR_ID,
                         CAMERA_ID  = dc.CAMERA_ID,
                         ENABLE_CAP = !enable
                     };
                     dcBll.Update(dcModel);
                     this.Invoke(new Action(() =>
                     {
                         dgvDoorCamera.Rows[e.RowIndex].Cells[2].Value = dcModel.ENABLE_CAP;
                     }));
                 }
                 catch (System.Exception ex)
                 {
                     log.Error("更新门禁相机关系异常:", ex);
                     WinInfoHelper.ShowInfoWindow(this, "更新门禁相机关系异常:" + ex.Message);
                 }
             });
             waiting.Show(this);
         }
     }
 }
예제 #21
0
        private void Init()
        {
            this.dgvData.Rows.Clear();
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_TIMESCALE_INFO tsBll = new Maticsoft.BLL.SMT_TIMESCALE_INFO();
                    var models = tsBll.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in models)
                        {
                            AddData(item);
                        }
                    }));
                }
                catch (Exception ex)
                {
                    log.Error("加载列表异常:" + ex.Message);
                    WinInfoHelper.ShowInfoWindow(this, "加载列表异常:" + ex.Message);
                }
            });

            waiting.Show(this);
        }
예제 #22
0
        private void DoLoadByArea(List <Maticsoft.Model.SMT_CONTROLLER_ZONE> areas, string filter = null)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    string strWhere = "1=1";
                    if (areas != null && areas.Count > 0)
                    {
                        strWhere = "AREA_ID in (";
                        foreach (var item in areas)
                        {
                            strWhere += item.ID + ",";
                        }
                        strWhere  = strWhere.TrimEnd(',');
                        strWhere += ")";
                    }
                    List <Maticsoft.Model.SMT_FACERECG_DEVICE> ctrls = FaceRecgHelper.GetList(strWhere, true);//获取所有人脸设备
                    this.Invoke(new Action(() =>
                    {
                        ShowDevs(ctrls, filter);
                    }));
                }
                catch (System.Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载人脸识别设备异常:" + ex.Message);
                    log.Error("加载人脸识别设备异常:", ex);
                }
            });

            waiting.Show(this);
        }
예제 #23
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (tbRoleName.Text.Trim() == "")
            {
                WinInfoHelper.ShowInfoWindow(this, "角色名称不能为空!");
                return;
            }
            Maticsoft.Model.SMT_ROLE_INFO role = new Maticsoft.Model.SMT_ROLE_INFO();
            role.ROLE_NAME = tbRoleName.Text.Trim();
            role.ROLE_DESC = tbRoleName.Text.Trim();
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_ROLE_INFO roleBll = new Maticsoft.BLL.SMT_ROLE_INFO();
                    role.ID = roleBll.Add(role);
                    SmtLog.InfoFormat("用户", "添加角色:ID={0},名称={1}", role.ID, role.ROLE_NAME);
                    this.Invoke(new Action(() =>
                    {
                        AddModel(role);
                    }));
                }
                catch (Exception ex)
                {
                    log.Error("添加角色异常:", ex);
                    WinInfoHelper.ShowInfoWindow(this, "添加角色异常:" + ex.Message);
                }
            });

            waiting.Show(this);
        }
예제 #24
0
        private void biDeleteModel_Click(object sender, EventArgs e)
        {
            var model = GetSelectModel();

            if (model == null)
            {
                WinInfoHelper.ShowInfoWindow(this, "请选择删除的模板!");
            }
            else
            {
                if (MessageBox.Show("确定删除“" + model.VERM_NAME + "”模板?", "提示", MessageBoxButtons.OKCancel) == DialogResult.OK)
                {
                    CtrlWaiting waiting = new CtrlWaiting(() =>
                    {
                        try
                        {
                            Maticsoft.BLL.SMT_VERMODEL_INFO bll = new Maticsoft.BLL.SMT_VERMODEL_INFO();
                            bll.Delete(model.ID);
                            _lastSelectModel = null;
                            InternalInitTree();
                        }
                        catch (Exception ex)
                        {
                            log.Error("删除模板异常:" + ex.Message);
                            WinInfoHelper.ShowInfoWindow(this, "删除模板异常:" + ex.Message);
                        }
                    });
                    waiting.Show(this);
                }
            }
        }
예제 #25
0
        private void FrmRoleMgr_Load(object sender, EventArgs e)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_ROLE_INFO roleBll = new Maticsoft.BLL.SMT_ROLE_INFO();
                    var models = roleBll.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        foreach (var item in models)
                        {
                            AddModel(item);
                        }
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载角色异常:" + ex.Message);
                    log.Error("加载角色异常:", ex);
                }
            });

            waiting.Show(this, 300);
        }
예제 #26
0
        private void DoLoadArea()
        {
            CtrlWaiting ctrlWaiting = new CtrlWaiting(() =>
            {
                var areas = AreaDataHelper.GetAreas();
                if (areas.Count > 0)
                {
                    this.Invoke(new Action(() =>
                    {
                        var nodes = AreaDataHelper.ToTree(areas);
                        nodes.Insert(0, new DevComponents.AdvTree.Node("--无--"));
                        cboTreeArea.Nodes.AddRange(nodes.ToArray());
                        foreach (var item in nodes)
                        {
                            item.Expand();
                        }
                        if (_dev != null && _dev.AREA_ID >= 0)
                        {
                            DevComponents.AdvTree.Node node = FindNode((decimal)_dev.AREA_ID);
                            if (node != null)
                            {
                                cboTreeArea.SelectedNode = node;
                            }
                        }
                    }));
                }
            });

            ctrlWaiting.Show(this, 300);
        }
예제 #27
0
        private void pageDataGridView_PageControl_ExportAll(object sender, Li.Controls.PageEventArgs args)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    DataSet qds  = Maticsoft.DBUtility.DbHelperSQL.Query(sqlAll);
                    DataTable dt = qds.Tables[0];
                    if (dt.Rows.Count == 0)
                    {
                        WinInfoHelper.ShowInfoWindow(this, "没有记录导出!");
                        return;
                    }
                    dt = ToDataTable(dt);
                    this.Invoke(new Action(() =>
                    {
                        Li.Controls.Excel.ExportHelper.ExportEx(dt, "查验记录_" + dtpStart.Value.ToString("yyyyMMdd") + dtpEnd.Value.ToString("yyyyMMdd") + ".xls", "查验记录");
                    }));
                }
                catch (Exception ex)
                {
                    log.Error("导出记录异常:", ex);
                    WinInfoHelper.ShowInfoWindow(this, "导出记录异常:" + ex.Message);
                }
            });

            waiting.Show(this);
        }
예제 #28
0
        private void FaceBlackListMgr_Load(object sender, EventArgs e)
        {
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.IMS_FACE_BLACKLIST blBll = new Maticsoft.BLL.IMS_FACE_BLACKLIST();
                    var models = blBll.GetModelList("");
                    this.Invoke(new Action(() =>
                    {
                        listFaces.Items.Clear();
                        foreach (var item in models)
                        {
                            AddFace(item);
                        }
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载人脸黑名单异常:" + ex.Message);
                    log.Error("加载人脸黑名单异常", ex);
                }
            });

            waiting.Show(this);
        }
예제 #29
0
        private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
            {
                if (dgvData.Columns[e.ColumnIndex].Name == "ColDelete")
                {
                    Maticsoft.BLL.SMT_VER_FORMAT verBll = new Maticsoft.BLL.SMT_VER_FORMAT();
                    DataGridViewRow row = dgvData.Rows[e.RowIndex];
                    Maticsoft.Model.SMT_VER_FORMAT verModel = (Maticsoft.Model.SMT_VER_FORMAT)row.Tag;
                    if (MessageBox.Show("确定删除该证件编码?", "提示", MessageBoxButtons.OKCancel) != DialogResult.OK)
                    {
                        return;
                    }
                    CtrlWaiting waiting = new CtrlWaiting(() =>
                    {
                        try
                        {
                            verBll.Delete(verModel.ID);
                            this.Invoke(new Action(() =>
                            {
                                dgvData.Rows.Remove(row);
                            }));
                        }
                        catch (Exception ex)
                        {
                            log.Error("删除证件编码异常!", ex);

                            WinInfoHelper.ShowInfoWindow(this, "删除证件编码异常:" + ex.Message);
                        }
                    });
                    waiting.Show(this);
                }
            }
        }
예제 #30
0
        private void FaceDevPriMgr_Load(object sender, EventArgs e)
        {
            if (!UserInfoHelper.HasPrivate(SYS_FUN_POINT.STAFF_MGR))
            {
                biRegister.Visible           = false;
                dgvStaffs.Columns[6].Visible = false;
            }
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_FACERECG_DEVICE faceBll = new Maticsoft.BLL.SMT_FACERECG_DEVICE();
                    string strWhere = "";
                    if (!UserInfoHelper.IsManager)
                    {
                        strWhere = "ID IN (SELECT RF.FUN_ID FROM SMT_ROLE_FUN RF,SMT_USER_INFO UI WHERE RF.ROLE_TYPE=4 AND RF.ROLE_ID=UI.ROLE_ID AND UI.ID=" + UserInfoHelper.UserID + ")";
                    }
                    _faceDevices = faceBll.GetModelList(strWhere);
                    var areas    = AreaDataHelper.GetAreas();
                    this.Invoke(new Action(() =>
                    {
                        var nodes    = AreaDataHelper.ToTree(areas);
                        var faceDevs = _faceDevices.ToList();
                        foreach (var item in nodes)
                        {
                            DoCreateAreaDevice(item, faceDevs);
                        }

                        for (int i = faceDevs.Count - 1; i >= 0; i--)
                        {
                            var item      = faceDevs[i];
                            Node devNode  = new Node("<font color='blue'>" + item.FACEDEV_NAME + "</font>");
                            devNode.Image = Properties.Resources.editor;
                            devNode.Tag   = item;
                            nodes.Insert(0, devNode);
                        }
                        Node root  = new Node("所有人脸识别设备");
                        root.Image = Properties.Resources.house1818;
                        root.Nodes.AddRange(nodes.ToArray());
                        nodes.Clear();
                        nodes.Add(root);


                        advTree.Nodes.Clear();
                        advTree.Nodes.AddRange(nodes.ToArray());
                        advTree.ExpandAll();
                    }));

                    DoSearch(null, null, null);
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载人脸设备列表异常!" + ex.Message);
                    log.Error("加载人脸设备列表异常:", ex);
                }
            });

            waiting.Show(this);
        }