Exemplo n.º 1
0
        private void txtmm_KeyDown(object sender, KeyEventArgs e)
        {
            if (Keys.Enter == e.KeyCode)
            {
                string zh                   = "";
                string mm                   = "";
                string lab_name             = txtzh.Text;
                string lab_pass_word        = txtmm.Text;
                Maticsoft.BLL.username user = new Maticsoft.BLL.username();

                DataSet   ds        = user.GetList(string.Format(" user = '******' ", lab_name));
                DataTable dt        = ds.Tables[0];
                string    user_name = dt.Rows[0]["user"].ToString();
                string    password  = dt.Rows[0]["password"].ToString();
                global.power = dt.Rows[0]["power"].ToString();
                //MessageBox.Show("  " + password + " aa  ");

                //MessageBox.Show(dt.Rows.Count + " :count   " + user_name + " : username " + password + " :password  " + lab_name + " :lab_name  " + lab_pass_word + " :mm  ");
                if (user_name == lab_name && password == lab_pass_word)
                {
                    MainFrom mf = new MainFrom();
                    mf.Show();
                }
                else
                {
                    //MessageBox.Show("  " + password + " ===  " + mm);
                    MessageBox.Show("密码或账号不正确");
                    return;
                }
            }
        }
Exemplo n.º 2
0
        private void del_bt_Click(object sender, EventArgs e)
        {
            int[] aa = manuser.GetSelectedRows();
            foreach (int testa in aa)
            {
                DataRow drt = manuser.GetDataRow(testa);
                string  id  = drt["ID"].ToString();
                del_list.Add(Convert.ToInt32(id));
                manuser.DeleteRow(testa);
            }

            // MessageBox.Show(aa.Length.ToString());
            return;

            DataRow a = manuser.GetDataRow(manuser.FocusedRowHandle);

            Maticsoft.BLL.username use = new Maticsoft.BLL.username();
            use.Delete(Convert.ToInt32(a["id"]));
            //MessageBox.Show(a["id"].ToString());
            MessageBox.Show("删除成功");
            Maticsoft.BLL.username usec = new Maticsoft.BLL.username();
            DataSet ds = usec.GetAllList();

            users_gc.DataSource = ds.Tables[0];


            //DataSet ds = use.GetList("   ");
            //DataTable dt = ds.Tables[0];


            //MessageBox.Show(ds.Tables.Count.ToString());
            //DataTable dt = ds.Tables[0];
            //MessageBox.Show(dt.Rows.Count.ToString());
        }
Exemplo n.º 3
0
 private void query_bt_Click(object sender, EventArgs e)
 {
     if (username_tb.Text != "" && time_dtp.Text == "")
     {
         Maticsoft.BLL.username use = new Maticsoft.BLL.username();
         string  aa = string.Format("user = '******'", username_tb.Text);
         DataSet ds = use.GetList(aa);
         users_gc.DataSource = ds.Tables[0];
     }
     if (username_tb.Text == "" && time_dtp.Text != "")
     {
         Maticsoft.BLL.username use = new Maticsoft.BLL.username();
         string  aa = string.Format("addtime = '{0}'", time_dtp.Text);
         DataSet ds = use.GetList(aa);
         users_gc.DataSource = ds.Tables[0];
     }
     if (username_tb.Text != "" && time_dtp.Text != "")
     {
         Maticsoft.BLL.username use = new Maticsoft.BLL.username();
         string  aa = string.Format("addtime = '{0}'and user='******'", time_dtp.Text, username_tb.Text);
         DataSet ds = use.GetList(aa);
         users_gc.DataSource = ds.Tables[0];
     }
     if (username_tb.Text == "" && time_dtp.Text == "")
     {
         Maticsoft.BLL.username use = new Maticsoft.BLL.username();
         DataSet ds = use.GetAllList();
         users_gc.DataSource = ds.Tables[0];
     }
 }
Exemplo n.º 4
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("修改成功");
        }
Exemplo n.º 5
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.username use = new Maticsoft.BLL.username();
            DataSet ds = use.GetAllList();

            users_gc.DataSource = ds.Tables[0];
            del_list.Clear();
        }
Exemplo n.º 6
0
 private void ShowInfo(int ID)
 {
     Maticsoft.BLL.username   bll   = new Maticsoft.BLL.username();
     Maticsoft.Model.username model = bll.GetModel(ID);
     this.lblID.Text       = model.ID.ToString();
     this.txtusername.Text = model.username;
     this.txtaddtime.Text  = model.addtime.ToString();
     this.txtpassword.Text = model.password;
     this.txtpower.Text    = model.power;
 }
Exemplo n.º 7
0
        private void pictureBox2_Click(object sender, EventArgs e)
        {
            string zh            = "";
            string mm            = "";
            string lab_name      = txtzh.Text;
            string lab_pass_word = txtmm.Text;

            Maticsoft.BLL.username user = new Maticsoft.BLL.username();

            DataSet   ds        = user.GetList(string.Format(" user = '******' ", lab_name));
            DataTable dt        = ds.Tables[0];
            string    user_name = dt.Rows[0]["user"].ToString();
            string    password  = dt.Rows[0]["password"].ToString();

            global.power = dt.Rows[0]["power"].ToString();
            //MessageBox.Show("  " + password + " aa  ");

            //MessageBox.Show(dt.Rows.Count + " :count   " + user_name + " : username " + password + " :password  " + lab_name + " :lab_name  " + lab_pass_word + " :mm  ");
            if (user_name == lab_name && password == lab_pass_word)
            {
                MainFrom mf = new MainFrom();
                mf.Show();
            }
            else
            {
                //MessageBox.Show("  " + password + " ===  " + mm);
                MessageBox.Show("密码或账号不正确");
                return;
            }

            /*
             * Maticsoft.BLL.username use = new Maticsoft.BLL.username();
             * DataSet ds = use.GetAllList();
             * for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
             * {
             *  zh = ds.Tables[0].Rows[i]["user"].ToString();
             *  mm = ds.Tables[0].Rows[i]["password"].ToString();
             *
             *
             * if (txtzh.Text == zh && txtmm.Text == mm)
             * {
             *  MainFrom mf = new MainFrom();
             *  mf.Show();
             *      break;
             * }
             * }
             * if(txtzh.Text != zh || txtmm.Text != mm)
             * {
             *  MessageBox.Show("密码或账号不正确");
             *  return;
             * }
             */
            //MainFrom mf = new MainFrom();
            //mf.Show();
        }
Exemplo n.º 8
0
        private void buttonX2_Click(object sender, EventArgs e)
        {
            Maticsoft.BLL.username use = new Maticsoft.BLL.username();
            foreach (int del_index in del_list)
            {
                use.Delete(del_index);
            }

            DataSet ds = use.GetAllList();

            users_gc.DataSource = ds.Tables[0];
        }
Exemplo n.º 9
0
        private void button1_Click(object sender, EventArgs e)
        {
            string aa = DTP.Value.ToString("yyyy-MM-dd HH:mm:ss");

            Maticsoft.BLL.username   use = new Maticsoft.BLL.username();
            Maticsoft.Model.username us  = new username()
            {
                user     = txt_n.Text,
                addtime  = Convert.ToDateTime(aa),
                password = txt_p.Text,
                power    = txt_q.Text,
            };
            use.Add(us);
            MessageBox.Show("保存成功");
            this.Close();
        }
Exemplo n.º 10
0
        private void UserManForm_Load(object sender, EventArgs e)
        {
            Maticsoft.BLL.username use = new Maticsoft.BLL.username();
            DataSet ds = use.GetAllList();

            users_gc.DataSource = ds.Tables[0];
            //ds.Tables.Add();
            //DataTable dt = new DataTable();//创建表
            //dt.Columns.Add("username", typeof(String));//添加列
            //dt.Columns.Add("Manager", typeof(String));
            //dt.Columns.Add("addTime", typeof(DateTime));
            //dt.Columns.Add("power", typeof(String));
            //dt.Rows.Add(new object[] { "admin", "admin", DateTime.Now ,"管理员"});//添加行
            //dt.Rows.Add(new object[] {  "李四", "zzzs", DateTime.Now, "普通账户"});
            //dt.Rows.Add(new object[] {  "王五", "www", DateTime.Now, "普通账户" });
            // this.users_gc.DataSource = dt;
        }
Exemplo n.º 11
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");
        }
Exemplo n.º 12
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("密码不合法");
            }
        }