Example #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            if (txbUser.Text.Length == 0 || txbPass.Text.Length == 0)
            {
                MyMessageBox.Show("Tên đăng nhập hoặc mật khẩu bị trống!", MessageBoxButtons.OK);
            }
            else
            {
                if (BUS_LoginAccount.Login(txbUser.Text, txbPass.Text))
                {
                    if (!ckbRemember.Checked)
                    {
                        txbPass.Clear();
                    }

                    BUS_LoginAccount.ShowAvatar(txbUser.Text);
                    BUS_Actions.AddActions(txbUser.Text, "Đăng nhập");

                    fMain f = new fMain();
                    this.Hide();
                    f.ShowDialog();
                    this.Show();
                }
                else
                {
                    MyMessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng!", MessageBoxButtons.OK);
                }
            }
        }
Example #2
0
 private void btnUpdatePass_Click(object sender, EventArgs e)
 {
     if (txbOldPass.Text.Length == 0 || txbNewPass.Text.Length == 0)
     {
         MyMessageBox.Show("Mật khẩu không được bỏ trống!", MessageBoxButtons.OK);
     }
     else if (txbOldPass.Text != SystemApp.Pass)
     {
         MyMessageBox.Show("Mật khẩu cũ không đúng!", MessageBoxButtons.OK);
     }
     else
     {
         try
         {
             if (BUS_LoginAccount.UpdatePassword(txbNewPass.Text, SystemApp.User))
             {
                 BUS_Actions.AddActions(SystemApp.User, "Đổi mật khẩu");
                 ShowTimeLine();
                 MyMessageBox.Show("Thay đổi mật khẩu thành công!", MessageBoxButtons.OK);
             }
         }
         catch
         {
             MyMessageBox.Show("Thay đổi mật khẩu thất bại!", MessageBoxButtons.OK);
         }
     }
 }
Example #3
0
 private void btnUpdateDisplayName_Click(object sender, EventArgs e)
 {
     try
     {
         if (BUS_LoginAccount.UpdateDisplayName(txbNewDisplayName.Text, SystemApp.User))
         {
             BUS_Actions.AddActions(SystemApp.User, "Đổi tên hiển thị");
             ShowTimeLine();
             MyMessageBox.Show("Thay đổi tên hiển thị thành công!", MessageBoxButtons.OK);
             SystemApp.DisplayName = txbNewDisplayName.Text;
             SystemApp.LOAD_DATA   = true;
         }
     }
     catch
     {
         MyMessageBox.Show("Thay đổi tên hiển thị thất bại!", MessageBoxButtons.OK);
     }
 }
Example #4
0
        private void btnChonAnh_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Title = "Chọn ảnh đại diện";

            if (SystemApp.Type == 0)
            {
                open.Filter = "Ảnh PNG (*.png)|*.png|Ảnh JPG (*.jpg)|*.jpg|Ảnh JPEG (*.jpeg)|*.jpeg|Ảnh GIF (*.gif)|*.gif|All files (*.*)|*.*";
            }
            else
            {
                open.Filter = "Ảnh PNG (*.png)|*.png|Ảnh JPG (*.jpg)|*.jpg|Ảnh JPEG (*.jpeg)|*.jpeg";
            }

            if (open.ShowDialog() == DialogResult.OK)
            {
                imgLocation = open.FileName;
                picAvartar.ImageLocation = imgLocation;
                this.Cursor = Cursors.WaitCursor;

                if (BUS_LoginAccount.SetAvatar(imgLocation, SystemApp.User))
                {
                    BUS_Actions.AddActions(SystemApp.User, "Đổi avatar");
                    ShowTimeLine();
                    MyMessageBox.Show("Thay đổi Avatar thành công!", MessageBoxButtons.OK);
                    SystemApp.Avatar    = picAvartar.Image;
                    SystemApp.LOAD_DATA = true;
                    this.Cursor         = Cursors.Default;
                }
                else
                {
                    MyMessageBox.Show("Thay đổi Avatar thất bại!", MessageBoxButtons.OK);
                    this.Cursor = Cursors.Default;
                }
            }
        }
Example #5
0
 private void btnNghiepVu_Click(object sender, EventArgs e)
 {
     BUS_LoginAccount.ShowAvatar(SystemApp.User);
 }