Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string zh = textBox1.Text;
            string mm = textBox2.Text;

            if (string.IsNullOrEmpty(zh))
            {
                MessageBox.Show("账号不能为空");
                return;
            }
            if (string.IsNullOrEmpty(mm))
            {
                MessageBox.Show("密码不能为空");
                return;
            }

            DataTable table = new SqlServerHelper().QuerySqlDataTable("select * from denglu where zh=N'" + zh + "' and mm=N'" + mm + "'");

            if (table.Count() > 0)
            {
                MessageBox.Show("登录成功!");
                this.Hide();
                GlobalVar.denglu_zh = zh;
                //打开主页面
                FormMain main = new FormMain();
                main.FormClosed += Main_FormClosed;
                main.WindowState = FormWindowState.Maximized;
                main.Show();
            }
            else
            {
                MessageBox.Show("用户名密码输入有误!");
            }
        }
Esempio n. 2
0
        public Form4(string yhzh)
        {
            InitializeComponent();
            DataTable table = new SqlServerHelper().QuerySqlDataTable("select * from yhxx where yhzh='" + yhzh + "'");

            if (table.Count() > 0)
            {
                DataRow dr = table.Rows[0];
                textBox1.Text = dr["yhzh"].AsString();
                textBox2.Text = dr["yhxm"].AsString();
                textBox3.Text = dr["yhmm"].AsString();

                textBox1.Enabled = false;
            }
        }
Esempio n. 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            string mm_o  = textBox1.Text;
            string mm_n  = textBox2.Text;
            string mm_n1 = textBox3.Text;

            if (string.IsNullOrEmpty(mm_o))
            {
                MessageBox.Show("原密码不能为空");
                return;
            }
            if (string.IsNullOrEmpty(mm_n))
            {
                MessageBox.Show("新密码不能为空");
                return;
            }
            if (string.IsNullOrEmpty(mm_n1))
            {
                MessageBox.Show("重复新密码不能为空");
                return;
            }
            if (mm_n == mm_o)
            {
                MessageBox.Show("新密码不能与原密码相同");
                return;
            }
            if (mm_n != mm_n1)
            {
                MessageBox.Show("两次密码输入一致");
                return;
            }
            DataTable table = new SqlServerHelper().QuerySqlDataTable("select * from denglu where zh=N'" + GlobalVar.denglu_zh + "' and mm=N'" + mm_o + "'");

            if (table.Count() > 0)
            {
                string sql = "update denglu set mm=N'" + mm_n + "' where zh=N'" + GlobalVar.denglu_zh + "'";
                new SqlServerHelper().ExecuteSql(sql);
                MessageBox.Show("密码修改成功");
                this.Close();
            }
            else
            {
                MessageBox.Show("原密码输入不正确");
            }
        }
Esempio n. 4
0
        public Form6(int id)
        {
            InitializeComponent();
            this.id = id;
            string    sql   = "select * from sjsfgl where id=" + id.ToString();
            DataTable table = new SqlServerHelper().QuerySqlDataTable(sql);

            if (table.Count() > 0)
            {
                DataRow row = table.Rows[0];
                textBox1.Text         = row["mc"].AsString();
                textBox2.Text         = row["xh"].AsString();
                textBox3.Text         = row["sfy"].AsString();
                dateTimePicker1.Value = row["sfrq"].AsDatetime();
                numericUpDown1.Value  = row["sl"].AsDecimal();
                numericUpDown2.Value  = row["dj"].AsDecimal();
            }
        }
Esempio n. 5
0
        private void button4_Click(object sender, EventArgs e)
        {
            string zh  = textBox4.Text;
            string sql = "select * from denglu where 1=1";

            if (!string.IsNullOrEmpty(zh))
            {
                sql += " and zh like'%" + zh + "%'";
            }

            DataTable table = new SqlServerHelper().QuerySqlDataTable(sql);

            dataGridView1.DataSource = null;
            dataGridView1.DataSource = table;
            if (table.Count() <= 0)
            {
                button1_Click(null, null);
            }
        }
Esempio n. 6
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //页面验证通过
            if (Page.IsValid)
            {
                //获取账户
                string yhzh = name.Text;
                //获取密码
                string yhmm = pwd.Text;
                //获取类别
                string yhlb = lb.Value;
                //调用登录验证方法
                string sql = string.Format("select * from yhxx where yhzh=N'{0}' and " +
                                           "yhmm=N'{1}' and yhlb='{2}'", yhzh, yhmm, yhlb);
                DataTable table = new SqlServerHelper().QuerySqlDataTable(sql);
                //如果ret返回true,则验证通过,允许用户登录本系统。
                //如果ret返回false,则验证不通过,不允许用户登录本系统
                if (table.Count() > 0)
                {
                    WebData.LoginUser     = yhzh;
                    WebData.LoginUserName = table.Rows[0]["yhxm"].AsString();
                    WebData.LoginUserType = yhlb;

                    //将登录信息保存在会话里
                    Session[WebData.登录用户]   = WebData.LoginUser;
                    Session[WebData.登录用户名]  = WebData.LoginUserName;
                    Session[WebData.登录用户类别] = WebData.LoginUserType;
                    //提示用户登录成功,并跳转到主页面
                    Response.Write("<script>alert('用户登录成功');window.location.href='Default.aspx'</script>");
                }
                else
                {
                    //提示用户账户密码错误
                    Response.Write("<script>alert('用户名密码错误,请重新输入');</script>");
                }
            }
        }
        private void button4_Click(object sender, EventArgs e)
        {
            string mc  = textBox4.Text;
            string xh  = textBox5.Text;
            string sql = "select * from shoujishoufei where 1=1";

            if (!string.IsNullOrEmpty(mc))
            {
                sql += " and mc like'%" + mc + "%'";
            }
            if (!string.IsNullOrEmpty(xh))
            {
                sql += " and xh like'%" + xh + "%'";
            }

            DataTable table = new SqlServerHelper().QuerySqlDataTable(sql);

            dataGridView1.DataSource = null;
            dataGridView1.DataSource = table;
            if (table.Count() <= 0)
            {
                button1_Click(null, null);
            }
        }