Exemplo n.º 1
0
        //保存数据
        private void button_save_Click(object sender, EventArgs e)
        {
            if (!ClassGlobalUserInfo.checkValidate())//操作员没有权限
            {
                CValidateTools.showError("权限不足");
                return;
            }

            if (textBox_uTitle.ReadOnly)
            {
                return;
            }

            if (textBox_uTitle.Text.Length <= 0 || textBox_des.Text.Length <= 0)
            {
                CValidateTools.showError("待修改内容不能为空");
                return;
            }

            string rowID = dview_UploadInfo.Rows[dview_UploadInfo.SelectedCells[0].RowIndex].Cells["编号"].Value.ToString();

            if (rowID == null || rowID.Length <= 0)
            {
                CValidateTools.showError("请选择要修改的数据");
                return;
            }

            string strUpdate = "update fileUpload set uploadTitle = '#title' ,  uploadDes = '#uploadDes'  where ID = #ID1 ";

            strUpdate = strUpdate.Replace("#title", textBox_uTitle.Text).Replace("#uploadDes", textBox_des.Text).Replace("#ID1", rowID);

            bool result = false;

            try
            {
                ADOHelper db = new ADOHelper();
                result = db.ExecuteUpdate(strUpdate);
            }
            catch (Exception ex)
            {
                CValidateTools.showError(ex.Message);
                return;
            }


            if (result)
            {
                CValidateTools.showOK("上传信息修改成功!");

                getUploadData();
                ChangeDataSoure(srcTable);
            }

            textBox_uTitle.ReadOnly = true;
            textBox_des.ReadOnly    = true;
        }
Exemplo n.º 2
0
        //保存修改
        private void button_save_Click(object sender, EventArgs e)
        {
            if (!ClassGlobalUserInfo.checkValidate())//操作员没有权限
            {
                CValidateTools.showError("权限不足");
                return;
            }

            if (textBox_cname.ReadOnly)
            {
                return;
            }

            int roleID = int.Parse(comboBox_role.SelectedValue.ToString());
            int depID  = int.Parse(comboBox_dep.SelectedValue.ToString());

            string strUpdate = "update userInfo set cName = '#cname' ,  depID = #depid , roleID = #roldid where userNumber = '#usernumber'";

            strUpdate = strUpdate.Replace("#cname", textBox_cname.Text).Replace("#depid", depID.ToString()).Replace("#roldid", roleID.ToString()).Replace("#usernumber", textBox_id.Text);

            bool result = false;

            try
            {
                ADOHelper db = new ADOHelper();
                result = db.ExecuteUpdate(strUpdate);
            }
            catch (Exception ex)
            {
                CValidateTools.showError(ex.Message);
                return;
            }


            if (result)
            {
                CValidateTools.showOK("用户修改成功!");
            }

            getUserInfo();

            textBox_cname.ReadOnly = true;
            textBox_id.ReadOnly    = true;
        }
Exemplo n.º 3
0
        //重置密码
        private void button1_Click(object sender, EventArgs e)
        {
            if (!ClassGlobalUserInfo.checkValidate())//操作员没有权限
            {
                CValidateTools.showError("权限不足");
                return;
            }

            if (!CValidateTools.checkLength(textBox_id.Text, 1, 20))
            {
                CValidateTools.showError("请先选择一个用户");
                return;
            }

            if (CValidateTools.showYesNoDialog("确定要重置密码吗?") == DialogResult.Cancel)
            {
                return;
            }

            string strUpdate = "update userInfo set AdmPwd = '888888' where userNumber = '#usernumber' ";

            strUpdate = strUpdate.Replace("#usernumber", textBox_id.Text);

            bool result = false;

            try
            {
                ADOHelper db = new ADOHelper();
                result = db.ExecuteUpdate(strUpdate);
            }
            catch (Exception ex)
            {
                CValidateTools.showError(ex.Message);
                return;
            }


            if (result)
            {
                CValidateTools.showOK("密码重置成功!");
            }
        }
Exemplo n.º 4
0
        //添加新用户
        private void button_addUser_Click(object sender, EventArgs e)
        {
            if (!ClassGlobalUserInfo.checkValidate())//操作员没有权限
            {
                CValidateTools.showError("权限不足");
                return;
            }

            FormuserAdd f1 = (FormuserAdd)checkFormsIsOpen("FormuserAdd");

            if (f1 == null)
            {
                FormuserAdd us = new FormuserAdd(this.Left, this.Top);
                us.Show();
            }
            else
            {
                f1.Activate();
            }
        }