public void modify_show(string name)
        {
            // MessageBox.Show(name);
            var    c          = new DormEntities();
            var    q          = from t in c.AdminTable where (t.account == name) select t;
            string idCard     = this.IdCardBox.Text;
            string password_  = PasswordBox.Password;
            string password2_ = PasswordBox2.Password;

            if (password2_ != password_)
            {
                MessageBoxz.ShowWarning("两次密码不一致,");
                return;
            }
            if (q.Count() > 0)
            {
                //说明有该用户
                var q2 = from t in c.AdminTable where (t.account == name && t.idCard == idCard) select t;

                // MessageBox.Show(name+idCard);
                if (q2.Count() == 1)
                {
                    q2.First <AdminTable>().password = password_;
                }

                c.SaveChanges();
                MessageBoxz.ShowInfo("密码修改成功");
                this.Close();
            }
        }
Exemplo n.º 2
0
 private void BtnWaitingBox_Click(object sender, RoutedEventArgs e)
 {
     WaitingBox.Show(() =>
     {
         System.Threading.Thread.Sleep(3000);
     }, "正在加载,请稍后...");
     MessageBoxz.ShowInfo("加载完毕!");
 }
Exemplo n.º 3
0
 private void modify_ok()
 {
     MessageBoxz.ShowInfo("修改管理员成功");
 }
Exemplo n.º 4
0
 private void deleOK(string account)
 {
     MessageBoxz.ShowInfo("已成功删除管理员 " + account);
 }
Exemplo n.º 5
0
 private void fill_fail()
 {
     MessageBoxz.ShowInfo("用户名和密码不能为空!");
 }
Exemplo n.º 6
0
 private void add_ok()
 {
     MessageBoxz.ShowInfo("添加管理员成功");
 }
        private void btn_add_Click(object sender, RoutedEventArgs e)
        {
            string account_  = AccountTextBox.Text;
            string password_ = PasswordTextBox.Text;
            string sex_      = sex.Text;
            string telphone_ = telphone.Text;
            string idCard_   = idcard.Text;

            if (account_ == "" || account_ == null || password_ == "" || password_ == null)
            {
                fill_fail();
                return;
            }

            var c = new DormEntities();

            var query = from t in c.AdminTable where (t.account == account_ & t.password == password_) select t;

            if (query.Count() > 0)
            {
                MessageBoxz.ShowInfo("该用户名已经被注册");
            }
            else
            {
                //可以注册

                if (account_ == "" || account_ == null || password_ == "" || password_ == null || sex_ == "" || sex_ == null || telphone_ == "" || telphone_ == null || idCard_ == "" || idcard == null)
                {
                    MessageBoxz.ShowWarning("信息填写不完整!");
                    return;
                }

                if (telphone_.Length != 11)
                {
                    MessageBoxz.ShowWarning("手机号格式不正确!");
                    return;
                }
                if (idCard_.Length != 18)
                {
                    MessageBoxz.ShowWarning("身份证号格式不正确!");
                    return;
                }

                int count = c.AdminTable.Select(p => p.Id).ToList().Max();

                if (path == "")
                {
                    BitmapImage img        = new BitmapImage(new Uri(@"\Resources\icoFiles\moren.png", UriKind.Relative));
                    byte[]      bt         = BitmapImageToByteArray(img);
                    AdminTable  adminTable = new AdminTable
                    {
                        Id       = count + 1,
                        account  = account_,
                        password = password_,
                        sex      = sex_,
                        telphone = telphone_,
                        idCard   = idCard_,
                        photo    = bt
                    };

                    c.AdminTable.Add(adminTable);
                    c.SaveChanges();
                    MessageBoxz.ShowInfo("恭喜您,注册新用户成功");
                    this.Close();
                }

                else
                {
                    System.IO.Stream mystream = ofd.OpenFile();
                    byte[]           bt       = new byte[mystream.Length];
                    mystream.Read(bt, 0, (int)mystream.Length);
                    AdminTable adminTable = new AdminTable
                    {
                        Id       = count + 1,
                        account  = account_,
                        password = password_,
                        sex      = sex_,
                        telphone = telphone_,
                        idCard   = idCard_,
                        photo    = bt
                    };

                    c.AdminTable.Add(adminTable);
                    c.SaveChanges();
                    MessageBoxz.ShowInfo("恭喜您,注册新用户成功");
                    this.Close();
                }
            }
        }
        private void FButton_Click_Question(object sender, RoutedEventArgs e)
        {
            var res = MessageBoxz.ShowQuestion("你是最帅的嘛?");

            MessageBoxz.ShowInfo(res.ToString());
        }
 private void FButton_Click_Info(object sender, RoutedEventArgs e)
 {
     MessageBoxz.ShowInfo("领域设计、架构设计、技术之路、文明之路");
 }