Example #1
0
        private void edit_bt_Click(object sender, EventArgs e)
        {
            DataRow drt = manuser.GetDataRow(manuser.FocusedRowHandle);

            MessageBox.Show(drt["password"].ToString() + "  " + drt["ID"].ToString());
            Maticsoft.BLL.username   user      = new Maticsoft.BLL.username();
            Maticsoft.Model.username user_mode = user.GetModel(Convert.ToInt32(drt["ID"]));
            password pass_obj = new password();

            pass_obj.user_mode = user_mode;
            pass_obj.Show();
            return;

            for (int i = 0; i < manuser.RowCount; i++)
            {
                string   ua = manuser.GetRowCellValue(i, "user").ToString();
                string   pw = manuser.GetRowCellValue(i, "password").ToString();
                string   po = manuser.GetRowCellValue(i, "power").ToString();
                int      id = Convert.ToInt32(manuser.GetRowCellValue(i, "ID"));
                DateTime tm = Convert.ToDateTime(manuser.GetRowCellValue(i, "addTime"));
                Maticsoft.BLL.username   use = new Maticsoft.BLL.username();
                Maticsoft.Model.username us  = new username()
                {
                    ID       = id,
                    user     = ua,
                    addtime  = tm,
                    password = pw,
                    power    = po,
                };
                use.Update(us);
            }
            MessageBox.Show("修改成功");
        }
Example #2
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtusername.Text.Trim().Length == 0)
            {
                strErr += "username不能为空!\\n";
            }
            if (!PageValidate.IsDateTime(txtaddtime.Text))
            {
                strErr += "addtime格式错误!\\n";
            }
            if (this.txtpassword.Text.Trim().Length == 0)
            {
                strErr += "password不能为空!\\n";
            }
            if (this.txtpower.Text.Trim().Length == 0)
            {
                strErr += "power不能为空!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      ID       = int.Parse(this.lblID.Text);
            string   username = this.txtusername.Text;
            DateTime addtime  = DateTime.Parse(this.txtaddtime.Text);
            string   password = this.txtpassword.Text;
            string   power    = this.txtpower.Text;


            Maticsoft.Model.username model = new Maticsoft.Model.username();
            model.ID       = ID;
            model.username = username;
            model.addtime  = addtime;
            model.password = password;
            model.power    = power;

            Maticsoft.BLL.username bll = new Maticsoft.BLL.username();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() != "" && (textBox1.Text == textBox2.Text))
            {
                Maticsoft.BLL.username user = new Maticsoft.BLL.username();
                if (user_mode != null)
                {
                    user_mode.password = textBox1.Text.Trim();
                }

                if (!user.Update(user_mode))
                {
                    MessageBox.Show("更新密码失败");
                }
                else
                {
                    MessageBox.Show("更新密码成功");
                }
            }
            else
            {
                MessageBox.Show("密码不合法");
            }
        }