Ejemplo n.º 1
0
        private void ChangePasswordClick(object sender, EventArgs e)
        {
            if (!mc.check.READY_PUSH(sender))
            {
                return;
            }
            mc.check.push(sender, true);

            if (TB_CurrentUserName.Text.Length < 2)
            {
                MessageBox.Show(textResource.MB_USER_LOG_IN_ACCOUNT, "Change Password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            FormPassword ff = new FormPassword();

            FormPassword.mode = 1;

            if (mc.user.getPassword(mc.user.logInUserName, out ret.s) == false)
            {
                MessageBox.Show(textResource.MB_USER_NOT_EXIST_NAME, "Change Password", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                mc.check.push(sender, false);
                return;
            }

            FormPassword.currentPassword = ret.s;

            ff.ShowDialog();

            if (FormPassword.inputPassword != "")
            {
                mc.user.changePassword(mc.user.logInUserName, FormPassword.inputPassword);
                mc.user.writeUserInfo();
            }

            if (!mc.check.READY_PUSH(sender))
            {
                return;
            }
            mc.check.push(sender, false);
        }
Ejemplo n.º 2
0
        private void AddUserClick(object sender, EventArgs e)
        {
            if (!mc.check.READY_PUSH(sender))
            {
                return;
            }
            mc.check.push(sender, true);

            if (TB_AddUserName.Text.Length < 2)
            {
                EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.WARNING, String.Format(textResource.MB_USER_NAME_COUNT_FAIL));
                mc.check.push(sender, false);
                return;
            }

            if (mc.user.checkUserExist(TB_AddUserName.Text, out ret.i))
            {
                EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.WARNING, String.Format(textResource.MB_USER_NAME_DUPLICATE_FAIL));
                mc.check.push(sender, false);
                return;
            }

            FormLogInPw pwForm = new FormLogInPw();

            pwForm.Text = "Input Master Password";

            pwForm.ShowDialog();

            if (FormLogInPw.inputPassword != mc.user.Master_Password)
            {
                EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.WARNING, String.Format(textResource.MB_USER_MASTER_PW_FAIL));
                mc.check.push(sender, false);
                return;
            }

            FormPassword ff = new FormPassword();

            FormPassword.mode = 0;

            ff.ShowDialog();

            if (FormPassword.inputPassword.Length < 2)
            {
                EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.WARNING, String.Format(textResource.MB_USER_PW_COUNT_FAIL));
                mc.check.push(sender, false);
                return;
            }

            EVENT.userDialogMessage(DIAG_SEL_MODE.OK, DIAG_ICON_MODE.INFORMATION, String.Format(textResource.MB_USER_ADD_ACCOUNT, TB_AddUserName.Text));
            mc.user.addUser(TB_AddUserName.Text, FormPassword.inputPassword);
            mc.user.writeUserInfo();

            CB_LogInUserList.Items.Clear();
            CB_RegisteredUserList.Items.Clear();

            for (int i = 0; i < mc.user.userNumber; i++)
            {
                CB_LogInUserList.Items.Add(mc.user.userName[i]);
                CB_RegisteredUserList.Items.Add(mc.user.userName[i]);
            }
            mc.check.push(sender, false);
        }