예제 #1
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string password;

            password = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim());
            string sql = "update cost_user set password ='******' where cid = " + textEditID.Text.ToString();
            if (textEditLogName.Text.ToString().Trim() != "" && textEditPsw.Text.ToString().Trim() != "")
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    UserQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            else
            {
                MessageBox.Show("登录名和密码不能为空值!");
            }
            conn.Close();
        }
예제 #2
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2, password, log_name, person_name, dept1, dept2, dept3, dept, remark;
            int    rows;

            log_name    = textEditLogName.Text.ToString().Trim();
            password    = Common.MD5Encrypt(textEditPsw.Text.ToString().Trim());
            person_name = textEditName.Text.ToString().Trim();
            dept1       = comboBoxDept1.Text.ToString();
            dept2       = comboBoxDept2.Text.ToString();
            dept3       = comboBoxDept3.Text.ToString();
            dept        = comboBoxDept.Text.ToString();
            remark      = textEditRemark.Text.ToString().Trim();
            if (dept1 == "请选择")
            {
                dept1 = "";
            }
            if (dept2 == "请选择")
            {
                dept2 = "";
            }
            if (dept3 == "请选择")
            {
                dept3 = "";
            }
            if (dept == "请选择")
            {
                dept = "";
            }
            strsql  = "insert into cost_user(CNAME,PASSWORD,PERSON_NAME,DEPT1,DEPT2,DEPT3,DEPT,remark) values('" + log_name + "','" + password + "','" + person_name + "','" + dept1 + "','" + dept2 + "','" + dept3 + "','" + dept + "','" + remark + "')";
            strsql2 = "select cname from cost_user where cname = '" + textEditLogName.Text.ToString().Trim() + "'";
            if (log_name != "" && textEditPsw.Text.ToString().Trim() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该用户已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        UserQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("不能为空!");
            }
            conn.Close();
        }
예제 #3
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string dept1, dept2, dept3, dept, remark;

            dept1  = comboBoxDept1.Text;
            dept2  = comboBoxDept2.Text;
            dept3  = comboBoxDept3.Text;
            dept   = comboBoxDept.Text;
            remark = textEditRemark.Text.ToString().Trim();

            if (dept1 == "请选择")
            {
                dept1 = "";
            }
            if (dept2 == "请选择")
            {
                dept2 = "";
            }
            if (dept3 == "请选择")
            {
                dept3 = "";
            }
            if (dept == "请选择")
            {
                dept = "";
            }
            string sql = "update cost_user set cname ='" + textEditLogName.Text.ToString().Trim() + "',person_name ='" + textEditName.Text.ToString().Trim() + "',dept1 ='" + dept1 + "',dept2 ='" + dept2 + "',dept3 ='" + dept3 + "',dept ='" + dept + "',remark ='" + remark;

            sql = sql + "' where cid = " + textEditID.Text.ToString();
            // string sql2 = "select cname from cost_user where cname = '" + textEditLogName.Text.ToString().Trim() + "' and password ='******'";
            if (textEditLogName.Text.ToString().Trim() != "")
            {
                bool isok = conn.EditDatabase(sql);
                if (isok)
                {
                    MessageBox.Show("修改成功!");
                    UserQuery.RefreshEX();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("失败!");
                }
            }
            else
            {
                MessageBox.Show("登录名不能为空值!");
            }
            conn.Close();
        }
예제 #4
0
 private void barButtonItem删除_ItemClick(object sender, ItemClickEventArgs e)
 {
     UserQuery.Delete();
     UserQuery.RefreshEX();
 }
예제 #5
0
 private void barButtonItem反禁用_ItemClick(object sender, ItemClickEventArgs e)
 {
     UserQuery.cEnable();
     UserQuery.RefreshEX();
 }