text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

using DigitalPlatform.rms.Client;
using DigitalPlatform.Xml;
namespace DigitalPlatform.LibraryServer
{
#if NOOOOOOOOOOOOOOO
    [DefaultProperty("Text")]
    [ToolboxData("<{0}:MyLibraryControl runat=server></{0}:MyLibraryControl>")]
    public class MyLibraryControl : WebControl, INamingContainer
    {
        /*
        public SessionInfo SessionInfo = null;
        public CirculationApplication App = null;
         */

        public string Barcode = "";

        [Bindable(true)]
        [Category("Appearance")]
        [DefaultValue("")]
        [Localizable(true)]
        public string Text
        {
            get
            {
                String s = (String)ViewState["Text"];
                return ((s == null) ? String.Empty : s);
            }

            set
            {
                ViewState["Text"] = value;
            }
        }

        /*
        // Î¥Ô¼ÐÅÏ¢ÄÚÈÝÐÐÊý
        public int OverdueLineCount
        {
            get
            {
                object o = this.Page.Session[this.ID + "MyLibraryControl_OverdueLineCount"];
                return (o == null) ? 0 : (int)o;
            }
            set
            {
                this.Page.Session[this.ID + "MyLibraryControl_OverdueLineCount"] = (object)value;
            }
        }
         */

        // ½èÔÄÐÅÏ¢ÄÚÈÝÐÐÊý
        public int BorrowLineCount
        {
            get
            {
                object o = this.Page.Session[this.ID + "MyLibraryControl_BorrowLineCount"];
                return (o == null) ? 0 : (int)o;
            }
            set
            {
                this.Page.Session[this.ID + "MyLibraryControl_BorrowLineCount"] = (object)value;
            }
        }

        // Ô¤Ô¼ÐÅÏ¢ÄÚÈÝÐÐÊý
        public int ReservationLineCount
        {
            get
            {
                object o = this.Page.Session["MyLibraryControl_ReservationLineCount"];
                return (o == null) ? 0 : (int)o;
            }
            set
            {
                this.Page.Session["MyLibraryControl_ReservationLineCount"] = (object)value;
            }
        }

        // ÒѽèÔÄÌõÂëºÅÁбí
        public List<string> BorrowBarcodes
        {
            get
            {
                object o = this.Page.Session["MyLibraryControl_BorrowBarcodes"];
                return (o == null) ? new List<string>() : (List<string>)o;
            }
            set
            {
                this.Page.Session["MyLibraryControl_BorrowBarcodes"] = (object)value;
            }
        }

        // ÒÑÔ¤Ô¼ÌõÂëºÅÁбí
        public List<string> ReservationBarcodes
        {
            get
            {
                object o = this.Page.Session["MyLibraryControl_ReservationBarcodes"];
                return (o == null) ? new List<string>() : (List<string>)o;
            }
            set
            {
                this.Page.Session["MyLibraryControl_ReservationBarcodes"] = (object)value;
            }
        }

        // ²¼¾Ö¿Ø¼þ
        protected override void CreateChildControls()
        {
            // ²ÉÓÃÔ²ÐνǵĿò×Ó

            // ÖØÒª±êʶ: Ö¤ÌõÂëºÅ¡¢ÐÕÃû¡¢Ö¤°ä·¢ºÍÓÐЧÆÚ
            PlaceHolder identity = new PlaceHolder();
            identity.ID = "identity";
            this.Controls.Add(identity);

            CreateIdentityControls(identity);

            LiteralControl sep = new LiteralControl();
            sep.Text = "
";
            this.Controls.Add(sep);

            // Ò»°ãÐÅÏ¢£ºÐÔ±ðסַµÈµÈ ¿ÉÒÔ³õ'»¯ÎªÊÕËõ״̬
            PlaceHolder generalinfo = new PlaceHolder();
            generalinfo.ID = "generalinfo";
            this.Controls.Add(generalinfo);

            CreateGeneralInfoControls(generalinfo);

            sep = new LiteralControl();
            sep.Text = "
";
            this.Controls.Add(sep);

            // Î¥Ô¼ÐÅÏ¢
            PlaceHolder overdueinfo = new PlaceHolder();
            overdueinfo.ID = "overdueinfo";
            this.Controls.Add(overdueinfo);

            CreateOverdueInfoControls(overdueinfo);

            sep = new LiteralControl();
            sep.Text = "
";
            this.Controls.Add(sep);

            // ½èÔÄÐÅÏ¢
            PlaceHolder borrowinfo = new PlaceHolder();
            borrowinfo.ID = "borrowinfo";
            this.Controls.Add(borrowinfo);

            CreateBorrowInfoControls(borrowinfo);

            sep = new LiteralControl();
            sep.Text = "
";
            this.Controls.Add(sep);

            // Ô¤Ô¼ÇëÇó
            PlaceHolder reservation = new PlaceHolder();
            reservation.ID = "reservation";
            this.Controls.Add(reservation);

            CreateReservationControls(reservation);

            sep = new LiteralControl();
            sep.Text = "
";
            this.Controls.Add(sep);

            // ÆäËûÃüÁî
            PlaceHolder commands = new PlaceHolder();
            commands.ID = "commands";
            this.Controls.Add(commands);

            CreateCommandsControls(commands);

            // ×Ô¼º¶¨ÖƵĽ¹µãµÄÎÄÏ×£¨¶¨Ìâ¼ìË÷£©
            PlaceHolder prefer = new PlaceHolder();
            prefer.ID = "prefer";
            this.Controls.Add(prefer);

        }

        void CreateRoundTableStart(Control parent,
            string strID,
            string strTitleText,
            out Button button)
        {
            button = null;

            string strResult = "";
            strResult += "
";
            strResult += "
";
            strResult += "      ";
            strResult += "
";
            strResult += "
";
            strResult += "

";
            strResult += "

";
            strResult += "

";
            strResult += "

";
            strResult += "
";

            strResult += "
";
            strResult += "
";

            LiteralControl literal = new LiteralControl();
            literal.Text = strResult;
            parent.Controls.Add(literal);

            button = new Button();
            button.ID = strID + "_expandbutton";
            button.Text = "-";
            parent.Controls.Add(button);

            literal = new LiteralControl();
            literal.ID = strID + "_titletext";
            literal.Text = strTitleText;
            parent.Controls.Add(literal);

            strResult =  "
";
            strResult += "
";

            literal = new LiteralControl();
            literal.Text = strResult;
            parent.Controls.Add(literal);

        }

        /*
        string GetRoundTableStart(string strTableTitle)
        {
            string strResult = "";
            strResult += "
";
            strResult += "
";
            strResult += "      ";
            strResult += "
";
            strResult += "
";
            strResult += "

";
            strResult += "

";
            strResult += "

";
            strResult += "

";
            strResult += "
";

            strResult += "
";
            strResult += "
"+strTableTitle+"
";
            strResult += "
";

            return strResult;
        }
         */

        string GetRoundTableEnd()
        {
            string strResult = "";

            strResult += "
";
            strResult += "

";
            strResult += "

";
            strResult += "

";
            strResult += "

";
            strResult += "
";

		    strResult += "
";
	        strResult += "      	";
            strResult += "
";
            strResult += "
";

            return strResult;
        }

        // ´´½¨³õ'µÄʶ±ðÐÅÏ¢ÐÅÏ¢ÄÚ²¿Ðв¼¾Ö
        void CreateIdentityControls(PlaceHolder parent)
        {
            Button identityExpandButton = null;
            CreateRoundTableStart(parent, "identity", "ʶ±ðÐÅÏ¢", out identityExpandButton);
            identityExpandButton.Click += new EventHandler(identityExpandButton_Click);

            PlaceHolder identity = new PlaceHolder();
            identity.ID = "identity_content";
            parent.Controls.Add(identity);

            LiteralControl titleline = new LiteralControl();
            titleline.ID = "identity_titleline";
            titleline.Text = "
";
            // titleline.Text += "
ÊÂÏî	Öµ
";
            identity.Controls.Add(titleline);

            // ÿһÐÐÒ»¸öռλ¿Ø¼þ
            NewIdentityLine(identity, "ÐÕÃû", "identity_name", true);
            NewIdentityLine(identity, "¶ÁÕßÖ¤ÌõÂëºÅ", "identity_barcode", true);
            NewIdentityLine(identity, "״̬", "identity_state", true);
            NewIdentityLine(identity, "¶ÁÕßÀà±ð", "identity_readertype", false);
            NewIdentityLine(identity, "·¢Ö¤ÈÕÆÚ", "identity_createdate", false);
            NewIdentityLine(identity, "ʧЧÈÕÆÚ", "identity_expiredate", false);

            // ×îºóÒ»¸ö¿Õ°×ÐÐ
            LiteralControl literal = new LiteralControl();
            literal.ID = "identity_blank";
            literal.Text = "

";
            identity.Controls.Add(literal);

            literal = new LiteralControl();
            literal.ID = "identity_tableend";
            literal.Text = "
";
            identity.Controls.Add(literal);

            literal = new LiteralControl();
            literal.Text =  GetRoundTableEnd();
            parent.Controls.Add(literal);
        }

        void identityExpandButton_Click(object sender, EventArgs e)
        {
            ExpandContent("identity");
        }

        void ExpandContent(string strID)
        {
            Button button = (Button)this.FindControl(strID + "_expandbutton");
            Control control = this.FindControl(strID + "_content");
            if (control.Visible == true)
            {
                control.Visible = false;
                button.Text = "+";
            }
            else
            {
                control.Visible = true;
                button.Text = "-";
            }
        }

        PlaceHolder NewIdentityLine(Control parent,
            string strName,
            string strValueControlID,
            bool bLarge)
        {

            string strClass = "";
            if (bLarge == true)
                strClass = " class='largecontent' ";

            PlaceHolder line = new PlaceHolder();
            line.ID = "line" + strValueControlID;

            if (FindControl(line.ID) != null)
                throw new Exception("id='" + line.ID + "' already existed");

            parent.Controls.Add(line);

            // ×ó²àÎÄ×Ö
            LiteralControl literal = new LiteralControl();
            literal.Text = "
" + strName + "	";
            line.Controls.Add(literal);

            // Öµ
            literal = new LiteralControl();
            literal.ID = strValueControlID;
            literal.Text = "(¿Õ)";
            line.Controls.Add(literal);

            // ÓÒ²àÎÄ×Ö
            literal = new LiteralControl();
            literal.Text = "
";
            line.Controls.Add(literal);

            return line;
        }

        // Ò»°ãÃüÁî
        void CreateCommandsControls(PlaceHolder parent)
        {
            // ÐÞ¸ÄÃÜÂë
            HyperLink changepassword = new HyperLink();
            changepassword.Text = "ÐÞ¸ÄÃÜÂë";
            changepassword.NavigateUrl = "./changereaderpassword.aspx";
            parent.Controls.Add(changepassword);

            // Ð޸ĸöÈËÐÅÏ¢

        }

        // ´´½¨³õ'µÄÒ»°ãÐÅÏ¢ÄÚ²¿Ðв¼¾Ö
        void CreateGeneralInfoControls(PlaceHolder parent)
        {
            /*
            LiteralControl tablebegin = new LiteralControl();
            tablebegin.ID = "generalinfo_tablebegin";
            tablebegin.Text = GetRoundTableStart("Ò»°ãÐÅÏ¢") + "
";
            generalinfo.Controls.Add(tablebegin);
             */
            Button generalinfoExpandButton = null;
            CreateRoundTableStart(parent, "generalinfo", "Ò»°ãÐÅÏ¢", out generalinfoExpandButton);
            generalinfoExpandButton.Click += new EventHandler(generalinfoExpandButton_Click);

            PlaceHolder generalinfo = new PlaceHolder();
            generalinfo.ID = "generalinfo_content";
            parent.Controls.Add(generalinfo);

            LiteralControl titleline = new LiteralControl();
            titleline.ID = "generalinfo_titleline";
            titleline.Text = "
";
            // titleline.Text += "
ÊÂÏî	Öµ
";
            generalinfo.Controls.Add(titleline);

            // ÿһÐÐÒ»¸öռλ¿Ø¼þ
            NewGeneralInfoLine(generalinfo, "ÐÔ±ð", "generalinfo_gender");
            NewGeneralInfoLine(generalinfo, "ÉúÈÕ", "generalinfo_birthday");
            NewGeneralInfoLine(generalinfo, "Éí·ÝÖ¤ºÅ", "generalinfo_idcardnumber");
            NewGeneralInfoLine(generalinfo, "µ¥Î»", "generalinfo_department");
            NewGeneralInfoLine(generalinfo, "µØÖ·", "generalinfo_address");
            NewGeneralInfoLine(generalinfo, "µç»°", "generalinfo_tel");
            NewGeneralInfoLine(generalinfo, "EmailµØÖ·", "generalinfo_email");

            // ×îºóÒ»¸ö¿Õ°×ÐÐ
            LiteralControl literal = new LiteralControl();
            literal.ID = "generalinfo_blank";
            literal.Text = "

";
            generalinfo.Controls.Add(literal);

            literal = new LiteralControl();
            literal.ID = "generalinfo_tableend";
            literal.Text = "
";
            generalinfo.Controls.Add(literal);

            literal = new LiteralControl();
            literal.Text = GetRoundTableEnd();
            parent.Controls.Add(literal);

        }

        void generalinfoExpandButton_Click(object sender, EventArgs e)
        {
            ExpandContent("generalinfo");
        }

        PlaceHolder NewGeneralInfoLine(Control parent,
    string strName,
    string strValueControlID)
        {
            PlaceHolder line = new PlaceHolder();
            line.ID = "line" + strValueControlID;

            if (FindControl(line.ID) != null)
                throw new Exception("id='" + line.ID + "' already existed");

            parent.Controls.Add(line);

            // ×ó²àÎÄ×Ö
            LiteralControl literal = new LiteralControl();
            literal.Text = "
" + strName + "	";
            line.Controls.Add(literal);

            // Öµ
            literal = new LiteralControl();
            literal.ID = strValueControlID;
            literal.Text = "(¿Õ)";
            line.Controls.Add(literal);

            // ÓÒ²àÎÄ×Ö
            literal = new LiteralControl();
            literal.Text = "
";
            line.Controls.Add(literal);

            return line;
        }

        // ´´½¨³õ'µÄÎ¥Ô¼ÐÅÏ¢ÄÚ²¿Ðв¼¾Ö
        void CreateOverdueInfoControls(PlaceHolder parent)
        {
            Button overdueinfoExpandButton = null;
            CreateRoundTableStart(parent, "overdueinfo", "Î¥Ô¼ÐÅÏ¢", out overdueinfoExpandButton);
            overdueinfoExpandButton.Click += new EventHandler(overdueinfoExpandButton_Click);

            PlaceHolder overdueinfo = new PlaceHolder();
            overdueinfo.ID = "overdueinfo_content";
            parent.Controls.Add(overdueinfo);

            LiteralControl titleline = new LiteralControl();
            titleline.ID = "overdueinfo_titleline";
            titleline.Text = "
";
            titleline.Text += "
²áÌõÂëºÅ	ÕªÒª	Î¥Ô¼Çé¿ö	½èÔÄÈÕÆÚ	ÆÚÏÞ	»¹ÊéÈÕÆÚ
";
            overdueinfo.Controls.Add(titleline);

            /*
            // ÿһÐÐÒ»¸öռλ¿Ø¼þ
            for (int i = 0; i < this.OverdueLineCount; i++)
            {
                PlaceHolder line = NewOverdueLine(overdueinfo, i, null);
                line.Visible = true;
            }
             */

            // ±í¸ñÐвåÈëµã
            PlaceHolder insertpos = new PlaceHolder();
            insertpos.ID = "overdueinfo_insertpos";
            overdueinfo.Controls.Add(insertpos);

            // ×îºóÒ»¸ö¿Õ°×ÐÐ
            LiteralControl literal = new LiteralControl();
            literal.ID = "overdueinfo_blank";
            literal.Text = "

";
            overdueinfo.Controls.Add(literal);

            literal = new LiteralControl();
            literal.ID = "overdueinfo_tableend";
            literal.Text = "
";
            overdueinfo.Controls.Add(literal);

            literal = new LiteralControl();
            literal.Text = GetRoundTableEnd();
            parent.Controls.Add(literal);

        }

        void overdueinfoExpandButton_Click(object sender, EventArgs e)
        {
            // off¹ÜϽÄÚµÄcheckbox
            OffCheckBoxes("overdueinfo");

            ExpandContent("overdueinfo");
        }

        //

        // ´´½¨³õ'µÄ½èÔÄÐÅÏ¢ÄÚ²¿Ðв¼¾Ö
        void CreateBorrowInfoControls(PlaceHolder parent)
        {
            Button borrowinfoExpandButton = null;
            CreateRoundTableStart(parent, "borrowinfo", "½èÔÄÐÅÏ¢", out borrowinfoExpandButton);
            borrowinfoExpandButton.Click += new EventHandler(borrowinfoExpandButton_Click);

            PlaceHolder borrowinfo = new PlaceHolder();
            borrowinfo.ID = "borrowinfo_content";
            parent.Controls.Add(borrowinfo);

            LiteralControl titleline = new LiteralControl();
            titleline.ID = "borrowinfo_titleline";
            titleline.Text = "
";
            titleline.Text += "
²áÌõÂëºÅ	ÕªÒª	Ðø½è´Î	½èÔÄÈÕÆÚ	ÆÚÏÞ	²Ù×÷Õß	ÊÇ·ñ³¬ÆÚ	±¸×¢
";
            borrowinfo.Controls.Add(titleline);

            // ÿһÐÐÒ»¸öռλ¿Ø¼þ
            for (int i = 0; i < this.BorrowLineCount; i++)
            {
                PlaceHolder line = NewBorrowLine(borrowinfo, i, null);
                line.Visible = true;
            }

            // ±í¸ñÐвåÈëµã
            PlaceHolder insertpos = new PlaceHolder();
            insertpos.ID = "borrowinfo_insertpos";
            borrowinfo.Controls.Add(insertpos);

            //
            // ÃüÁîÐÐ
            PlaceHolder cmdline = new PlaceHolder();
            cmdline.ID = "borrowinfo_cmdline";
            borrowinfo.Controls.Add(cmdline);

            LiteralControl literal = new LiteralControl();
            literal.Text = "
";
            cmdline.Controls.Add(literal);

            Button renewButton = new Button();
            renewButton.ID = "borrowinfo_renewbutton";
            renewButton.Text = "Ðø½è";
            renewButton.Click +=new EventHandler(renewButton_Click);
            cmdline.Controls.Add(renewButton);
            renewButton = null;

            literal = new LiteralControl();
            literal.Text = "
";
            cmdline.Controls.Add(literal);

            cmdline = null;

            // µ÷ÊÔÐÅÏ¢ÐÐ
            PlaceHolder debugline = new PlaceHolder();
            debugline.ID = "borrowinfo_debugline";
            borrowinfo.Controls.Add(debugline);

            literal = new LiteralControl();
            literal.Text = "
";
            debugline.Controls.Add(literal);

            literal = new LiteralControl();
            literal.ID = "borrowinfo_debugtext";
            literal.Text = "";
            debugline.Controls.Add(literal);

            literal = new LiteralControl();
            literal.Text = "
";
            debugline.Controls.Add(literal);

            debugline = null;

            //
            /*

            // ×îºóÒ»¸ö¿Õ°×ÐÐ
            LiteralControl literal = new LiteralControl();
            literal.ID = "borrowinfo_blank";
            literal.Text = "

";
            borrowinfo.Controls.Add(literal);
             */

            literal = new LiteralControl();
            literal.ID = "borrowinfo_tableend";
            literal.Text = "
";
            borrowinfo.Controls.Add(literal);

            literal = new LiteralControl();
            literal.Text = GetRoundTableEnd();
            parent.Controls.Add(literal);

        }

        void renewButton_Click(object sender, EventArgs e)
        {
            List<string> barcodes = this.GetCheckedBorrowBarcodes();

            if (barcodes.Count == 0)
            {
                SetBorrowDebugInfo("ÉÐδѡÔñÒªÐø½èµÄÊÂÏî¡£");
                return;
            }

            LibraryApplication app = (LibraryApplication)this.Page.Application["app"];
            SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            for (int i = 0; i < barcodes.Count; i++)
            {
                string strItemBarcode = barcodes[i];
                //string strItemRecord = "";
                //string strReaderRecord = "";

                string strReaderBarcode = "";
                if (String.IsNullOrEmpty(this.Barcode) == false)
                    strReaderBarcode = this.Barcode;
                else
                    strReaderBarcode = sessioninfo.Account.Barcode;

                if (String.IsNullOrEmpty(strReaderBarcode) == true)
                {
                    SetBorrowDebugInfo("ÉÐδָ¶¨¶ÁÕßÖ¤ÌõÂëºÅ¡£²Ù×÷ʧ°Ü¡£");
                    return;
                }

                string[] aDupPath = null;
                string[] item_records = null;
                string[] reader_records = null;
                string[] biblio_records = null;
                BorrowInfo borrow_info = null;

                LibraryServerResult result = app.Borrow(
                    sessioninfo,
                    true,
                    strReaderBarcode,
                    strItemBarcode,
                    null,
                    false,
                    null,
                    "", // style
                    "",
                    out item_records,
                    "",
                    out reader_records,
                    "",
                    out biblio_records,
                    out aDupPath,
                    out borrow_info);

                if (result.Value == -1)
                {
                    SetBorrowDebugInfo(result.ErrorInfo);
                    return;
                }
            }

            SetBorrowDebugInfo("Ðø½è³É¹¦¡£");
        }

        void SetBorrowDebugInfo(string strText)
        {
            LiteralControl text = (LiteralControl)this.FindControl("borrowinfo_debugtext");

            text.Text = strText;
        }

        void borrowinfoExpandButton_Click(object sender, EventArgs e)
        {
            // off¹ÜϽÄÚµÄcheckbox
            OffCheckBoxes("borrowinfo");

            ExpandContent("borrowinfo");
        }

        // ´´½¨³õ'µÄÔ¤Ô¼ÐÅÏ¢ÄÚ²¿Ðв¼¾Ö
        void CreateReservationControls(PlaceHolder parent)
        {
            parent.Controls.Clear();

            /*
            LiteralControl tablebegin = new LiteralControl();
            tablebegin.ID = "reservation_tablebegin";
            tablebegin.Text = GetRoundTableStart("Ô¤Ô¼ÐÅÏ¢") + "
";
            reservation.Controls.Add(tablebegin);
             */
            Button reservationExpandButton = null;
            CreateRoundTableStart(parent, "reservation", "Ô¤Ô¼ÐÅÏ¢", out reservationExpandButton);
            reservationExpandButton.Click += new EventHandler(reservationExpandButton_Click);

            PlaceHolder reservation = new PlaceHolder();
            reservation.ID = "reservation_content";
            parent.Controls.Add(reservation);

            LiteralControl titleline = new LiteralControl();
            titleline.ID = "reservation_titleline";
            titleline.Text = "
";
            titleline.Text += "
²áÌõÂëºÅ	µ½´ïÇé¿ö	ÕªÒª	ÇëÇóÈÕÆÚ	²Ù×÷Õß
";
            reservation.Controls.Add(titleline);

            // ÿһÐÐÒ»¸öռλ¿Ø¼þ
            for (int i = 0; i < this.ReservationLineCount; i++)
            {
                PlaceHolder line = NewReservationLine(reservation, i, null);
                line.Visible = true;
            }

            // ±í¸ñÐвåÈëµã
            PlaceHolder insertpos = new PlaceHolder();
            insertpos.ID = "reservation_insertpos";
            reservation.Controls.Add(insertpos);

            // ÃüÁîÐÐ
            PlaceHolder cmdline = new PlaceHolder();
            cmdline.ID = "reservation_cmdline";
            reservation.Controls.Add(cmdline);

            LiteralControl literal = new LiteralControl();
            literal.Text = "
";
            cmdline.Controls.Add(literal);

            literal = new LiteralControl();
            literal.Text = " (×¢£ºÉ¾³ý״̬Ϊ¡°Òѵ½Ê顱µÄÐбíʾ¶ÁÕß·ÅÆúÈ¡Êé¡£Èç¹ûҪȥͼÊé¹ÝÕý³£È¡Ê飬ÇëÒ»¶¨²»ÒªÉ¾³ýÕâÑùµÄÐУ¬´ýÈ¡ÊéÍê³ÉºóÈí¼þ»á×Ô¶¯É¾³ý)
";
            cmdline.Controls.Add(literal);

            Button reservationDeleteButton = new Button();
            reservationDeleteButton.ID = "reservation_deletebutton";
            reservationDeleteButton.Text = "ɾ³ý";
            reservationDeleteButton.Click -= new EventHandler(reservationDeleteButton_Click);
            reservationDeleteButton.Click += new EventHandler(reservationDeleteButton_Click);
            cmdline.Controls.Add(reservationDeleteButton);
            reservationDeleteButton = null;

            literal = new LiteralControl();
            literal.Text = " ";
            cmdline.Controls.Add(literal);

            Button reservationMergeButton = new Button();
            reservationMergeButton.ID = "reservation_mergebutton";
            reservationMergeButton.Text = "ºÏ²¢";
            reservationMergeButton.Click -= new EventHandler(reservationMergeButton_Click);
            reservationMergeButton.Click += new EventHandler(reservationMergeButton_Click);
            cmdline.Controls.Add(reservationMergeButton);
            reservationMergeButton = null;

            literal = new LiteralControl();
            literal.Text = " ";
            cmdline.Controls.Add(literal);

            Button reservationSplitButton = new Button();
            reservationSplitButton.ID = "reservation_splitbutton";
            reservationSplitButton.Text = "²ðÉ¢";
            reservationSplitButton.Click -= new EventHandler(reservationSplitButton_Click);
            reservationSplitButton.Click += new EventHandler(reservationSplitButton_Click);
            cmdline.Controls.Add(reservationSplitButton);
            reservationSplitButton = null;

            literal = new LiteralControl();
            literal.Text = "
";
            cmdline.Controls.Add(literal);

            cmdline = null;

            // µ÷ÊÔÐÅÏ¢ÐÐ
            PlaceHolder debugline = new PlaceHolder();
            debugline.ID = "reservation_debugline";
            reservation.Controls.Add(debugline);

            literal = new LiteralControl();
            literal.Text = "
";
            debugline.Controls.Add(literal);

            literal = new LiteralControl();
            literal.ID = "reservation_debugtext";
            literal.Text = "";
            debugline.Controls.Add(literal);

            literal = new LiteralControl();
            literal.Text = "
";
            debugline.Controls.Add(literal);

            debugline = null;

            // ±í¸ñ½áβ
            literal = new LiteralControl();
            literal.ID = "reservation_tableend";
            literal.Text = "
";
            reservation.Controls.Add(literal);

            literal = new LiteralControl();
            literal.Text = GetRoundTableEnd();
            parent.Controls.Add(literal);
        }

        void reservationExpandButton_Click(object sender, EventArgs e)
        {
            // off¹ÜϽÄÚµÄcheckbox
            OffCheckBoxes("reservation");

            ExpandContent("reservation");
        }

        void OffCheckBoxes(string strID)
        {

            for (int i = 0; ; i++)
            {
                CheckBox checkbox = (CheckBox)this.FindControl(strID + "_line" + Convert.ToString(i) + "checkbox");
                if (checkbox == null)
                    break;
                if (checkbox.Checked == true)
                    checkbox.Checked = false;
            }
        }

        string GetChekcedReservationBarcodes()
        {
            string strBarcodeList = "";

            PlaceHolder reservation = (PlaceHolder)this.FindControl("reservation");

            for (int i = 0; i < this.ReservationLineCount; i++)
            {
                CheckBox checkbox = (CheckBox)reservation.FindControl("reservation_line" + Convert.ToString(i) + "checkbox");
                if (checkbox.Checked == true)
                {
                    if (this.ReservationBarcodes.Count <= i)
                    {
                        //this.SetReservationDebugInfo("ReservationBarcodesʧЧ...");
                        //return null;
                        throw new Exception("ReservationBarcodesʧЧ...");
                    }
                    string strBarcode = this.ReservationBarcodes[i];

                    if (strBarcodeList != "")
                        strBarcodeList += ",";
                    strBarcodeList += strBarcode;
                    checkbox.Checked = false;
                }
            }

            return strBarcodeList;
        }

        List<string> GetCheckedBorrowBarcodes()
        {
            List<string> barcodes = new List<string>();

            for (int i = 0; i < this.BorrowLineCount; i++)
            {
                CheckBox checkbox = (CheckBox)this.FindControl("borrowinfo_line" + Convert.ToString(i) + "checkbox");
                if (checkbox.Checked == true)
                {
                    if (this.BorrowBarcodes.Count <= i)
                    {
                        throw new Exception("BorrowBarcodesʧЧ...");
                    }
                    string strBarcode = this.BorrowBarcodes[i];

                    barcodes.Add(strBarcode);

                    checkbox.Checked = false;
                }
            }

            return barcodes;
        }

        // Ô¤Ô¼£º²ðÉ¢ÇëÇó
        void reservationSplitButton_Click(object sender, EventArgs e)
        {
            string strBarcodeList = GetChekcedReservationBarcodes();

            if (String.IsNullOrEmpty(strBarcodeList) == true)
            {
                SetReservationDebugInfo("ÉÐδѡÔñÒª²ðÉ¢µÄÔ¤Ô¼ÊÂÏî¡£");
                return;
            }

            LibraryApplication app = (LibraryApplication)this.Page.Application["app"];
            SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            string strReaderBarcode = "";
            if (String.IsNullOrEmpty(this.Barcode) == false)
                strReaderBarcode = this.Barcode;
            else
                strReaderBarcode = sessioninfo.Account.Barcode;

            if (String.IsNullOrEmpty(strReaderBarcode) == true)
            {
                SetBorrowDebugInfo("ÉÐδָ¶¨¶ÁÕßÖ¤ÌõÂëºÅ¡£²Ù×÷ʧ°Ü¡£");
                return;
            }

            LibraryServerResult result = app.Reservation(sessioninfo,
                "split",
                strReaderBarcode,
                strBarcodeList);
            if (result.Value == -1)
                SetReservationDebugInfo(result.ErrorInfo);
            else
                SetReservationDebugInfo("²ðÉ¢Ô¤Ô¼ÐÅÏ¢³É¹¦¡£Çë¿´Ô¤Ô¼ÁÐ±í¡£");
        }

        // Ô¤Ô¼£ººÏ²¢ÇëÇó
        void reservationMergeButton_Click(object sender, EventArgs e)
        {
            string strBarcodeList = GetChekcedReservationBarcodes();

            if (String.IsNullOrEmpty(strBarcodeList) == true)
            {
                SetReservationDebugInfo("ÉÐδѡÔñÒªºÏ²¢µÄÔ¤Ô¼ÊÂÏî¡£");
                return;
            }

            LibraryApplication app = (LibraryApplication)this.Page.Application["app"];
            SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            string strReaderBarcode = "";
            if (String.IsNullOrEmpty(this.Barcode) == false)
                strReaderBarcode = this.Barcode;
            else
                strReaderBarcode = sessioninfo.Account.Barcode;

            if (String.IsNullOrEmpty(strReaderBarcode) == true)
            {
                SetBorrowDebugInfo("ÉÐδָ¶¨¶ÁÕßÖ¤ÌõÂëºÅ¡£²Ù×÷ʧ°Ü¡£");
                return;
            }

            LibraryServerResult result = app.Reservation(sessioninfo,
                "merge",
                strReaderBarcode,
                strBarcodeList);
            if (result.Value == -1)
                SetReservationDebugInfo(result.ErrorInfo);
            else
                SetReservationDebugInfo("ºÏ²¢Ô¤Ô¼ÐÅÏ¢³É¹¦¡£Çë¿´Ô¤Ô¼ÁÐ±í¡£");

        }

        // Ô¤Ô¼£ºÉ¾³ýÇëÇó
        void reservationDeleteButton_Click(object sender, EventArgs e)
        {
            string strBarcodeList = GetChekcedReservationBarcodes();

            if (String.IsNullOrEmpty(strBarcodeList) == true)
            {
                SetReservationDebugInfo("ÉÐδѡÔñҪɾ³ýµÄÔ¤Ô¼ÊÂÏî¡£");
                return;
            }

            LibraryApplication app = (LibraryApplication)this.Page.Application["app"];
            SessionInfo sessioninfo = (SessionInfo)this.Page.Session["sessioninfo"];

            string strReaderBarcode = "";
            if (String.IsNullOrEmpty(this.Barcode) == false)
                strReaderBarcode = this.Barcode;
            else
                strReaderBarcode = sessioninfo.Account.Barcode;

            if (String.IsNullOrEmpty(strReaderBarcode) == true)
            {
                SetBorrowDebugInfo("ÉÐδָ¶¨¶ÁÕßÖ¤ÌõÂëºÅ¡£²Ù×÷ʧ°Ü¡£");
                return;
            }

            LibraryServerResult result = app.Reservation(sessioninfo,
                "delete",
                strReaderBarcode,
                strBarcodeList);
            if (result.Value == -1)
                SetReservationDebugInfo(result.ErrorInfo);
            else
                SetReservationDebugInfo("ɾ³ýÔ¤Ô¼ÐÅÏ¢³É¹¦¡£Çë¿´Ô¤Ô¼ÁÐ±í¡£");

            // Button button = (Button)FindControl("reservation_deletebutton");
        }

        PlaceHolder NewOverdueLine(Control parent,
            int index,
            Control insertbefore)
        {
            if (parent != null && insertbefore != null)
            {
                if (insertbefore.Parent != parent)
                    throw new Exception("²åÈë²Î¿¼Î»Öú͸¸ControlÖ®¼ä, ¸¸×Ó¹Øϵ²»ÕýÈ·");
            }

            PlaceHolder line = new PlaceHolder();
            line.ID = "overdueinfo_line" + Convert.ToString(index);

            if (FindControl(line.ID) != null)
                throw new Exception("id='" + line.ID + "' already existed");

            if (insertbefore == null)
                parent.Controls.Add(line);
            else
            {
                int pos = parent.Controls.IndexOf(insertbefore);
                if (pos == -1)
                    throw new Exception("²åÈë²ÎÕÕ¶ÔÏóûÓÐÕÒµ½");
                parent.Controls.AddAt(pos, line);
            }

            // ×ó²àÎÄ×Ö
            LiteralControl literal = new LiteralControl();
            literal.ID = "overdueinfo_line" + Convert.ToString(index) + "left";
            literal.Text = "

";
            line.Controls.Add(literal);

            /*
            // checkbox
            CheckBox checkbox = new CheckBox();
            checkbox.ID = "overdueinfo_line" + Convert.ToString(index) + "checkbox";
            line.Controls.Add(checkbox);

            // ÓÒ²àÎÄ×Ö
            literal = new LiteralControl();
            literal.ID = "overdueinfo_line" + Convert.ToString(index) + "right";
            literal.Text = "
";
            line.Controls.Add(literal);
             */

            return line;
        }

        PlaceHolder NewBorrowLine(Control parent,
            int index,
            Control insertbefore)
        {
            if (parent != null && insertbefore != null)
            {
                if (insertbefore.Parent != parent)
                    throw new Exception("²åÈë²Î¿¼Î»Öú͸¸ControlÖ®¼ä, ¸¸×Ó¹Øϵ²»ÕýÈ·");
            }

            PlaceHolder line = new PlaceHolder();
            line.ID = "borrowinfo_line" + Convert.ToString(index);

            if (FindControl(line.ID) != null)
                throw new Exception("id='" + line.ID + "' already existed");

            if (insertbefore == null)
                parent.Controls.Add(line);
            else
            {
                int pos = parent.Controls.IndexOf(insertbefore);
                if (pos == -1)
                    throw new Exception("²åÈë²ÎÕÕ¶ÔÏóûÓÐÕÒµ½");
                parent.Controls.AddAt(pos, line);
            }

            // ×ó²àÎÄ×Ö
            LiteralControl literal = new LiteralControl();
            literal.ID = "borrowinfo_line" + Convert.ToString(index) + "left";
            literal.Text = "
";
            line.Controls.Add(literal);

            // checkbox
            CheckBox checkbox = new CheckBox();
            checkbox.ID = "borrowinfo_line" + Convert.ToString(index) + "checkbox";
            line.Controls.Add(checkbox);

            // ÓÒ²àÎÄ×Ö
            literal = new LiteralControl();
            literal.ID = "borrowinfo_line" + Convert.ToString(index) + "right";
            literal.Text = "
";
            line.Controls.Add(literal);

            return line;
        }

        PlaceHolder NewReservationLine(Control parent,
    int index,
    Control insertbefore)
        {
            PlaceHolder line = new PlaceHolder();
            line.ID = "reservation_line" + Convert.ToString(index);

            if (FindControl(line.ID) != null)
                throw new Exception("id='" + line.ID + "' already existed");

            if (insertbefore == null)
                parent.Controls.Add(line);
            else
            {
                int pos = parent.Controls.IndexOf(insertbefore);
                parent.Controls.AddAt(pos, line);
            }

            // ×ó²àÎÄ×Ö
            LiteralControl literal = new LiteralControl();
            literal.ID = "reservation_line" + Convert.ToString(index) + "left";
            literal.Text = "
";
            line.Controls.Add(literal);

            // checkbox
            CheckBox checkbox = new CheckBox();
            checkbox.ID = "reservation_line" + Convert.ToString(index) + "checkbox";
            line.Controls.Add(checkbox);

            // ÓÒ²àÎÄ×Ö
            literal = new LiteralControl();
            literal.ID = "reservation_line" + Convert.ToString(index) + "right";
            literal.Text = "
";
            line.Controls.Add(literal);

            return line;
        }

        void SetReservationDebugInfo(string strText)
        {
            PlaceHolder reservation = (PlaceHolder)this.FindControl("reservation");

            PlaceHolder line = (PlaceHolder)reservation.FindControl("reservation_debugline");
            LiteralControl text = (LiteralControl)line.FindControl("reservation_debugtext");

            text.Text = strText;
        }

        void RenderIdentity(XmlDocument dom)
        {
            // ʶ±ðÐÅÏ¢
            PlaceHolder identity = (PlaceHolder)this.FindControl("identity");

            LiteralControl literal = (LiteralControl)identity.FindControl("identity_name");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "name");

            literal = (LiteralControl)identity.FindControl("identity_barcode");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "barcode");

            literal = (LiteralControl)identity.FindControl("identity_state");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "state");

            literal = (LiteralControl)identity.FindControl("identity_readertype");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "readerType");

            literal = (LiteralControl)identity.FindControl("identity_createdate");
            literal.Text = ItemConverter.LocalDate(DomUtil.GetElementText(dom.DocumentElement, "createDate"));

            literal = (LiteralControl)identity.FindControl("identity_expiredate");
            literal.Text = ItemConverter.LocalDate(DomUtil.GetElementText(dom.DocumentElement, "expireDate"));
        }

        void RenderGeneralInfo(XmlDocument dom)
        {
            // Ò»°ãÐÅÏ¢
            PlaceHolder generalinfo = (PlaceHolder)this.FindControl("generalinfo");

            LiteralControl literal = (LiteralControl)generalinfo.FindControl("generalinfo_gender");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "gender");

            literal = (LiteralControl)generalinfo.FindControl("generalinfo_birthday");
            literal.Text = ItemConverter.LocalDate(DomUtil.GetElementText(dom.DocumentElement, "birthday"));

            literal = (LiteralControl)generalinfo.FindControl("generalinfo_idcardnumber");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "idCardNumber");

            literal = (LiteralControl)generalinfo.FindControl("generalinfo_department");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "department");

            literal = (LiteralControl)generalinfo.FindControl("generalinfo_address");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "address");

            literal = (LiteralControl)generalinfo.FindControl("generalinfo_tel");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "tel");

            literal = (LiteralControl)generalinfo.FindControl("generalinfo_email");
            literal.Text = DomUtil.GetElementText(dom.DocumentElement, "email");

        }

        void RenderOverdue(
            LibraryApplication app,
            SessionInfo sessioninfo,
            XmlDocument dom)
        {

            PlaceHolder overdueinfo = (PlaceHolder)this.FindControl("overdueinfo");

            XmlNodeList nodes = dom.DocumentElement.SelectNodes("overdues/overdue");
            for (int i = 0; i < nodes.Count; i++)
            {
                PlaceHolder line = (PlaceHolder)overdueinfo.FindControl("overdueinfo_line" + Convert.ToString(i));
                if (line == null)
                {
                    Control insertpos = overdueinfo.FindControl("overdueinfo_insertpos");
                    line = NewOverdueLine(insertpos.Parent, i, insertpos);
                }
                line.Visible = true;

                LiteralControl left = (LiteralControl)line.FindControl("overdueinfo_line" + Convert.ToString(i) + "left");

                XmlNode node = nodes[i];

                string strBarcode = DomUtil.GetAttr(node, "barcode");
                string strItemRecPath = DomUtil.GetAttr(node, "recPath");

                string strReason = DomUtil.GetAttr(node, "reason");
                string strBorrowDate = DomUtil.GetAttr(node, "borrowDate");
                string strPeriod = DomUtil.GetAttr(node, "borrowPeriod");
                string strReturnDate = DomUtil.GetAttr(node, "returnDate");

                string strClass = " class='roundcontentdark' ";

                if ((i % 2) == 1)
                    strClass = " class='roundcontentlight' ";

                string strResult = "
";

                strResult += " ";

                strResult += ""
                    + strBarcode + "	";

                // »ñµÃÕªÒª
                string strSummary = "";
                string strBiblioRecPath = "";
                LibraryServerResult result = app.GetBiblioSummary(
                    sessioninfo,
                    strBarcode,
                    strItemRecPath,
                    null,
                    out strBiblioRecPath,
                    out strSummary);
                if (result.Value == -1 || result.Value == 0)
                    strSummary = result.ErrorInfo;

                strResult += "" + strSummary + "	";
                strResult += "" + strReason + "	";
                strResult += "" + ItemConverter.LocalTime(strBorrowDate) + "	";
                strResult += "" + strPeriod + "	";
                strResult += "" + strReturnDate + "	";
                strResult += "
";

                left.Text = strResult;
            }

            // °Ñ¶àÓàµÄÐÐÒþ²ØÆðÀ´
            for (int i = nodes.Count; ; i++)
            {

                PlaceHolder line = (PlaceHolder)overdueinfo.FindControl("overdueinfo_line" + Convert.ToString(i));
                if (line == null)
                    break;

                line.Visible = false;
            }

        }

        void RenderBorrow(
            LibraryApplication app,
            SessionInfo sessioninfo,
            XmlDocument dom)
        {
            string strReaderType = DomUtil.GetElementText(dom.DocumentElement,
                "readerType");

            // »ñµÃÈÕÀú
            string strError = "";
            Calendar calendar = null;
            int nRet = app.GetReaderCalendar(strReaderType, out calendar, out strError);
            if (nRet == -1)
            {
                this.SetBorrowDebugInfo(strError);
                calendar = null;
            }

            // ½èÔĵIJá
            PlaceHolder borrowinfo = (PlaceHolder)this.FindControl("borrowinfo");

            // Çå¿Õ¼¯ºÏ
            this.BorrowBarcodes = new List<string>();

            string strReaderBarcode = DomUtil.GetElementText(dom.DocumentElement,
                "barcode");

            XmlNodeList nodes = dom.DocumentElement.SelectNodes("borrows/borrow");
            this.BorrowLineCount = nodes.Count;
            for (int i = 0; i < nodes.Count; i++)
            {

                PlaceHolder line = (PlaceHolder)borrowinfo.FindControl("borrowinfo_line" + Convert.ToString(i));
                if (line == null)
                {
                    Control insertpos = borrowinfo.FindControl("borrowinfo_insertpos");
                    line = NewBorrowLine(insertpos.Parent, i, insertpos);
                    // this.BorrowLineCount++;
                }
                line.Visible = true;

                LiteralControl left = (LiteralControl)line.FindControl("borrowinfo_line" + Convert.ToString(i) + "left");
                CheckBox checkbox = (CheckBox)line.FindControl("borrowinfo_line" + Convert.ToString(i) + "checkbox");
                LiteralControl right = (LiteralControl)line.FindControl("borrowinfo_line" + Convert.ToString(i) + "right");

                XmlNode node = nodes[i];

                string strBarcode = DomUtil.GetAttr(node, "barcode");

                // Ìí¼Óµ½¼¯ºÏ
                this.BorrowBarcodes.Add(strBarcode);

                string strNo = DomUtil.GetAttr(node, "no");
                string strBorrowDate = DomUtil.GetAttr(node, "borrowDate");
                string strPeriod = DomUtil.GetAttr(node, "borrowPeriod");
                string strOperator = DomUtil.GetAttr(node, "operator");
                string strRenewComment = DomUtil.GetAttr(node, "renewComment");

                string strColor = "bgcolor=#ffffff";

                string strOverDue = "";

                // string strError = "";
                // ¼ì²é³¬ÆÚÇé¿ö¡£
                // return:
                //      -1  Êý¾Ý¸ñʽ´íÎó
                //      0   ûÓз¢ÏÖ³¬ÆÚ
                //      1   ·¢ÏÖ³¬ÆÚ   strErrorÖÐÓÐÌáʾÐÅÏ¢
                //      2   ÒѾÔÚ¿íÏÞÆÚÄÚ£¬ºÜÈÝÒ׳¬ÆÚ 2009/3/13
                nRet = app.CheckPeriod(
                    calendar,
                    strBorrowDate,
                    strPeriod,
                    out strError);
                if (nRet == -1)
                    strOverDue = strError;
                else
                {
                   strOverDue = strError;	// ÆäËûÎÞÂÛʲôÇé¿ö¶¼ÏÔʾ³öÀ´
                }

                string strResult = "";

                string strClass = " class='roundcontentdark' ";

                if ((i % 2) == 1)
                    strClass = " class='roundcontentlight' ";

                strResult += "
";
                // ×ó
                left.Text = strResult;

                // checkbox
                // checkbox.Text = Convert.ToString(i + 1);

                // ÓÒ¿ªÊ¼
                strResult = " ";

                strResult += ""
                    + strBarcode + "	";

                // »ñµÃÕªÒª
                string strSummary = "";
                string strBiblioRecPath = "";
                LibraryServerResult result = app.GetBiblioSummary(
                    sessioninfo,
                    strBarcode,
                    null,
                    null,
                    out strBiblioRecPath,
                    out strSummary);
                if (result.Value == -1 || result.Value == 0)
                    strSummary = result.ErrorInfo;

                strResult += "" + strSummary + "	";
                strResult += "" + strNo + "	";
                strResult += "" + ItemConverter.LocalTime(strBorrowDate) + "	";
                strResult += "" + strPeriod + "	";
                strResult += "" + strOperator + "	";
                strResult += "" + strOverDue + "	";
                strResult += "" + strRenewComment.Replace(";", "
") +

    "	";
                strResult += "
";

                right.Text = strResult;

            }

            // °Ñ¶àÓàµÄÐÐÒþ²ØÆðÀ´
            for (int i = nodes.Count; ; i++)
            {

                PlaceHolder line = (PlaceHolder)borrowinfo.FindControl("borrowinfo_line" + Convert.ToString(i));
                if (line == null)
                    break;

                line.Visible = false;
            }

        }

        void RenderReservation(LibraryApplication app,
            SessionInfo sessioninfo,
            XmlDocument dom)
        {
            // Ô¤Ô¼ÇëÇó
            PlaceHolder reservation = (PlaceHolder)this.FindControl("reservation");
            this.ReservationBarcodes = new List<string>();

            XmlNodeList nodes = dom.DocumentElement.SelectNodes("reservations/request");
            this.ReservationLineCount = nodes.Count;
            for (int i = 0; i < nodes.Count; i++)
            {
                PlaceHolder line = (PlaceHolder)reservation.FindControl("reservation_line" + Convert.ToString(i));
                if (line == null)
                {
                    Control insertpos = reservation.FindControl("reservation_insertpos");
                    line = NewReservationLine(insertpos.Parent, i, insertpos);
                    //this.ReservationLineCount++;
                }
                line.Visible = true;

                LiteralControl left = (LiteralControl)line.FindControl("reservation_line" + Convert.ToString(i) + "left");
                CheckBox checkbox = (CheckBox)line.FindControl("reservation_line" + Convert.ToString(i) + "checkbox");
                LiteralControl right = (LiteralControl)line.FindControl("reservation_line" + Convert.ToString(i) + "right");

                XmlNode node = nodes[i];
                string strBarcodes = DomUtil.GetAttr(node, "items");

                this.ReservationBarcodes.Add(strBarcodes);

                string strRequestDate = ItemConverter.LocalTime(DomUtil.GetAttr(node, "requestDate"));

                string strResult = "";

                string strClass = " class='roundcontentdark' ";

                if ((i % 2) == 1)
                    strClass = " class='roundcontentlight' ";

                strResult += "
";

                // ×ó
                left.Text = strResult;

                // ÓÒ¿ªÊ¼
                strResult = " ";

                //strResult += "" + strBarcodes + "	";

                strResult += "" + MakeBarcodeListHyperLink(strBarcodes, ",") + "	";

                // ²Ù×÷Õß
                string strOperator = DomUtil.GetAttr(node, "operator");
                // ״̬
                string strArrivedDate = DomUtil.GetAttr(node, "arrivedDate");
                string strState = DomUtil.GetAttr(node, "state");
                // 2007/1/18
                string strArrivedItemBarcode = DomUtil.GetAttr(node, "arrivedItemBarcode");
                if (strState == "arrived")
                {
                    strArrivedDate = ItemConverter.LocalTime(strArrivedDate);
                    strState = "²á "+strArrivedItemBarcode+" ÒÑÓÚ " + strArrivedDate + " µ½Êé";
                }
                strResult += "" + strState + "	";

                string strSummary = app.GetBarcodesSummary(
                    sessioninfo,
                    strBarcodes,
                    "html",
                    "");

                /*
                string strSummary = "";

                string strPrevBiblioRecPath = "";
                string[] barcodes = strBarcodes.Split(new char[] {','});
                for (int j = 0; j < barcodes.Length; j++)
                {
                    string strBarcode = barcodes[j];
                    if (String.IsNullOrEmpty(strBarcode) == true)
                        continue;

                    // »ñµÃÕªÒª
                    string strOneSummary = "";
                    string strBiblioRecPath = "";

                    Result result = app.GetBiblioSummary(sessioninfo,
        strBarcode,
        strPrevBiblioRecPath,   // Ç°Ò»¸öpath
        out strBiblioRecPath,
        out strOneSummary);
                    if (result.Value == -1 || result.Value == 0)
                        strOneSummary = result.ErrorInfo;

                    if (strOneSummary == ""
                        && strPrevBiblioRecPath == strBiblioRecPath)
                        strOneSummary = "(ͬÉÏ)";

                    strSummary += strBarcode + " : " + strOneSummary + "
";

                    strPrevBiblioRecPath = strBiblioRecPath;
                }
                 */

                strResult += "" + strSummary + "	";
                strResult += "" + strRequestDate + "	";
                strResult += "" + strOperator + "	";
                strResult += "
";

                right.Text = strResult;

            }

            // °Ñ¶àÓàµÄÐÐÒþ²ØÆðÀ´
            for (int i = nodes.Count; ; i++)
            {
                PlaceHolder line = (PlaceHolder)reservation.FindControl("reservation_line" + Convert.ToString(i));
                if (line == null)
                    break;

                line.Visible = false;
            }
        }

        protected override void Render(HtmlTextWriter output)
        {
            string strError = "";
            LibraryApplication app = (LibraryApplication)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;
            }

            if (sessioninfo.Account == null)
            {
                // output.Write("ÉÐδµÇ¼");
                sessioninfo.LoginCallStack.Push(this.Page.Request.RawUrl);
                this.Page.Response.Redirect("login.aspx", true);
                return;
            }

            string strBarcode = "";
            if (this.Barcode == "")
                strBarcode = sessioninfo.Account.Barcode;
            else
                strBarcode = this.Barcode;

            if (strBarcode == "")
            {
                strError = "¶ÁÕßÖ¤ÌõÂëºÅΪ¿Õ£¬ÎÞ·¨¶¨Î»¶ÁÕ߼Ǽ¡£";
                goto ERROR1;
            }

            string strXml = "";
            string strOutputPath = "";
            // »ñµÃ¶ÁÕ߼Ǽ
            int nRet = app.GetReaderRecXml(
                sessioninfo.Channels,
                strBarcode,
                out strXml,
                out strOutputPath,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            if (nRet == 0)
                goto ERROR1;

            XmlDocument dom = new XmlDocument();

            try
            {
                dom.LoadXml(strXml);
            }
            catch (Exception ex)
            {
                strError = "×°ÔضÁÕßXML¼Ç¼½øÈëDOMʱ³ö´í: " + ex.Message;
                goto ERROR1;
            }

            // ¶ÒÏÖʶ±ðÐÅÏ¢
            RenderIdentity(dom);

            // ¶ÒÏÖÒ»°ãÐÅÏ¢
            RenderGeneralInfo(dom);

            // ¶ÒÏÖ Î¥Ô¼ÐÅÏ¢
            RenderOverdue(app,
                sessioninfo,
                dom);

            // ¶ÒÏÖ ½èÔÄÐÅÏ¢
            RenderBorrow(app,
                sessioninfo,
                dom);

            // ¶ÒÏÖ Ô¤Ô¼ÇëÇó
            RenderReservation(app,
                sessioninfo,
                dom);

            base.Render(output);
            return;

        ERROR1:
            output.Write(strError);
        }

        static string MakeBarcodeListHyperLink(string strBarcodes,
            string strSep)
        {
            string strResult = "";
            string[] barcodes = strBarcodes.Split(new char[] { ',' });
            for (int i = 0; i < barcodes.Length; i++)
            {
                string strBarcode = barcodes[i];
                if (String.IsNullOrEmpty(strBarcode) == true)
                    continue;

                if (strResult != "")
                    strResult += strSep;
                strResult += ""
                    + strBarcode + "";
            }

            return strResult;
        }

        /*
        protected override void RenderContents(HtmlTextWriter output)
        {
            // output.Write(Text);

            string strError = "";
            string strResult = "";
            int nRet = GetReaderHtml(
                this.App,
                this.SessionInfo,
                this.Barcode,
                out strResult,
                out strError);
            if (nRet == -1 || nRet == 0)
            {
                output.Write(strError);
                return;
            }

            output.Write(strResult);
        }

        static int GetReaderHtml(
            CirculationApplication app,
            SessionInfo sessioninfo,
            string strBarcode,
            out string strResult,
            out string strError)
        {
            strResult = "";
            strError = "";

            string strXml = "";
            string strOutputPath = "";

            int nRet = app.GetReaderXml(
                sessioninfo,
                strBarcode,
                out strXml,
                out strOutputPath,
                out strError);
            if (nRet == 0)
            {
                strError = "ÌõÂëΪ '"+strBarcode+"' µÄ¶ÁÕ߼ǼûÓÐÕÒµ½";
                return 0;
            }
            if (nRet == -1)
                goto ERROR1;

            // ½«¶ÁÕ߼ǼÊý¾Ý´ÓXML¸ñʽת»»ÎªHTML¸ñʽ
            nRet = app.ConvertReaderXmlToHtml(
                app.CfgDir + "\\readeropac.cs",
                app.CfgDir + "\\readeropac.cs.ref",
                strXml,
                OperType.None,
                null,
                "",
                out strResult,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            return 1;
        ERROR1:
            return -1;
        }
         */

        public override void RenderBeginTag(HtmlTextWriter writer)
        {

        }
        public override void RenderEndTag(HtmlTextWriter writer)
        {

        }
    }
#endif
}


text:
/**
 * generated by Xtext 2.9.1
 */
package org.xtuml.bp.ui.xtext.myDsl.impl;

import java.util.Collection;

import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.common.util.EList;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;

import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;

import org.xtuml.bp.ui.xtext.myDsl.MyDslPackage;
import org.xtuml.bp.ui.xtext.myDsl.equality;
import org.xtuml.bp.ui.xtext.myDsl.logicalAnd;

/**
 *
 * An implementation of the model object 'logical And'.
 *
 *

 * The following features are implemented:
 *

 *

 *
{@link org.xtuml.bp.ui.xtext.myDsl.impl.logicalAndImpl#getE E}

 *

 *
 * @generated
 */
public class logicalAndImpl extends MinimalEObjectImpl.Container implements logicalAnd
{
  /**
   * The cached value of the '{@link #getE() E}' containment reference list.
   *
   *
   * @see #getE()
   * @generated
   * @ordered
   */
  protected EList<equality> e;

  /**
   *
   *
   * @generated
   */
  protected logicalAndImpl()
  {
    super();
  }

  /**
   *
   *
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.LOGICAL_AND;
  }

  /**
   *
   *
   * @generated
   */
  public EList<equality> getE()
  {
    if (e == null)
    {
      e = new EObjectContainmentEList<equality>(equality.class, this, MyDslPackage.LOGICAL_AND__E);
    }
    return e;
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.LOGICAL_AND__E:
        return ((InternalEList<?>)getE()).basicRemove(otherEnd, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.LOGICAL_AND__E:
        return getE();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   *
   *
   * @generated
   */
  @SuppressWarnings("unchecked")
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.LOGICAL_AND__E:
        getE().clear();
        getE().addAll((Collection<? extends equality>)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.LOGICAL_AND__E:
        getE().clear();
        return;
    }
    super.eUnset(featureID);
  }

  /**
   *
   *
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.LOGICAL_AND__E:
        return e != null && !e.isEmpty();
    }
    return super.eIsSet(featureID);
  }

} //logicalAndImpl

redpajama_set_name: RedPajamaGithub


text:
from __future__ import division, print_function, unicode_literals

from django.conf.urls import url, include
from django.contrib import admin
from rest_framework import routers
from api import viewsets

router = routers.SimpleRouter()
router.register('articles', viewsets.ArticleViewSet, base_name='article')

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^grappelli/', include('grappelli.urls')),
    url(r'^docs/', include('rest_framework_swagger.urls')),
    url(r'^api/', include(router.urls, namespace='api', app_name='api')),
    url(r'', include('web.urls', namespace='web', app_name='web')),
]


text:
"""Tokens for Doxygen-like tokens.
"""

import re

# Regular expressions used in LEXER_TOKENS.
IDENTIFIER = r'[_a-zA-Z][_a-zA-Z0-9]*'
HTML_ATTRIBUTE = IDENTIFIER + r'="[^"]*"'
HTML_TAG = r'<(?:/)?\s*' + IDENTIFIER + '(?:\s+' + HTML_ATTRIBUTE + ')*\s*(?:/)?>'

LITERALS = r'.,;<>+-/*="!:'

def escapeLiterals(s):
    """Escape string of literals s."""
    return r'\|'.join([re.escape(x) for x in s])

# Shortcuts to token sets.
WHITESPACE = set(['SPACE', 'EMPTYLINE', 'BREAK'])
ITEM_STARTING = set(['COMMAND_CLASS', 'COMMAND_CONCEPT', 'COMMAND_FUNCTION', 'COMMAND_MACRO',
                     'COMMAND_METAFUNCTION', 'COMMAND_PAGE', 'COMMAND_MAINPAGE', 'COMMAND_DEFGROUP',
                     'COMMAND_VARIABLE', 'COMMAND_TAG', 'COMMAND_ENUM', 'COMMAND_TYPEDEF', 'COMMAND_ADAPTION'])
CLAUSE_STARTING = set(['COMMAND_SIGNATURE', 'COMMAND_CODE', 'COMMAND_SEE', 'COMMAND_BRIEF',
                       'COMMAND_RETURN', 'COMMAND_PARAM', 'COMMAND_TPARAM',
                       'COMMAND_SECTION', 'COMMAND_SUBSECTION', 'COMMAND_INCLUDE',
                       'COMMAND_EXTENDS', 'COMMAND_IMPLEMENTS', 'COMMAND_SNIPPET',
                       'COMMAND_HEADERFILE', 'COMMAND_DEPRECATED'])
NON_PARAGRAPH = set(['COMMAND_ENDCODE'])
LINE_BREAKS = set(['BREAK', 'EMPTYLINE'])

# The lexer tokens.
LEXER_TOKENS = (
    # Lexer tokens for commands starting new documentation items.
    ('COMMAND_CLASS',        r'@class'),
    ('COMMAND_CONCEPT',      r'@concept'),
    ('COMMAND_FUNCTION',     r'@fn'),
    ('COMMAND_MACRO',        r'@macro'),
    ('COMMAND_METAFUNCTION', r'@mfn'),
    ('COMMAND_VARIABLE',     r'@var'),
    ('COMMAND_TAG',          r'@tag'),
    ('COMMAND_ENUM',         r'@enum'),
    ('COMMAND_PAGE',         r'@page'),
    ('COMMAND_MAINPAGE',     r'@mainpage'),
    ('COMMAND_DEFGROUP',     r'@defgroup'),
    ('COMMAND_TYPEDEF',      r'@typedef'),
    ('COMMAND_ADAPTION',     r'@adaption'),

    # Lexer tokens for commands starting different modes.
    ('COMMAND_SIGNATURE',    r'@signature'),
    ('COMMAND_CODE',         r'@code'),
    ('COMMAND_ENDCODE',      r'@endcode'),

    # Lexer tokens for commands starting clauses.
    ('COMMAND_HEADERFILE',   r'@headerfile'),
    ('COMMAND_EXTENDS',      r'@extends'),
    ('COMMAND_IMPLEMENTS',   r'@implements'),
    ('COMMAND_BRIEF',        r'@brief'),
    ('COMMAND_SEE',          r'@see'),
    ('COMMAND_RETURN',       r'@return'),
    ('COMMAND_PARAM',        r'@param'),
    ('COMMAND_TPARAM',       r'@tparam'),
    ('COMMAND_SECTION',      r'@section'),
    ('COMMAND_SUBSECTION',   r'@subsection'),
    ('COMMAND_INCLUDE',      r'@include'),
    ('COMMAND_SNIPPET',      r'@snippet'),
    ('COMMAND_DEPRECATED',   r'@deprecated'),
    # TODO(holtgrew): Add @note and @warning

    # Lexer tokens for commands for inline use.
    ('COMMAND_LINK',         r'@link'),
    ('COMMAND_ENDLINK',      r'@endlink'),

    # Space.
    ('SPACE',                r'[ \t]+'),
    ('EMPTYLINE',            r'\n\s*\n\s*'),
    ('BREAK',                r'\n'),

    # In/out tokens for the @param clause.
    ('PARAM_IN_OUT',         r'\[in\]|\[out\]|\[in,out\]'),

    # Lexing words, identifiers etc.
    ('IDENTIFIER',           IDENTIFIER),
    ('NUMBER',               r'[0-9]+'),
    ('WORD',                 r'\w+'),
    ('HTML_TAG',             HTML_TAG),
    ('PUNCTUATION',          r'\S'),

    # Lexing punctuation.
    ('HASH',                 r'\#'),
    ('NS_SEP',               r'::'),

    # Literals.
    ('LITERAL',              escapeLiterals(LITERALS)),
    )

# Translation of token name to tag name.
LEXER_TOKENS_DICT = dict(LEXER_TOKENS)

def transToken(name):
    """Translate the token name to the token pattern."""
    return LEXER_TOKENS_DICT[name]


text:
.class final Lcom/android/server/display/DisplayManagerService$DisplayAdapterListener;
.super Ljava/lang/Object;
.source "DisplayManagerService.java"

# interfaces
.implements Lcom/android/server/display/DisplayAdapter$Listener;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/android/server/display/DisplayManagerService;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x12
    name = "DisplayAdapterListener"
.end annotation

# instance fields
.field final synthetic this$0:Lcom/android/server/display/DisplayManagerService;

# direct methods
.method private constructor <init>(Lcom/android/server/display/DisplayManagerService;)V
    .locals 0
    .parameter

    .prologue
    .line 1015
    iput-object p1, p0, Lcom/android/server/display/DisplayManagerService$DisplayAdapterListener;->this$0:Lcom/android/server/display/DisplayManagerService;

    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method synthetic constructor <init>(Lcom/android/server/display/DisplayManagerService;Lcom/android/server/display/DisplayManagerService$1;)V
    .locals 0
    .parameter "x0"
    .parameter "x1"

    .prologue
    .line 1015
    invoke-direct {p0, p1}, Lcom/android/server/display/DisplayManagerService$DisplayAdapterListener;-><init>(Lcom/android/server/display/DisplayManagerService;)V

    return-void
.end method

# virtual methods
.method public onDisplayDeviceEvent(Lcom/android/server/display/DisplayDevice;I)V
    .locals 1
    .parameter "device"
    .parameter "event"

    .prologue
    .line 1018
    packed-switch p2, :pswitch_data_0

    .line 1031
    :goto_0
    return-void

    .line 1020
    :pswitch_0
    iget-object v0, p0, Lcom/android/server/display/DisplayManagerService$DisplayAdapterListener;->this$0:Lcom/android/server/display/DisplayManagerService;

    #calls: Lcom/android/server/display/DisplayManagerService;->handleDisplayDeviceAdded(Lcom/android/server/display/DisplayDevice;)V
    invoke-static {v0, p1}, Lcom/android/server/display/DisplayManagerService;->access$1100(Lcom/android/server/display/DisplayManagerService;Lcom/android/server/display/DisplayDevice;)V

    goto :goto_0

    .line 1024
    :pswitch_1
    iget-object v0, p0, Lcom/android/server/display/DisplayManagerService$DisplayAdapterListener;->this$0:Lcom/android/server/display/DisplayManagerService;

    #calls: Lcom/android/server/display/DisplayManagerService;->handleDisplayDeviceChanged(Lcom/android/server/display/DisplayDevice;)V
    invoke-static {v0, p1}, Lcom/android/server/display/DisplayManagerService;->access$1200(Lcom/android/server/display/DisplayManagerService;Lcom/android/server/display/DisplayDevice;)V

    goto :goto_0

    .line 1028
    :pswitch_2
    iget-object v0, p0, Lcom/android/server/display/DisplayManagerService$DisplayAdapterListener;->this$0:Lcom/android/server/display/DisplayManagerService;

    #calls: Lcom/android/server/display/DisplayManagerService;->handleDisplayDeviceRemoved(Lcom/android/server/display/DisplayDevice;)V
    invoke-static {v0, p1}, Lcom/android/server/display/DisplayManagerService;->access$1300(Lcom/android/server/display/DisplayManagerService;Lcom/android/server/display/DisplayDevice;)V

    goto :goto_0

    .line 1018
    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
        :pswitch_2
    .end packed-switch
.end method

.method public onTraversalRequested()V
    .locals 3

    .prologue
    .line 1035
    iget-object v0, p0, Lcom/android/server/display/DisplayManagerService$DisplayAdapterListener;->this$0:Lcom/android/server/display/DisplayManagerService;

    #getter for: Lcom/android/server/display/DisplayManagerService;->mSyncRoot:Lcom/android/server/display/DisplayManagerService$SyncRoot;
    invoke-static {v0}, Lcom/android/server/display/DisplayManagerService;->access$500(Lcom/android/server/display/DisplayManagerService;)Lcom/android/server/display/DisplayManagerService$SyncRoot;

    move-result-object v1

    monitor-enter v1

    .line 1036
    :try_start_0
    iget-object v0, p0, Lcom/android/server/display/DisplayManagerService$DisplayAdapterListener;->this$0:Lcom/android/server/display/DisplayManagerService;

    const/4 v2, 0x0

    #calls: Lcom/android/server/display/DisplayManagerService;->scheduleTraversalLocked(Z)V
    invoke-static {v0, v2}, Lcom/android/server/display/DisplayManagerService;->access$1400(Lcom/android/server/display/DisplayManagerService;Z)V

    .line 1037
    monitor-exit v1

    .line 1038
    return-void

    .line 1037
    :catchall_0
    move-exception v0

    monitor-exit v1
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    throw v0
.end method


text:
package de.iritgo.aktera.tools;

import de.iritgo.simplelife.process.NullStreamHandler;
import de.iritgo.simplelife.string.StringTools;
import java.io.File;
import java.io.IOException;

/**
 * Useful system methods.
 */
public final class SystemTools
{
	/**
	 * Helper method to wait for a process.
	 *
	 * @param proc The process to wait for.
	 */
	public static int waitForProcess(Process proc)
	{
		int res = 0;

		try
		{
			res = proc.waitFor();
		}
		catch (InterruptedException x)
		{
		}

		return res;
	}

	/**
	 * Start a process and wait for it's termination.
	 * The command is searched relative to the AKTERA_FS_ROOT-
	 *
	 * @param cmd The command path
	 * @param args The command arguments
	 * @throws IOException
	 */
	public static Process startAkteraProcess(String cmd, String args) throws IOException
	{
		File cmdFile = FileTools.newAkteraFile(cmd);
		Process proc = Runtime.getRuntime().exec(
						cmdFile.getAbsolutePath() + (! StringTools.isTrimEmpty(args) ? " " + args : ""));

		return proc;
	}

	/**
	 * Start a process and wait for it's termination.
	 * The command is searched relative to the AKTERA_FS_ROOT-
	 *
	 * @param cmd The command path
	 * @param args The command arguments
	 * @throws IOException
	 */
	public static int startAndWaitAkteraProcess(String cmd, String args) throws IOException
	{
		Process proc = startAkteraProcess(cmd, args);

		new NullStreamHandler(proc.getInputStream());
		new NullStreamHandler(proc.getErrorStream());

		return waitForProcess(proc);
	}

	/**
	 * Start a process and wait for it's termination.
	 * The command is searched relative to the AKTERA_FS_ROOT-
	 *
	 * @param cmd The command path
	 * @param args The command arguments
	 * @param dir The working directory
	 * @throws IOException
	 */
	public static Process startAkteraProcess(String cmd, String args, String dir) throws IOException
	{
		File cmdFile = FileTools.newAkteraFile(cmd);
		File dirFile = FileTools.newAkteraFile(dir);
		Process proc = Runtime.getRuntime().exec(
						cmdFile.getAbsolutePath() + (! StringTools.isTrimEmpty(args) ? " " + args : ""), null, dirFile);

		return proc;
	}

	/**
	 * Start a process and wait for it's termination.
	 * The command is searched relative to the AKTERA_FS_ROOT-
	 *
	 * @param cmd The command path
	 * @param args The command arguments
	 * @param dir The working directory
	 * @throws IOException
	 */
	public static int startAndWaitAkteraProcess(String cmd, String args, String dir) throws IOException
	{
		Process proc = startAkteraProcess(cmd, args, dir);

		new NullStreamHandler(proc.getInputStream());
		new NullStreamHandler(proc.getErrorStream());

		return waitForProcess(proc);
	}

	/**
	 * Try to set a network interface to the given ip address and mas.
	 *
	 * @param interfaceName The interface name
	 * @param ipAddress The ip address
	 * @param mask The network mask
	 * @return True if successfull set
	 */
	public static boolean setSystemIPAddress(String interfaceName, String ipAddress, String mask)
	{
		try
		{
			startAndWaitAkteraProcess("/usr/bin/sudo", "/sbin/ifconfig " + interfaceName + " " + ipAddress
							+ " netmask " + mask + " up", "");
		}
		catch (IOException x)
		{
			return false;
		}

		return true;
	}

	public static boolean isDeveloperDeployment()
	{
		return "developer".equals(System.getProperty("de.iritgo.aktera.deployment"));
	}
}


text:
import os
import platform
import psutil
import ConfigParser

class SystemInfo:

    # constructor
    def __init__(self):
        pass

    @staticmethod
    def get_os_type():
        return platform.system()

    @staticmethod
    def get_memory_usage():
        return psutil.virtual_memory().total, psutil.virtual_memory().used

    @staticmethod
    def get_folder_size(directory):
        dir_size = 0
        for (path, dirs, files) in os.walk(directory):
            for filex in files:
                filename = os.path.join(path, filex)
                dir_size += os.path.getsize(filename)
        return dir_size

    @staticmethod
    def get_hostname():
        return platform.node()

class AgentConfig:

    def __init__(self, configfile='agent.config'):
        config = ConfigParser.ConfigParser()
        config.read(configfile)

class CrashReporter:    #TODO: Crash verileri ile ilgili verileri yorumlayan sinif

    def __init__(self):
        pass

class SlapperAgent:     #TODO: Sunucu tarafi ile iletisime gececek olan modul

    def __init__(self):
        pass


text:
import { Injectable } from '@angular/core';
import { Headers, Http, Response, RequestOptions } from '@angular/http';
import { Constants } from '../../app.constants';
import { Observable } from 'rxjs/Rx';
import 'rxjs/add/operator/do';
import 'rxjs/add/operator/map';
import { AuthService } from 'ng2-ui-auth';
import { HttpBaseService } from "../../base.service";
import { GlobalState } from '../../global.state';
import { LocalStorageService } from 'ngx-localstorage';

@Injectable()
export class ContactoService extends HttpBaseService {
  protected readonly TAG = ContactoService.name;
  CONTACTO_URL = '/ministry/datecontact/';

  constructor(
    protected state: GlobalState,
    private http: Http,
    private auth: AuthService,
    private localStorage: LocalStorageService,
  ) {
    super();
  }

  contacto() {
    const url = this.CONTACTO_URL;
    const token = this.auth.getToken();
    const headers = new Headers();

    return this.http
      .get(`${Constants.API_URL}${url}`, { headers })
      .catch((e, c) => this.handleErrors(e))
      .map((res) => this.extractData(res));
  }
}


text:
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
var answer = require('some_folder/answer');

console.log('answer', answer);

},{"some_folder/answer":"__RAILS_ROOT__/app/assets/javascripts/some_folder/answer.js"}],"__RAILS_ROOT__/app/assets/javascripts/some_folder/answer.js":[function(require,module,exports){
module.exports = 42;

},{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright (c) 2010-2013 Evolveum
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<c:object oid="abababab-abab-abab-abab-000000000001"
	xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
	xmlns='http://midpoint.evolveum.com/xml/ns/public/common/common-3'
   xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3'
   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
   xsi:type="c:UserType">
    <name>bond</name>
    <fullName>James Bond 007</fullName>
    <givenName>James Jr.</givenName>
    <honorificSuffix>007</honorificSuffix>
    <locality>home</locality>
</c:object>


text:
#ifndef __ORCONSTRAINT_WALLBRICKS_CONSTRAINT_H__
#define __ORCONSTRAINT_WALLBRICKS_CONSTRAINT_H__

//////////////////////////////////////////////////////////////////////////////////////////////////
//
// file: wallbricks_constraint.h
//
//	Author Sergey Solokhin (Neill3d)
//
//
//	GitHub page - https://github.com/Neill3d/MoPlugs
//	Licensed under BSD 3-Clause - https://github.com/Neill3d/MoPlugs/blob/master/LICENSE
//
///////////////////////////////////////////////////////////////////////////////////////////////////

//--- SDK include
#include <fbsdk/fbsdk.h>
#include "expr.h"
#include <vector>
#include <random>

#include "algorithm\kdtree_common.h"

#define ORCONSTRAINTWALLBRICKS__CLASSNAME		ORConstraintWallBricks
#define ORCONSTRAINTWALLBRICKS__CLASSSTR		"ORConstraintWallBricks"

#define ORCONSTRAINTWALLBRICKSTEMP__CLASSNAME		ORConstraintWallBricksTemp
#define ORCONSTRAINTWALLBRICKSTEMP__CLASSSTR		"ORConstraintWallBricksTemp"

#ifndef MAX_NUMBER_OF_BRICKS
#define	MAX_NUMBER_OF_BRICKS		16384
#endif

////////////////////////////////////////////////////////////////////////////////
// KDTree

class KDTree
{
public:
	//! a constructor
	KDTree();
	//! a destructor
	virtual ~KDTree();

	// build K-D Tree for this frame
	// each point - xyz
	int	BuildKDTree(int count, double *positions);

	// free kd-tree
	int FreeKDTree();

	/*! SearchForNearest

		\param pos - x,y,z of input point
		\param index - result index of a nearest point in k-d tree
		\param dist - distance from the input points to nearest

		\return index of nearest point in k-d tree
		 return -1 if nearest point is not found
		 retur (-1, -1, -1) if it's a vector point
	*/
	int SearchForNearest(const double *pos, const double dist);

	int SearchForNearest(const double *pos, const double dist, double *res);

private:
	Tree					*mTree;		// k-d tree
};

//////////////////////////////////////////////////////////////////////////////////////////////////
//! A curve deformer constraint class

class ORConstraintPathWrap : public FBConstraint
{
	//--- declaration
	FBConstraintDeclare( ORConstraintPathWrap, FBConstraint );

public:
	//--- Creation & Destruction
	virtual bool			FBCreate() override;							//!< Constructor.
	virtual void			FBDestroy() override;						//!< Destructor.

	virtual bool ReferenceAddNotify		( int pGroupIndex, FBModel* pModel ) override;
	virtual bool ReferenceRemoveNotify	( int pGroupIndex, FBModel* pModel ) override;

	/**	Deformation notification function
	*	\param	pModel		Model to deform.
	*	\param	pSrcVertex	Source vertex array (i.e. vertex to deform).
	*	\param	pSrcNormal	Normals at source vertex array.
	*	\param	pCount		Number of vertices in source/destination arrays
	*	\param	pDstVertex	Destination vertex array (i.e. where source vertex gets deformed to)
	*	\param	pDstNormal	Normals at destination vertex array.
	*	\return \b true if successful.
	*/
	virtual bool DeformerNotify(	FBModel* pModel, const FBVertex*  pSrcVertex, const FBVertex* pSrcNormal,
									int pCount,
									FBVertex*  pDstVertex,FBVertex*  pDstNormal);

protected:

	FBAnimationNode		*mSourceCurve;		// 3d curve, path along which we animate our bricks

	int						mGroupCurve;		//!< Source groupe index.
	int						mGroupDeformed;

};

//////////////////////////////////////////////////////////////////////////////////////////////////
//! A simple deformer constraint class - needed for recover geometry instances after scene load

class ORConstraintWallBricksTemp : public FBConstraint
{
	//--- declaration
	FBConstraintDeclare( ORConstraintWallBricksTemp, FBConstraint );

public:
	//--- Creation & Destruction
	virtual bool			FBCreate() override;							//!< Constructor.
	virtual void			FBDestroy() override;						//!< Destructor.

	virtual bool ReferenceAddNotify		( int pGroupIndex, FBModel* pModel ) override;
	virtual bool ReferenceRemoveNotify	( int pGroupIndex, FBModel* pModel ) override;

protected:

	int						mGroupDeformed;

};

//////////////////////////////////////////////////////////////////////////////////////////////////
//! A wall bricks animation constraint class.
class ORConstraintWallBricks : public FBConstraint
{
	//--- declaration
	//FBConstraintDeclare( ORConstraintWallBricks, FBConstraint );

	FBClassDeclare( ORConstraintWallBricks, FBConstraint );
public:
	ORConstraintWallBricks(const char* pName)
		: FBConstraint(pName)
		, e2(rd())
		, dist(0, 1.0)
	{
		FBClassInit;
	}

private:

public:
	//--- Creation & Destruction
	virtual bool			FBCreate();							//!< Constructor.
	virtual void			FBDestroy();						//!< Destructor.

	//--- Animation node management
	virtual void			RemoveAllAnimationNodes() override;			//!< Remove animation nodes.
	virtual void			SetupAllAnimationNodes() override;			//!< Setup animation nodes.

	virtual void			SnapSuggested() override;
	virtual void			FreezeSuggested		() override;				//!< Suggest 'freeze'.

	//! Real-time evaluation engine function.
	virtual bool			AnimationNodeNotify		( FBAnimationNode* pAnimationNode, FBEvaluateInfo* pEvaluateInfo, FBConstraintInfo* pConstraintInfo );

	//--- FBX Interface
	virtual bool			FbxStore	( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat );	//!< FBX Storage.
	virtual bool			FbxRetrieve	( FBFbxObject* pFbxObject, kFbxObjectStore pStoreWhat );	//!< FBX Retrieval.

	//--- Local parameters

	FBAnimationNode		*mSourceCurve;		// 3d curve, path along which we animate our bricks

	struct BrickNode
	{
		bool			active;			// import flag to activate brick animation
		double			creationPercent;
		double			localTime;	// local animation time
		double			animFactor;

		FBAnimationNode *posNode;
		FBAnimationNode *rotNode;
		FBAnimationNode *scaleNode;

		FBMatrix		initTM;		// start tm (position and angle on the curve)
		FBMatrix		curveTM;	// animation TM in each frame

		// some random value for this element
		double			randomValue;

		// cached data
		double			cachedAnimFactor;
		double			cachedDistToCamera;

		double			cachedPosx;
		double			cachedPosy;
		double			cachedPosz;

		double			cachedRotx;
		double			cachedRoty;
		double			cachedRotz;

		double			cachedSclx;
		double			cachedScly;
		double			cachedSclz;
	};

	// use curve point and tangent to calculate start TM
	void	InitBrick( BrickNode &node );
	void	ComputeInitTM( FBMatrix &TM, const double percent );

	bool	IsBrickCached( const BrickNode &node, double f, double distToCam );
	void	GetBrickCache( const BrickNode &node, double &x, double &y, double &z, double &rx, double &ry, double &rz, double &sx, double &sy, double &sz );
	void	CacheBrick( BrickNode &node, double f, double distToCam, double x, double y, double z, double rx, double ry, double rz, double sx, double sy, double sz );

	std::vector<BrickNode>			mConstrainedBricks;

	int					mGroupCurve;		//!< Source groupe index.
	int					mGroupConstrained;	//!< Constraint group index.

	FBTVector			mPosition;			//!< Position vector.
	FBTVector			mOldPosition;		//!< Old position vector.
	FBTVector			mDisplacement;		//!< Displacement vector.
	bool				mFirstTime;			//!< First time that the constraint is called?
	FBSVector			mScaling;			//!< Scaling vector.

	FBTime				mLastTime;
	bool				mNeedExpressionParsing;
	bool				mExpressionFailed;

	CExpression			mExpression;
	bool				mIsDistToCamUsed;

	bool				mEvalCurve;

	std::random_device					rd;
	std::mt19937						e2;		// engine
	std::uniform_real_distribution<>	dist;	// distribution

	double					mLastTrigger;
	int						mTriggerElement;
	FBTime					mLastAutoTriggerTime;

	void		SetExpressionsToDefault();

public:

	FBPropertyAnimatableDouble	Progress;
	FBPropertyAction			AnimateProgress;

	FBPropertyDouble			ProgressOffset;	// make an offset on the curve
	FBPropertyBool				ProgressInverse;

	FBPropertyBool				ShowOnlyWhileProcessing;	// make nodes visible only when progress spot on them

	FBPropertyBool				TriggerMode;
	FBPropertyAnimatableDouble	Trigger;		// make active some random element
	FBPropertyBool				TurnOffAfterProcessing;
	FBPropertyDouble			AutoTriggerTimer;	// if greater then 0, then trigger from time to time

	//FBPropertyDouble		BrickSideLength;	// used for creation place calculation
	FBPropertyInt			CurveSubdivisions;	// used for point placement
	FBPropertyInt			CurveSegmentSubdivisions;
	FBPropertyDouble		BrickAnimationTime;

	FBPropertyBool			AutoAlignRoot;	// used for manualy computing a rotation angle along a curve
	FBPropertyDouble		SnapThreshold;

	FBPropertyBool			LiveAnimation;

	FBPropertyTime			ResetTime;
	FBPropertyAction		ResetAction;

	FBPropertyBool			StaticCurve;		// evaluate pos and der along a curve only once or each eval ?!

	FBPropertyInt			ScriptErrorCount;
	FBPropertyString		ScriptError;

	FBPropertyString		ScriptPositionX;
	FBPropertyString		ScriptPositionY;
	FBPropertyString		ScriptPositionZ;

	FBPropertyString		ScriptRotationX;
	FBPropertyString		ScriptRotationY;
	FBPropertyString		ScriptRotationZ;

	FBPropertyString		ScriptScalingX;
	FBPropertyString		ScriptScalingY;
	FBPropertyString		ScriptScalingZ;

	FBPropertyAction		ExpressionReset;
	FBPropertyAction		ExpressionLoad;
	FBPropertyAction		ExpressionSave;

	FBPropertyAction		FixInstances;

	FBPropertyBool							UseSizeCurve;
	FBPropertyAction						SizeCurve;
	FBPropertyAnimatableDouble				SizeCurveHolder;

	FBPropertyAction		About;
	FBPropertyAction		Help;

	void DoReset();
	void DoExpressionParse();
	void DoFixInstances();
	void DoSetLiveAnimation();
	void OnButtonSizeCurve();
	void OnChangeStaticCurve();

	void OnAnimateProgressClick();

	void OnProgressOffsetChange();
	void OnProgressInverseChange();

	void OnExpressionResetClick();
	void OnExpressionLoadClick();
	void OnExpressionSaveClick();

	void OnAboutClick();
	void OnHelpClick();

	static void AddPropertiesToPropertyViewManager();

	static void SetScriptPositionX(HIObject pObject, const char *value);
	static void SetScriptPositionY(HIObject pObject, const char *value);
	static void SetScriptPositionZ(HIObject pObject, const char *value);

	static void SetScriptRotationX(HIObject pObject, const char *value);
	static void SetScriptRotationY(HIObject pObject, const char *value);
	static void SetScriptRotationZ(HIObject pObject, const char *value);

	static void SetScriptScalingX(HIObject pObject, const char *value);
	static void SetScriptScalingY(HIObject pObject, const char *value);
	static void SetScriptScalingZ(HIObject pObject, const char *value);

	static void SetLiveAnimation(HIObject pObject, bool value);
	static void ActionFixInstances(HIObject pObject, bool value);
	static void ActionSizeCurve(HIObject pObject, bool value);
	static void ActionStaticCurve(HIObject pObject, bool value);

	static void ActionAnimateProgress(HIObject pObject, bool value);

	static void ActionExpressionReset(HIObject pObject, bool value);
	static void ActionExpressionLoad(HIObject pObject, bool value);
	static void ActionExpressionSave(HIObject pObject, bool value);

	static void SetProgressOffset(HIObject pObject, double value);
	static void SetProgressInverse(HIObject pObject, bool value);

	static void ActionAbout(HIObject pObject, bool value);
	static void ActionHelp(HIObject pObject, bool value);
};

#endif	/* __ORCONSTRAINT_WALLBRICKS_CONSTRAINT_H__ */