コード例 #1
0
        List <string> DeviceIDs; //选中设备ID
        public InformationManagement()
        {
            InitializeComponent();
            DeviceIDs = new List <string>();

            Access.Connection();
            #region 录像管理初始化
            //获得记录总条数
            RecCount = RecFileClass.GetRecPageCount(new RecQueryStatement());
            DataSet r_ds = RecFileClass.SelectRecInfo("1", comboBox1.Text, new RecQueryStatement());
            dataGridView1.DataSource = r_ds;
            dataGridView1.DataMember = "RecFileList";
            label2.Text = "当前页" + dataGridView1.Rows.Count + "条记录/共" + RecCount + "条记录";
            //填充用户名
            List <string> r_usernames = RecFileClass.GetUserNames();
            comboBox3.DataSource = r_usernames;
            #endregion

            #region 图片管理初始化
            //获得记录总条数
            PicCount = RecPictureClass.GetPicPageCount(new PicQueryStatement());
            DataSet p_ds = RecPictureClass.SelectPictureInfo("1", comboBox6.Text, new PicQueryStatement());
            dataGridView2.DataSource = p_ds;
            dataGridView2.DataMember = "RecPictureList";
            label13.Text             = "当前页" + dataGridView2.Rows.Count + "条记录/共" + PicCount + "条记录";
            //填充用户名
            List <string> p_usernames = RecPictureClass.GetUserNames();
            comboBox5.DataSource = p_usernames;
            #endregion

            #region 用户日志初始化
            //获得记录总条数
            UserLogCount = UserLogClass.GetUserLogPageCount(new UserLogQueryStatement());
            DataSet u_ds = UserLogClass.SelectUserLogInfo("1", comboBox7.Text, new UserLogQueryStatement());
            dataGridView3.DataSource = u_ds;
            dataGridView3.DataMember = "UserLog";
            label17.Text             = "当前页" + dataGridView3.Rows.Count + "条记录/共" + UserLogCount + "条记录";
            //填充用户名
            List <string> u_usernames = UserLogClass.GetUserNames();
            comboBox4.DataSource = u_usernames;
            #endregion

            #region 运行日志初始化
            RunLogCount = RunLogClass.GetRunLogPageCount(new RunLogQueryStatement());
            DataSet run_ds = RunLogClass.SelectRunLogInfo("1", comboBox9.Text, new RunLogQueryStatement());
            dataGridView4.DataSource = run_ds;
            dataGridView4.DataMember = "RunLog";
            label23.Text             = "当前页" + dataGridView4.Rows.Count + "条记录/共" + RunLogCount + "条记录";
            //填充日志类型
            List <string> run_operation = RunLogClass.GetOperations();
            comboBox8.DataSource = run_operation;
            #endregion


            #region 添加设备节点
            Thread th = new Thread(new ThreadStart(Init));
            th.IsBackground = true;
            th.Start();
            #endregion
        }
コード例 #2
0
        /// <summary>
        /// 接收服务器返回的用户登录验证结果
        /// </summary>
        private void ReceiveData()
        {
            string responseData = string.Empty;

            byte[] data  = new byte[1024 * 100];
            Int64  bytes = CommunicationClass.stream2.Read(data, 0, data.Length);

            responseData = Encoding.UTF8.GetString(data, 0, (int)bytes);
            responseData = responseData.Replace("\r\n", "");
            string[] str = responseData.Split(new char[] { '_' });
            UserLog  log = new UserLog();

            log.UserName      = username;
            log.OperationDate = DateTime.Now.ToString("yyyy-MM-dd");
            log.OperationTime = DateTime.Now.ToString("HH:mm:ss");
            log.Operation     = "用户登录";
            string errorInfo = "";

            switch (str[0])
            {
            case "True":
                result = DialogResult.OK;
                CheckForIllegalCrossThreadCalls = false;
                Close();
                log.Description = "成功";
                break;

            case "False":
                log.Description = "失败";
                MessageBox.Show("登录失败!");
                break;
            }
            UserLogClass.InsertData(log, ref errorInfo);
            if (str.Length == 2 && str[1] != "")
            {
                try
                {
                    Class1.loginUserInfomation = JsonConvert.DeserializeObject <LoginUserInfomation>(str[1]);
                }
                catch (Exception ex)
                { }
            }
        }
コード例 #3
0
        /// <summary>
        /// 查询用户日志
        /// </summary>
        public void UserLogShow(string currentPage)
        {
            UserLogQueryStatement qs = new UserLogQueryStatement();

            if (comboBox4.Text != "")
            {
                qs.Name = comboBox4.Text;
            }
            if (comboBox10.Text != "")
            {
                qs.Operation = comboBox10.Text;
            }
            if (checkBox12.Checked)
            {
                qs.StartDate = dateTimePicker4.Text.ToString();
            }
            if (checkBox10.Checked)
            {
                qs.StartTime = maskedTextBox4.Text.ToString();
            }
            if (checkBox11.Checked)
            {
                qs.EndDate = dateTimePicker3.Text.ToString();
            }
            if (checkBox9.Checked)
            {
                qs.EndTime = maskedTextBox3.Text.ToString();
            }
            string  errorInfo = "";
            DataSet ds        = UserLogClass.SelectUserLogInfo(currentPage, comboBox7.Text, qs, ref errorInfo);

            if (ds == null)
            {
                MessageBox.Show(errorInfo);
            }
            UserLogCount             = UserLogClass.GetUserLogPageCount(qs, ref errorInfo);
            dataGridView3.DataSource = ds;
            dataGridView3.DataMember = "UserLog";
            UserPageBtn.Text         = currentPage;
            label17.Text             = "当前页" + dataGridView3.Rows.Count + "条记录 / 共" + UserLogCount + "条记录";
        }
コード例 #4
0
        public InformationManagement()
        {
            InitializeComponent();
            DeviceIDs = new List <string>();
            #region 录像管理初始化
            //获得记录总条数
            RecCount = RecFileClass.GetRecPageCount(new RecQueryStatement(), ref errorInfo);
            DataSet r_ds = RecFileClass.SelectRecInfo("1", "10", new RecQueryStatement(), ref errorInfo);
            if (r_ds == null)
            {
                MessageBox.Show(errorInfo + ",获取录像管理信息失败!");
            }
            dataGridView1.DataSource = r_ds;
            dataGridView1.DataMember = "RecFileList";
            label2.Text = "当前页" + dataGridView1.Rows.Count + "条记录/共" + RecCount + "条记录";
            //填充用户名
            List <string> r_usernames = RecFileClass.GetUserNames(ref errorInfo);
            comboBox3.DataSource = r_usernames;
            #endregion

            #region 图片管理初始化
            //获得记录总条数
            PicCount = RecPictureClass.GetPicPageCount(new PicQueryStatement(), ref errorInfo);
            //if (PicCount == -1) MessageBox.Show(errorInfo);
            DataSet p_ds = RecPictureClass.SelectPictureInfo("1", "10", new PicQueryStatement(), ref errorInfo);
            if (p_ds == null)
            {
                MessageBox.Show(errorInfo + ",获取图片管理信息失败!");
            }
            dataGridView2.DataSource = p_ds;
            dataGridView2.DataMember = "RecPictureList";
            label13.Text             = "当前页" + dataGridView2.Rows.Count + "条记录/共" + PicCount + "条记录";
            //填充用户名
            List <string> p_usernames = RecPictureClass.GetUserNames(ref errorInfo);
            comboBox5.DataSource = p_usernames;
            #endregion

            #region 用户日志初始化
            //获得记录总条数
            UserLogCount = UserLogClass.GetUserLogPageCount(new UserLogQueryStatement(), ref errorInfo);
            DataSet u_ds = UserLogClass.SelectUserLogInfo("1", "10", new UserLogQueryStatement(), ref errorInfo);
            if (u_ds == null)
            {
                MessageBox.Show(errorInfo + ",获取用户日志信息失败!");
            }
            dataGridView3.DataSource = u_ds;
            dataGridView3.DataMember = "UserLog";
            label17.Text             = "当前页" + dataGridView3.Rows.Count + "条记录/共" + UserLogCount + "条记录";
            //填充用户名
            List <string> u_usernames = UserLogClass.GetUserNames(ref errorInfo);
            comboBox4.DataSource = u_usernames;
            //填充用户操作
            List <string> u_operation = UserLogClass.GetOperations(ref errorInfo);
            comboBox10.DataSource = u_operation;
            #endregion

            #region 运行日志初始化
            RunLogCount = RunLogClass.GetRunLogPageCount(new RunLogQueryStatement(), ref errorInfo);
            DataSet run_ds = RunLogClass.SelectRunLogInfo("1", "10", new RunLogQueryStatement(), ref errorInfo);
            if (run_ds == null)
            {
                MessageBox.Show(errorInfo + ",获取运行日志信息失败!");
            }
            dataGridView4.DataSource = run_ds;
            dataGridView4.DataMember = "RunLog";
            label23.Text             = "当前页" + dataGridView4.Rows.Count + "条记录/共" + RunLogCount + "条记录";
            //填充日志类型
            List <string> run_operation = RunLogClass.GetOperations(ref errorInfo);
            comboBox8.DataSource = run_operation;
            #endregion


            #region 添加设备节点
            Thread th = new Thread(new ThreadStart(Init));
            th.IsBackground = true;
            th.Start();
            #endregion
            treeView1.ExpandAll();
        }