Beispiel #1
0
        // return:
        //      -1  出错
        //      0   成功
        //      1   尚未登录
        public int LoadReaderXml(out string strError)
        {
            strError = "";

            app = (OpacApplication)this.Page.Application["app"];
            if (app == null)
            {
                strError = "app == null";
                goto ERROR1;
            }
            sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];
            if (sessioninfo == null)
            {
                strError = "sessioninfo == null";
                goto ERROR1;
            }

            if (String.IsNullOrEmpty(sessioninfo.UserID) == true)
            {
                return(1);
            }

            XmlDocument readerdom = null;
            // 获得当前session中已经登录的读者记录DOM
            // return:
            //      -2  当前登录的用户不是reader类型
            //      -1  出错
            //      0   尚未登录
            //      1   成功
            int nRet = sessioninfo.GetLoginReaderDom(
                out readerdom,
                out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            if (nRet == 0)
            {
                return(1);
            }

            if (nRet == -2)
            {
                if (String.IsNullOrEmpty(this.ReaderBarcode) == true)
                {
                    strError = "当前登录的用户不是reader类型,并且ReaderInfoBase.ReaderBarcode也为空";
                    goto ERROR1;
                }

                // TODO: 是否进一步判断Type
                // if (sessioninfo.Account.Type != "worreader")

                // 管理员获得特定证条码号的读者记录DOM
                // return:
                //      -2  当前登录的用户不是librarian类型
                //      -1  出错
                //      0   尚未登录
                //      1   成功
                nRet = sessioninfo.GetOtherReaderDom(
                    this.ReaderBarcode,
                    out readerdom,
                    out strError);
                if (nRet == -1 || nRet == -2)
                {
                    goto ERROR1;
                }

                if (nRet == 0)
                {
                    return(1);
                }
            }

            this.ReaderDom = readerdom;

            return(0);

ERROR1:
            return(-1);
        }
Beispiel #2
0
        protected override void Render(HtmlTextWriter output)
        {
            string          strError = "";
            OpacApplication app      = (OpacApplication)this.Page.Application["app"];

            if (app == null)
            {
                strError = "app == null";
                goto ERROR1;
            }
            SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            if (sessioninfo == null)
            {
                strError = "sessioninfo == null";
                goto ERROR1;
            }

            XmlDocument readerdom = null;
            // 获得当前session中已经登录的读者记录DOM
            // return:
            //      -2  当前登录的用户不是reader类型
            //      -1  出错
            //      0   尚未登录
            //      1   成功
            int nRet = sessioninfo.GetLoginReaderDom(
                out readerdom,
                out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            if (nRet == 0)
            {
                sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl);
                this.Page.Response.Redirect("login.aspx", true);
                return;
            }

            if (nRet == -2)
            {
                if (String.IsNullOrEmpty(this.ReaderBarcode) == true)
                {
                    // text-level: 内部错误
                    strError = "当前登录的用户不是reader类型,并且BorrowInfoControl.ReaderBarcode也为空";
                    goto ERROR1;
                }

                // TODO: 是否进一步判断Type
                // if (sessioninfo.Account.Type != "worreader")

                // 管理员获得特定证条码号的读者记录DOM
                // return:
                //      -2  当前登录的用户不是librarian类型
                //      -1  出错
                //      0   尚未登录
                //      1   成功
                nRet = sessioninfo.GetOtherReaderDom(
                    this.ReaderBarcode,
                    out readerdom,
                    out strError);
                if (nRet == -1 || nRet == -2)
                {
                    goto ERROR1;
                }

                if (nRet == 0)
                {
                    sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl);
                    this.Page.Response.Redirect("login.aspx?loginstyle=librarian", true);
                    return;
                }
            }

            // 兑现 借阅信息
            RenderBorrow(app,
                         sessioninfo,
                         readerdom);

            base.Render(output);
            return;

ERROR1:
            output.Write(strError);
        }