Пример #1
0
 private void lvWrongWord_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
 {
     curFlashCard = ManageSystem.SearchFlashCardEng(e.Item.SubItems[1].Text);
     if (curFlashCard != null)
     {
         ChangeFlashCard(curFlashCard.Eng, curFlashCard.IdCard);
     }
 }
Пример #2
0
        public void update()
        {
            string        TK = ManageSystem.TK();
            int           ID = ManageSystem.GetUserID(TK);
            List <string> a  = ManageSystem.UserInfoPersonal(ID);

            lblTen.Text       = a[1];
            lblBeginDate.Text = a[4];
            statisticResult.UpdateInfoResult();
        }
Пример #3
0
        private void btSavePassword_Click(object sender, EventArgs e)
        {
            if (txtOldPass.Text == "")
            {
                MessageBox.Show("Password can not be empty");
            }
            else if (CheckValidPass(txtOldPass.Text) == false)
            {
                MessageBox.Show("Password can not have invalid character");
            }
            else if (CheckValidPass(txtNewPass.Text) == false)
            {
                MessageBox.Show("Password can not have invalid character");
            }
            else
            {
                string ePassword = ManageSystem.EncryptPassword(txtOldPass.Text);
                if (!ManageSystem.Pass(ePassword))
                {
                    MessageBox.Show("Old password is not correct", "Thông báo");
                }
                else if (txtNewPass.Text == "")
                {
                    MessageBox.Show("Password can not be empty");
                }
                else if (txtNewPass.Text != txtReNewPass.Text)
                {
                    MessageBox.Show("Re-Password is not correct");
                }
                else if (txtNewPass.Text == txtOldPass.Text)
                {
                    MessageBox.Show("The new password is the same as the old password");
                }
                else
                {
                    string TK = ManageSystem.TK();

                    ManageSystem.UpdateNewPassword(ManageSystem.GetUserID(TK), txtNewPass.Text);
                    ManageSystem.UpdateNewPasswordToDatabase(ManageSystem.GetUserID(TK), txtNewPass.Text);

                    string ePassword1 = ManageSystem.EncryptPassword(txtNewPass.Text);
                    ManageSystem.UpdatePass(ePassword1);
                    MessageBox.Show("Save success!");
                    pnlEdit.Visible            = false;
                    pnlEdit.Enabled            = false;
                    pnlPersonalDetails.Visible = true;
                    pnlPersonalDetails.Enabled = true;
                    pnlSavePass.Visible        = false;
                    pnlSavePass.Enabled        = false;

                    ClearTextbox();
                }
            }
        }
Пример #4
0
        private void Update()
        {
            string        TK = ManageSystem.TK();
            int           ID = ManageSystem.GetUserID(TK);
            List <string> a  = ManageSystem.UserInfoPersonal(ID);

            lblDate.Text     = a[0];
            lblHoTen.Text    = a[1];
            lblGioiTinh.Text = a[2];
            lblGmail.Text    = a[3];
        }
Пример #5
0
 public static void AddToOwnCharacterList(string name)
 {
     foreach (var c in ManageSystem.GetAllCharacter())
     {
         if (c.Name == name)
         {
             ownSkin.Add(c);
             InsertIntoOwnCharacter(c);
             return;
         }
     }
 }
Пример #6
0
 private void btnLeft_Click(object sender, EventArgs e)
 {
     if (index > 0)
     {
         index--;
     }
     else
     {
         index = ManageSystem.CountAllFlashCards() - 1;
     }
     curFlashCard = ManageSystem.GetFlashCard(index);
     ChangeFlashCard(curFlashCard.Eng, curFlashCard.IdCard);
 }
Пример #7
0
 private void btnRight_Click(object sender, EventArgs e)
 {
     if (index < ManageSystem.CountAllFlashCards() - 1)
     {
         index++;
     }
     else
     {
         index = 0;
     }
     curFlashCard = ManageSystem.GetFlashCard(index);
     ChangeFlashCard(curFlashCard.Eng, curFlashCard.IdCard);
 }
Пример #8
0
 public ShopForm(Panel p)
 {
     InitializeComponent();
     darkMode = ManageUserAction.GetDarkMode();
     if (darkMode)
     {
         UpdateTheme();
     }
     ManageSystem.LoadCharacter();
     LoadAllCharacter();
     this.panel = p;
     LoadDiamondLabel();
 }
Пример #9
0
        private void InitAutoCompleteTextBox()
        {
            AutoCompleteStringCollection data = new AutoCompleteStringCollection();

            for (int i = 0; i < ManageSystem.CountAllFlashCards(); i++)
            {
                data.Add(ManageSystem.GetFlashCard(i).Eng);
                data.Add(ManageSystem.GetFlashCard(i).Viet);
            }
            txtSearching.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            txtSearching.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            txtSearching.AutoCompleteCustomSource = data;
        }
Пример #10
0
 public LibraryForm()
 {
     InitializeComponent();
     darkMode = ManageUserAction.GetDarkMode();
     if (darkMode)
     {
         UpdateTheme();
     }
     this.KeyPreview = true;
     ManageSystem.InitLibrary();
     curFlashCard = ManageSystem.GetFlashCard(index);
     ChangeFlashCard(curFlashCard.Eng, curFlashCard.IdCard);
     InitAutoCompleteTextBox();
 }
Пример #11
0
 public void LoadAllCharacter()
 {
     this.flpShop.Controls.Clear();
     foreach (var character in ManageSystem.GetAllCharacter())
     {
         ItemForm item = new ItemForm(this);
         item.ChangeInfo(character.ID, character.Name, character.Price);
         item.TopLevel        = false;
         item.FormBorderStyle = FormBorderStyle.None;
         item.Show();
         if (ManageUserAction.CheckExistCharacter(character))
         {
             item.ChangeStatus();
         }
         flpShop.Controls.Add(item);
     }
 }
Пример #12
0
 private void btnSaveEdit_Click(object sender, EventArgs e)
 {
     if (txtHoTen.Text == "")
     {
         MessageBox.Show("Please fill in all the information!");
     }
     else
     {
         if (CheckValidName(txtHoTen.Text))
         {
             string gender = "";
             if (rbNam.Checked == true && rbNu.Checked == false)
             {
                 gender = "Nam";
             }
             else if (rbNam.Checked == false && rbNu.Checked == true)
             {
                 gender = "Nữ";
             }
             else
             {
                 gender = "Bê đê";
             }
             string TK = ManageSystem.TK();
             int    ID = ManageSystem.GetUserID(TK);
             ManageSystem.AddInfoPersonal(ID, dtpNgaySinh.Value.ToString("dd/MM/yyyy"), txtHoTen.Text, gender);
             MessageBox.Show("Save Succes!");
             pnlEdit.Visible            = false;
             pnlEdit.Enabled            = false;
             pnlPersonalDetails.Visible = true;
             pnlPersonalDetails.Enabled = true;
             pnlSavePass.Visible        = false;
             pnlSavePass.Enabled        = false;
             Update();
         }
         else
         {
             MessageBox.Show("Name has invalid character and number!");
         }
         ClearTextbox();
     }
 }
Пример #13
0
        private void Login()
        {
            string encodedPassword = ManageSystem.EncryptPassword(txtPassword_Login.Text);

            if (ManageSystem.CheckLoginIfValid(txtUsename_Login.Text, txtPassword_Login.Text))
            {
                if (ManageSystem.CheckSignIn(txtUsename_Login.Text, encodedPassword))
                {
                    InitLoadingForm(ManageSystem.GetUserID(txtUsename_Login.Text));
                }
                else
                {
                    MessageBox.Show("Username or Password is not correct", "Notification");
                }
            }
            else
            {
                return;
            }
        }
Пример #14
0
 private void SignUp()
 {
     if (ManageSystem.CheckSignUpIfValid(txtUsername_SignUp.Text, txtEmail_SignUp.Text, txtPassword_SignUp.Text, txtRePassword_SignUp.Text))
     {
         if (ManageSystem.CheckSignUp(txtUsername_SignUp.Text, txtEmail_SignUp.Text, txtPassword_SignUp.Text, txtRePassword_SignUp.Text))
         {
             string encodedPassword = ManageSystem.EncryptPassword(txtPassword_SignUp.Text);
             ManageSystem.AddUser(txtUsername_SignUp.Text, txtEmail_SignUp.Text, encodedPassword);
             InitLoadingForm(ManageSystem.GetUserID(txtUsername_SignUp.Text));
         }
         else
         {
             return;
         }
     }
     else
     {
         return;
     }
 }
Пример #15
0
        public void UpdateInfoResult()
        {
            string        TK = ManageSystem.TK();
            int           ID = ManageSystem.GetUserID(TK);
            List <string> a  = ManageSystem.UserInfoPersonal(ID);

            lbTotal.Text = a[5];

            //
            lbTotal.Text        = ManageUserAction.GetItemOfAllCollection(0).ListFL.Count().ToString();
            lbLearned.Text      = lbTotal.Text;
            lbToLearn.Text      = (ManageSystem.CountAllFlashCards() - ManageUserAction.GetItemOfAllCollection(0).ListFL.Count()).ToString();
            pbAnimals.Value     = ManageUserAction.CalculateProgress(1, ID);
            pbPlants.Value      = ManageUserAction.CalculateProgress(2, ID);
            pbFruits.Value      = ManageUserAction.CalculateProgress(3, ID);
            pbJob.Value         = ManageUserAction.CalculateProgress(4, ID);
            pbFoodaDrinks.Value = ManageUserAction.CalculateProgress(5, ID);
            pbSport.Value       = ManageUserAction.CalculateProgress(6, ID);
            pbClothing.Value    = ManageUserAction.CalculateProgress(7, ID);
            pbTechnology.Value  = ManageUserAction.CalculateProgress(8, ID);
        }
Пример #16
0
 private void btnConfirm_Click(object sender, EventArgs e)
 {
     if (txtRePassForget.Text != txtPassForget.Text)
     {
         MessageBox.Show("Nhập lại mật khẩu không chính xác!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else if (txtValidateCode.Text != verifiedCode)
     {
         MessageBox.Show("Mã xác nhận không chính xác !", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         ManageSystem.UpdateNewPassword(ManageSystem.GetUserID_Email(txtCheckEmail.Text), txtPassForget.Text);
         ManageSystem.UpdateNewPasswordToDatabase(ManageSystem.GetUserID_Email(txtCheckEmail.Text), txtPassForget.Text);
         MessageBox.Show("Done");
         pnlForgetPass.Visible = false;
         pnlUserLogin.Visible  = true;
         pnlSignup.Visible     = false;
         transitionPanel.HideSync(pnlSignup);
         this.AcceptButton = this.btnLogin;
         ClearTextBox();
     }
 }
Пример #17
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            FlashCard fl = ManageSystem.SearchFlashCardEng(txtSearching.Text);

            if (fl != null)
            {
                index = fl.IdCard;
            }
            else
            {
                fl = ManageSystem.SearchFlashCardVie(txtSearching.Text);
                if (fl != null)
                {
                    index = fl.IdCard;
                }
                else
                {
                    return;
                }
            }
            curFlashCard = ManageSystem.GetFlashCard(index);
            ChangeFlashCard(curFlashCard.Eng, curFlashCard.IdCard);
        }
Пример #18
0
 public UserAccessForm()
 {
     InitializeComponent();
     DoubleBuffered = true;
     ManageSystem.ConnectDatabase();
 }
Пример #19
0
 private void btnCheckEmail_Click(object sender, EventArgs e)
 {
     if (ManageSystem.CheckForInternetConnection())
     {
         int idUser = ManageSystem.SearchEmail(txtCheckEmail.Text);
         if (idUser == -1)
         {
             MessageBox.Show("Email không tồn tại!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         else
         {
             txtPassForget.Visible   = true;
             txtRePassForget.Visible = true;
             txtValidateCode.Visible = true;
             lblBack.Visible         = true;
             btnConfirm.Visible      = true;
             txtCheckEmail.Visible   = false;
             btnCheckEmail.Visible   = false;
             this.AcceptButton       = this.btnConfirm;
             ClearTextBox();
             string code    = GenerateCode();
             string tk      = "vocabularyup1903";
             string mk      = "123456789vn";
             string port    = "587";
             string SMTP    = "smtp.gmail.com";
             string Messge  = "Mã xác nhận của bạn là : " + code;
             string To      = txtCheckEmail.Text;
             string cc      = "";
             string subject = "Your Code";
             login              = new NetworkCredential(tk, mk);
             client             = new SmtpClient(SMTP);
             client.Port        = Convert.ToInt32(port);
             client.EnableSsl   = checkBox.Checked;
             client.Credentials = login;
             msg = new MailMessage {
                 From = new MailAddress(tk + SMTP.Replace("smtp.", "@"), "Trung tâm Vocabulary-Up", Encoding.UTF8)
             };
             msg.To.Add(new MailAddress(To));
             if (!string.IsNullOrEmpty(cc))
             {
                 msg.To.Add(new MailAddress(cc));
             }
             msg.Subject      = subject;
             msg.Body         = Messge;
             msg.BodyEncoding = Encoding.UTF8;
             msg.IsBodyHtml   = true;
             msg.Priority     = MailPriority.Normal;
             msg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
             client.SendCompleted           += new SendCompletedEventHandler(SendOrPostCallback);
             string userstate = "Sending...";
             client.SendAsync(msg, userstate);
             verifiedCode = code;
             countDown.Start();
             countDownText.Start();
             btnCheckEmail.Enabled = false;
         }
     }
     else
     {
         MessageBox.Show("Kết nối có vấn đề!");
     }
 }
Пример #20
0
 // LẤY ID USER VÀ UPDATE REVISE FLASHCARD
 public static void UpdateUserInfo(int idUser)
 {
     currentUser = ManageSystem.GetUserInfo(idUser - 1);
     //UpdateReFlashCard(idUser);
 }