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();
            }
        }
Ejemplo n.º 2
0
        private void Buttonz_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                int    index      = (dataGrid.SelectedItem as AdminTable).Id;
                string account__  = (dataGrid.SelectedItem as AdminTable).account;
                string password__ = (dataGrid.SelectedItem as AdminTable).password;

                // MessageBox.Show(account__+"  "+password__);
                string account_  = AccountTextBox.Text;
                string password_ = PasswordTextBox.Text;
                if (account_ == "" || account_ == null || password_ == "" || password_ == null)
                {
                    modify_fail();
                    return;
                }

                var c     = new DormEntities();
                var query = from t in c.AdminTable where (t.account == account__ && t.password == password__) select t;

                int temp = query.Count();

                if (query.Count() > 0)
                {
                    query.First <AdminTable>().account  = account_;
                    query.First <AdminTable>().password = password_;


                    c.SaveChanges();
                    modify_ok();
                }


                var q = from t in c.AdminTable select t;
                dataGrid.ItemsSource = q.ToList();
            }
            catch (Exception)
            {
                MessageBoxz.ShowWarning("请选择一个管理员");
                //throw;
            }


            //var c = new DormEntities();
            //var q = from t in c.AdminTable select t;
            //int count = q.Count();
            //AdminTable adminTable = new AdminTable
            //{
            //    Id = count + 1,
            //    account = account_,
            //    password = password_

            //};

            //c.AdminTable.Add(adminTable);
            //c.SaveChanges();

            // showAdmin();
            //modify_ok();
        }
Ejemplo n.º 3
0
 private void DoSetUserName(string name)
 {
     if (MessageBoxz.ShowQuestion(string.Format("Set Name is {0}?", name)))
     {
         this.Name = name;
     }
 }
Ejemplo n.º 4
0
        private void Buttonz_Click(object sender, RoutedEventArgs e)
        {
            var path = this.TxtFolder.Text.Trim();

            string[] fs1 = null, fs2 = null;
            try
            {
                fs1 = System.IO.Directory.GetFiles(path, "*.jpg", SearchOption.AllDirectories);
                fs2 = System.IO.Directory.GetFiles(path, "*.png", SearchOption.AllDirectories);
            }
            catch
            {
                MessageBoxz.ShowError("无法获取指定目录下的文件");
                return;
            }
            List <string> photoPaths = new List <string>();

            photoPaths.AddRange(fs1);
            photoPaths.AddRange(fs2);
            List <UserPhotoDemo> users = new List <UserPhotoDemo>();

            foreach (var f in photoPaths)
            {
                users.Add(new UserPhotoDemo {
                    FilePath = f, FileName = System.IO.Path.GetFileName(f)
                });
            }
            this.ImgViewer.ItemsSource = users;
        }
Ejemplo n.º 5
0
 private void BtnWaitingBox_Click(object sender, RoutedEventArgs e)
 {
     WaitingBox.Show(() =>
     {
         System.Threading.Thread.Sleep(3000);
     }, "正在加载,请稍后...");
     MessageBoxz.ShowInfo("加载完毕!");
 }
Ejemplo n.º 6
0
        private void Buttonz_Click_1(object sender, RoutedEventArgs e)
        {
            var res = MessageBoxz.ShowQuestion("确定退出?");

            //MessageBoxz.ShowInfo(res.ToString());
            if (res.ToString() == "True")
            {
                App.Current.Shutdown();
            }
            else
            {
                return;
            }
        }
Ejemplo n.º 7
0
 private void modify_ok()
 {
     MessageBoxz.ShowInfo("修改管理员成功");
 }
Ejemplo n.º 8
0
 private void modify_fail()
 {
     MessageBoxz.ShowError("修改失败,账号或密码不能为空");
 }
        private void FButton_Click_Question(object sender, RoutedEventArgs e)
        {
            var res = MessageBoxz.ShowQuestion("你是最帅的嘛?");

            MessageBoxz.ShowInfo(res.ToString());
        }
 private void FButton_Click_Warning(object sender, RoutedEventArgs e)
 {
     MessageBoxz.ShowWarning("架构之美、数学之美、.net 核心框架、异步编程的艺术、单元测试的艺术,代码,WPF");
 }
 private void fill_fail()
 {
     MessageBoxz.ShowWarning("用户名和密码不能为空!");
 }
Ejemplo n.º 12
0
 private void deleOK(string account)
 {
     MessageBoxz.ShowInfo("已成功删除管理员 " + account);
 }
Ejemplo n.º 13
0
 private void login_fail()
 {
     MessageBoxz.ShowError("用户名或密码错误!");
 }
 private void FButton_Click_Info(object sender, RoutedEventArgs e)
 {
     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();
                }
            }
        }
Ejemplo n.º 16
0
 private void add_fail()
 {
     MessageBoxz.ShowError("账号和密码不能为空");
 }
Ejemplo n.º 17
0
 private void add_ok()
 {
     MessageBoxz.ShowInfo("添加管理员成功");
 }
Ejemplo n.º 18
0
 private void fill_fail()
 {
     MessageBoxz.ShowInfo("用户名和密码不能为空!");
 }
 private void FButton_Click_Error(object sender, RoutedEventArgs e)
 {
     MessageBoxz.ShowError("你只看到我在不停的忙碌,却没看到我奋斗的热情。你有朝九晚五,我有通宵达旦。你否定我的现在,我决定我的未来。你可以轻视我的存在,我会用代码证明这是谁的时代!Coding是注定痛苦的旅行,路上少不了Bug和Change,但!那又怎样!我是程序猿,我为自己带眼");
 }