Пример #1
0
        // parameters:
        //      bLogin  是否在对话框后立即登录?如果为false,表示只是设置缺省帐户,并不直接登录
        CirculationLoginDlg SetDefaultAccount(
            string strServerUrl,
            string strTitle,
            string strComment,
            LoginFailCondition fail_contidion,
            IWin32Window owner)
        {
            CirculationLoginDlg dlg = new CirculationLoginDlg();
            MainForm.SetControlFont(dlg, this.Font);

            if (String.IsNullOrEmpty(strServerUrl) == true)
            {
                dlg.ServerUrl = GetFirstUrl(this.LibraryServerUrlList);
            }
            else
            {
                dlg.ServerUrl = strServerUrl;
            }

            if (owner == null)
                owner = this;

            if (String.IsNullOrEmpty(strTitle) == false)
                dlg.Text = strTitle;
#if NO
            if (bLogin == false)
                dlg.SetDefaultMode = true;
#endif

            dlg.SupervisorMode = true;

            dlg.Comment = strComment;
            dlg.UserName = AppInfo.GetString(
                "default_account",
                "username",
                "supervisor");

            dlg.SavePasswordShort =
    AppInfo.GetBoolean(
    "default_account",
    "savepassword_short",
    false);

            dlg.SavePasswordLong =
                AppInfo.GetBoolean(
                "default_account",
                "savepassword_long",
                false);

            if (dlg.SavePasswordShort == true || dlg.SavePasswordLong == true)
            {
                dlg.Password = AppInfo.GetString(
        "default_account",
        "password",
        "");
                dlg.Password = this.DecryptPasssword(dlg.Password);
            }
            else
            {
                dlg.Password = "";
            }

            dlg.IsReader = false;
            dlg.OperLocation = AppInfo.GetString(
                "default_account",
                "location",
                "");

            this.AppInfo.LinkFormState(dlg,
                "logindlg_state");

            if (fail_contidion == LoginFailCondition.PasswordError
                && dlg.SavePasswordShort == false
                && dlg.SavePasswordLong == false)
                dlg.AutoShowShortSavePasswordTip = true;

            dlg.ShowDialog(owner);

            this.AppInfo.UnlinkFormState(dlg);

            if (dlg.DialogResult == DialogResult.Cancel)
            {
                return null;
            }

            AppInfo.SetString(
                "default_account",
                "username",
                dlg.UserName);
            AppInfo.SetString(
                "default_account",
                "password",
                (dlg.SavePasswordShort == true || dlg.SavePasswordLong == true) ?
                this.EncryptPassword(dlg.Password) : "");

            AppInfo.SetBoolean(
    "default_account",
    "savepassword_short",
    dlg.SavePasswordShort);

            AppInfo.SetBoolean(
                "default_account",
                "savepassword_long",
                dlg.SavePasswordLong);

            AppInfo.SetString(
                "default_account",
                "location",
                dlg.OperLocation);

#if NO
            AppInfo.SetString(
                "config",
                "circulation_server_url",
                dlg.ServerUrl);
#endif
            return dlg;
        }
Пример #2
0
        void channel_BeforeLogin(object sender, BeforeLoginEventArgs e)
        {
            if (e.FirstTry == true)
            {
                e.UserName = this.SupervisorUserName;
                e.Password = this.SupervisorPassword;

                e.Parameters = "location=#setup,type=worker,client=dp2OPAC|0.01";   // 2016/5/6 加上 0.01 部分

                if (String.IsNullOrEmpty(e.UserName) == false)
                    return; // 立即返回, 以便作第一次 不出现 对话框的自动登录
            }

            // 
            IWin32Window owner = null;

            if (sender is IWin32Window)
                owner = (IWin32Window)sender;
            else
                owner = this;

            CirculationLoginDlg dlg = new CirculationLoginDlg();
            GuiUtil.AutoSetDefaultFont(dlg);
            // dlg.Text = "";
            dlg.ServerUrl = this.textBox_dp2LibraryUrl.Text;
            dlg.Comment = e.ErrorInfo;
            dlg.UserName = e.UserName;
            dlg.SavePasswordShort = false;
            dlg.SavePasswordLong = false;
            dlg.Password = e.Password;
            dlg.IsReader = false;
            dlg.OperLocation = "#setup";
            dlg.StartPosition = FormStartPosition.CenterScreen;

            dlg.ShowDialog(owner);

            if (dlg.DialogResult == DialogResult.Cancel)
            {
                e.Cancel = true;
                return;
            }

            e.UserName = dlg.UserName;
            e.Password = dlg.Password;
            e.SavePasswordShort = dlg.SavePasswordShort;
            e.Parameters = "location=#setup,type=worker,client=dp2OPAC|0.01";   // 2016/5/6 加上 0.01 部分

            e.SavePasswordLong = dlg.SavePasswordLong;
            e.LibraryServerUrl = dlg.ServerUrl;

            this.SupervisorUserName = e.UserName;
            this.SupervisorPassword = e.Password;
        }
Пример #3
0
        CirculationLoginDlg SetDefaultAccount(
    string strServerUrl,
    string strTitle,
    string strComment,
    IWin32Window owner)
        {
            CirculationLoginDlg dlg = new CirculationLoginDlg();

            if (String.IsNullOrEmpty(strServerUrl) == true)
            {
                dlg.ServerUrl =
        this.MainForm.AppInfo.GetString("config",
        "circulation_server_url",
        "http://localhost/dp2libraryws/library.asmx");
            }
            else
            {
                dlg.ServerUrl = strServerUrl;
            }

            if (owner == null)
                owner = this;

            if (String.IsNullOrEmpty(strTitle) == false)
                dlg.Text = strTitle;

            dlg.Comment = strComment;
            dlg.UserName = this.MainForm.AppInfo.GetString(
                "default_account",
                "username",
                "");

            dlg.SavePasswordShort =
    this.MainForm.AppInfo.GetBoolean(
    "default_account",
    "savepassword_short",
    false);

            dlg.SavePasswordLong =
                this.MainForm.AppInfo.GetBoolean(
                "default_account",
                "savepassword_long",
                false);

            if (dlg.SavePasswordShort == true || dlg.SavePasswordLong == true)
            {
                dlg.Password = this.MainForm.AppInfo.GetString(
        "default_account",
        "password",
        "");
                dlg.Password = this.DecryptPasssword(dlg.Password);
            }
            else
            {
                dlg.Password = "";
            }


            dlg.IsReader =
                this.MainForm.AppInfo.GetBoolean(
                "default_account",
                "isreader",
                false);
            dlg.OperLocation = this.MainForm.AppInfo.GetString(
                "default_account",
                "location",
                "");

            this.MainForm.AppInfo.LinkFormState(dlg,
                "logindlg_state");

            dlg.ShowDialog(owner);

            this.MainForm.AppInfo.UnlinkFormState(dlg);


            if (dlg.DialogResult == DialogResult.Cancel)
            {
                return null;
            }

            this.MainForm.AppInfo.SetString(
                "default_account",
                "username",
                dlg.UserName);
            this.MainForm.AppInfo.SetString(
                "default_account",
                "password",
                (dlg.SavePasswordShort == true || dlg.SavePasswordLong == true) ?
                this.EncryptPassword(dlg.Password) : "");

            this.MainForm.AppInfo.SetBoolean(
    "default_account",
    "savepassword_short",
    dlg.SavePasswordShort);

            this.MainForm.AppInfo.SetBoolean(
                "default_account",
                "savepassword_long",
                dlg.SavePasswordLong);

            this.MainForm.AppInfo.SetBoolean(
                "default_account",
                "isreader",
                dlg.IsReader);
            this.MainForm.AppInfo.SetString(
                "default_account",
                "location",
                dlg.OperLocation);


            // 2006/12/30
            this.MainForm.AppInfo.SetString(
                "config",
                "circulation_server_url",
                dlg.ServerUrl);


            return dlg;
        }
Пример #4
0
        // parameters:
        CirculationLoginDlg SetFingerprintAccount(
            string strServerUrl,
            string strTitle,
            string strComment,
            LoginFailCondition fail_contidion,
            IWin32Window owner)
        {
            CirculationLoginDlg dlg = new CirculationLoginDlg();
            MainForm.SetControlFont(dlg, this.MainForm.DefaultFont);

            if (String.IsNullOrEmpty(strServerUrl) == true)
            {
                dlg.ServerUrl =
        this.MainForm.AppInfo.GetString("config",
        "circulation_server_url",
        "http://localhost:8001/dp2library");
            }
            else
            {
                dlg.ServerUrl = strServerUrl;
            }

            if (owner == null)
                owner = this;

            if (String.IsNullOrEmpty(strTitle) == false)
                dlg.Text = strTitle;

            dlg.Comment = strComment;
            dlg.UserName = this.MainForm.FingerprintUserName;

            dlg.IsReaderEnabled = false;

            dlg.SavePasswordShort = false;
            dlg.SavePasswordShortEnabled = false;

            dlg.SavePasswordLong = false;

            dlg.Password = this.MainForm.FingerprintPassword;

            dlg.IsReader = false;
            dlg.OperLocation = this.MainForm.AppInfo.GetString(
                "default_account",
                "location",
                "");

            this.MainForm.AppInfo.LinkFormState(dlg,
                "logindlg_state");

            dlg.ShowDialog(owner);

            this.MainForm.AppInfo.UnlinkFormState(dlg);


            if (dlg.DialogResult == DialogResult.Cancel)
            {
                return null;
            }

            this.MainForm.FingerprintUserName = dlg.UserName;

            if (dlg.SavePasswordLong == true)
                this.MainForm.FingerprintPassword = dlg.Password;

            // server url的修改不要记忆

            return dlg;
        }