Beispiel #1
0
        public FormuserAdd(int parentLeft, int parentTop)
        {
            m_parentLeft = parentLeft;
            m_parentTop = parentTop;

            this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);
            InitializeComponent();

            //给combobox赋值并绑定id
            string strQuery = @" select * from department where depID = 3 and categroyID = " + DevTools.getDepartmentId();//categroyID = 1指公安,2指交警
            //dep =3 ,目前只显示派出所的
            ADOHelper db = new ADOHelper();
            comboBox_dep.DataSource = db.ExecuteGet(strQuery).Tables[0];
            comboBox_dep.DisplayMember = "depName";
            comboBox_dep.ValueMember = "depID";

            strQuery = @" select * from role where id > 5";                     //只列出除系统管理员外的人
            comboBox_role.DataSource = db.ExecuteGet(strQuery).Tables[0];
            comboBox_role.DisplayMember = "roleName";
            comboBox_role.ValueMember = "ID";

            db.Dispose();
        }
Beispiel #2
0
        //数据查询
        private void button_inquery_Click(object sender, EventArgs e)
        {
            string str = "#col like '%#value%' ";
            if (comboBox_queryCol.SelectedIndex == 0)
                str = str.Replace("#col", "采集人编号").Replace("#value", textBox_QueryKey.Text);
            else if (comboBox_queryCol.SelectedIndex == 1)
                str = str.Replace("#col", "上传人编号").Replace("#value", textBox_QueryKey.Text);
            else if (comboBox_queryCol.SelectedIndex == 2)
            {
                str = "上传时间 >= '#date1' and 上传时间<= '#date2' ";
                str = str.Replace("#date1", dateTimePicker1.Text).Replace("#date2", dateTimePicker2.Text);
            }
            else if (comboBox_queryCol.SelectedIndex == 3)
                str = str.Replace("#col", "上传标题").Replace("#value", textBox_QueryKey.Text);
            else
                str = str.Replace("#col", "上传备注").Replace("#value", textBox_QueryKey.Text);

            string strQuery = @" select  ID as 编号, uid1 as 采集人编号, uid2 as 上传人编号, uploadTime as 上传时间, uploadTitle as 上传标题,
                                 uploadDes as 上传备注, createTime as 采集时间, fileDir as 保存路径
                                 from fileUpload order by ID DESC";

            ADOHelper db = new ADOHelper();

            DataView dvNewDataViewObject = new DataView();
            dvNewDataViewObject.Table = db.ExecuteGet(strQuery).Tables[0];
            dvNewDataViewObject.RowFilter = str;
            //dview_UploadInfo.DataBindings.Clear();
            //dview_UploadInfo.DataSource = dvNewDataViewObject;
            srcTable = dvNewDataViewObject.ToTable();
            ChangeDataSoure(srcTable);
            InitPageSet(20);
            imageButton_first.PerformClick();//默认先显示第一页
        }
Beispiel #3
0
        private void getUploadData()
        {
            string strQuery = @" select  ID as 编号, uid1 as 采集人编号, uid2 as 上传人编号, uploadTime as 上传时间, uploadTitle as 上传标题,
                                 uploadDes as 上传备注, createTime as 采集时间, fileDir as 保存路径
                                 from fileUpload order by ID DESC";

            ADOHelper db = new ADOHelper();
            //dview_UploadInfo.DataSource = db.ExecuteGet(strQuery).Tables[0];
            srcTable = db.ExecuteGet(strQuery).Tables[0];
        }
Beispiel #4
0
        //条件查询
        private void button_inquery_Click(object sender, EventArgs e)
        {
            if (CValidateTools.containsBlank(textBox_QueryKey.Text))
            {
                CValidateTools.showError("关键字不合法!");
                return;
            }

            /* 一种过滤数据的方法

            string strQuery = @" select u1.AdmName as 用户名, u1.cName as 姓名, u1.userNumber as 编号, d1.depName as 所属部门, r1.roleName as 角色, u1.AddDate as 创建时间 from userInfo u1, department d1, role r1
             where u1.roleID = r1.ID and u1.depCID = d1.categroyID and u1.depID = d1.depID and d1.categroyID = 2 and   #col like '%#value%'  and depCID = 2 ";
            string str = strQuery;
            if (comboBox_queryCol.SelectedIndex == 0)
                str = str.Replace("#col", "userNumber").Replace("#value", textBox_QueryKey.Text );
            else if(comboBox_queryCol.SelectedIndex == 1)
                str = str.Replace("#col", "admName").Replace("#value", textBox_QueryKey.Text);
            else
                str = str.Replace("#col", "cName").Replace("#value", textBox_QueryKey.Text);

            dview_UserInfo.rows

            ADOHelper db = new ADOHelper();
            if (db.ExecuteGet(str) == null)
                return;

            dview_UserInfo.DataBindings.Clear();
            dview_UserInfo.DataSource = db.ExecuteGet(str).Tables[0];

             * */

            //另一种过滤数据的方法

            string str = "#col like '%#value%' ";
            if (comboBox_queryCol.SelectedIndex == 0)
                str = str.Replace("#col", "编号").Replace("#value", textBox_QueryKey.Text);
            else if (comboBox_queryCol.SelectedIndex == 1)
                str = str.Replace("#col", "用户名").Replace("#value", textBox_QueryKey.Text);
            else
                str = str.Replace("#col", "姓名").Replace("#value", textBox_QueryKey.Text);

            string strQuery = @" select u1.AdmName as 用户名, u1.cName as 姓名, u1.userNumber as 编号, d1.depName as 所属部门, r1.roleName as 角色, u1.AddDate as 创建时间 from userInfo u1, department d1, role r1
             where u1.roleID = r1.ID and u1.depCID = d1.categroyID and u1.depID = d1.depID and d1.categroyID = " + DevTools.getDepartmentId();

            ADOHelper db = new ADOHelper();

            DataView dvNewDataViewObject = new DataView();
            dvNewDataViewObject.Table = db.ExecuteGet(strQuery).Tables[0];
            dvNewDataViewObject.RowFilter = str;
            dview_UserInfo.DataBindings.Clear();
            dview_UserInfo.DataSource = dvNewDataViewObject;
        }
Beispiel #5
0
        private void userSearch_Load(object sender, EventArgs e)
        {
            getUserInfo();

            button_modify.Visible = false;
            button_save.Visible = false;

            comboBox_queryCol.Items.Add("编号");
            comboBox_queryCol.Items.Add("用户名");
            comboBox_queryCol.Items.Add("姓名");
            comboBox_queryCol.SelectedIndex = 0;

            //给combobox赋值并绑定id
            string strQuery = @" select * from department where categroyID = " + DevTools.getDepartmentId();
            ADOHelper db = new ADOHelper();
            comboBox_dep.DataSource = db.ExecuteGet(strQuery).Tables[0];
            comboBox_dep.DisplayMember = "depName";
            comboBox_dep.ValueMember = "depID";

            strQuery = @" select * from role where id > 2";
            comboBox_role.DataSource = db.ExecuteGet(strQuery).Tables[0];
            comboBox_role.DisplayMember = "roleName";
            comboBox_role.ValueMember = "ID";
        }
Beispiel #6
0
        private void getUserInfo()
        {
            string strQuery = @" select u1.AdmName as 用户名, u1.cName as 姓名, u1.userNumber as 编号, d1.depName as 所属部门, r1.roleName as 角色, u1.AddDate as 创建时间 from userInfo u1, department d1, role r1
             where u1.roleID = r1.ID and u1.depCID = d1.categroyID and u1.depID = d1.depID and d1.categroyID = " + DevTools.getDepartmentId();

            ADOHelper db = new ADOHelper();
            dview_UserInfo.DataSource = db.ExecuteGet(strQuery).Tables[0];
        }
Beispiel #7
0
 private void FormUploadFile_Load(object sender, EventArgs e)
 {
     //给combobox赋值并绑定id
     string strQuery = @" select * from userInfo where depCID = "+DevTools.getDepartmentId();
     ADOHelper db = new ADOHelper();
     comboBox_uid1.DataSource = db.ExecuteGet(strQuery).Tables[0];
     comboBox_uid1.DisplayMember = "cName";
     comboBox_uid1.ValueMember = "userNumber";
 }