コード例 #1
0
        public DataTable get_MarcDatafieldTable()
        {
            DataTable  marcTable = create_MarcDataTable();
            CDatafield Df        = new CDatafield();
            DataRow    nRow;

            //add datafields
            for (int i = 0; i < this.Datafields.Count; i++)
            {
                Df = this.Datafields.Datafield(i);
                for (int j = 0; j < Df.Subfields.Count; j++)
                {
                    nRow                   = marcTable.NewRow();
                    nRow["TAG"]            = Df.Tag;
                    nRow["TAG_INDEX"]      = i + 1;
                    nRow["INDICATOR"]      = Df.Ind1 + Df.Ind2;
                    nRow["SUBFIELD_ID"]    = String.IsNullOrEmpty(Df.Subfields.Subfield(j).ID) ? 0 : int.Parse(Df.Subfields.Subfield(j).ID);
                    nRow["SUBFIELD_CODE"]  = Df.Subfields.Subfield(j).Code;
                    nRow["SUBFIELD_TYPE"]  = Df.Subfields.Subfield(j).Type;
                    nRow["SUBFIELD_VALUE"] = Df.Subfields.Subfield(j).Value;
                    marcTable.Rows.Add(nRow);
                }
            }
            return(marcTable);
        }
コード例 #2
0
        public void bind_TableDataToMarc(ref DataTable marcDataTable)
        {
            if (marcDataTable.Rows.Count == 0)
            {
                return;
            }
            //remove all old datafields
            while (this.Datafields.Count > 0)
            {
                this.Datafields.Remove(0);
                this.Datafields.Refresh();
            }

            for (int i = 0; i < marcDataTable.Rows.Count; i++)
            {
                CDatafield Df       = new CDatafield();
                int        tagIndex = int.Parse(marcDataTable.Rows[i]["TAG_INDEX"].ToString());
                Df.Tag = marcDataTable.Rows[i]["TAG"].ToString();
                while ((i < marcDataTable.Rows.Count) && (tagIndex == int.Parse(marcDataTable.Rows[i]["TAG_INDEX"].ToString())))
                {
                    CSubfield Sf = new CSubfield();
                    Sf.ID    = marcDataTable.Rows[i]["SUBFIELD_ID"].ToString();
                    Sf.Code  = marcDataTable.Rows[i]["SUBFIELD_CODE"].ToString();
                    Sf.Type  = marcDataTable.Rows[i]["SUBFIELD_TYPE"].ToString();
                    Sf.Value = marcDataTable.Rows[i]["SUBFIELD_VALUE"].ToString();
                    Df.Subfields.Add(Sf);
                    i++;
                }
                i--;//back to for step
                this.Datafields.Add(Df);
            }
        }
    public void Take_LinkRelatedContents()
    {
        try
        {
            if (Session["METADATA"] == null)
            {
                Response.Redirect("MetaContentEditor.aspx");
            }
            LegoWebAdmin.DataProvider.ContentEditorDataHelper _MetaContentObject = new ContentEditorDataHelper();
            _MetaContentObject.load_Xml(Session["METADATA"].ToString());

            DataTable  marcTable = _MetaContentObject.get_MarcDatafieldTable();
            CDatafield Df        = new CDatafield();
            for (int i = 0; i < this.metaContentManagerRepeater.Items.Count; i++)
            {
                CheckBox cbRow = ((CheckBox)metaContentManagerRepeater.Items[i].FindControl("chkSelect"));
                if (cbRow.Checked == true)
                {
                    TextBox txtMetaContentId = (TextBox)metaContentManagerRepeater.Items[i].FindControl("txtMetaContentId");
                    if (txtMetaContentId != null)
                    {
                        int   iTagIndex      = marcTable.Rows.Count;
                        Int32 iMetaContentId = Int32.Parse(txtMetaContentId.Text);

                        Label labelMetaContentTitle = (Label)metaContentManagerRepeater.Items[i].FindControl("labelMetaContentTitle");
                        if (labelMetaContentTitle != null)
                        {
                            DataRow addRow = marcTable.NewRow();
                            addRow["TAG"]            = 780;
                            addRow["TAG_INDEX"]      = iTagIndex;
                            addRow["SUBFIELD_CODE"]  = "t";
                            addRow["SUBFIELD_LABEL"] = " ";
                            addRow["SUBFIELD_TYPE"]  = "TEXT";
                            addRow["SUBFIELD_VALUE"] = labelMetaContentTitle.Text;
                            marcTable.Rows.Add(addRow);

                            addRow                   = marcTable.NewRow();
                            addRow["TAG"]            = 780;
                            addRow["TAG_INDEX"]      = iTagIndex;
                            addRow["SUBFIELD_CODE"]  = "w";
                            addRow["SUBFIELD_LABEL"] = " ";
                            addRow["SUBFIELD_TYPE"]  = "NUMBER";
                            addRow["SUBFIELD_VALUE"] = iMetaContentId;
                            marcTable.Rows.Add(addRow);
                        }
                    }
                }
            }
            _MetaContentObject.bind_TableDataToMarc(ref marcTable);
            Session["METADATA"] = _MetaContentObject.OuterXml;
            Response.Redirect("MetaContentEditor.aspx");
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
    protected void listAddTag_SelectedIndexChanged(object sender, EventArgs e)
    {
        CRecord labelRec      = new CRecord();
        string  labelFileName = FileTemplateDataProvider.get_LabelTemplateFile(LegoWebAdmin.BusLogic.Categories.get_CATEGORY_TEMPLATE_NAME(int.Parse(dropCategories.SelectedValue.ToString())));

        labelRec.load_File(labelFileName);
        listAddSubfieldCode.Items.Clear();
        listAddSubfieldCode.Items.Add(new ListItem("All", ""));
        CDatafield Df = new CDatafield();

        if (labelRec.Datafields.get_Datafield(listAddTag.SelectedValue, ref Df))
        {
            for (int i = 0; i < Df.Subfields.Count; i++)
            {
                listAddSubfieldCode.Items.Add(new ListItem(Df.Subfields.Subfield(i).Value, Df.Subfields.Subfield(i).Code));
            }
        }
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!String.IsNullOrEmpty(_box_css_name))
            {
                if (_box_css_name.IndexOf("-title-") > 0)
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"title\">{1}</div><div class=\"m\"><div class=\"clearfix\">", _box_css_name, LegoWebSite.Buslgic.CommonParameters.asign_COMMON_PARAMETER(this.Title));
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
                else
                {
                    string sBoxTop    = String.Format("<div id=\"{0}\"><div class=\"t\"><div class=\"t\"><div class=\"t\"></div></div></div><div class=\"m\"><div class=\"clearfix\">", _box_css_name);
                    string sBoxBottom = "</div><div class=\"clr\"></div></div><div class=\"b\"><div class=\"b\"><div class=\"b\"></div></div></div></div>";
                    this.litBoxTop.Text    = sBoxTop;
                    this.litBoxBottom.Text = sBoxBottom;
                }
            }

            string sliderShowScript = @"
                    <script type='text/javascript'> 
                     
                    $(document).ready(function() {		
                        
	                    //Execute the slideShow
	                    slideShow();
                     
                    });
                     
                    function slideShow() {
                     
	                    //Resize the heigh of the div according to the image heigh
	                    $('#gallery').css({height: $('#gallery a').find('img').css('height')});

	                    //Set the opacity of all images to 0
	                    $('#gallery a').css({opacity: 0.0});
                        
	                    //Get the first image and display it (set it to full opacity)
	                    $('#gallery a:first').css({opacity: 1.0});
                        
	                    //Set the caption background to semi-transparent
	                    $('#gallery .caption').css({opacity: 0.7});
                     
	                    //Resize the width of the caption according to the image width
	                    $('#gallery .caption').css({width: $('#gallery a').find('img').css('width')});
                        
	                    //Get the caption of the first image from REL attribute and display it
	                    $('#gallery .content').html($('#gallery a:first').find('img').attr('rel'))
	                    .animate({opacity: 0.7}, 400);
                        
	                    //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds
	                    setInterval('gallery()',6000);
                        
                    }
                     
                    function gallery() {
                        
	                    //if no IMGs have the show class, grab the first image
	                    var current = ($('#gallery a.show')?  $('#gallery a.show') : $('#gallery a:first'));
                     
	                    //Get next image, if it reached the end of the slideshow, rotate it back to the first image
	                    var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first'));	
                        
	                    //Get next image caption
	                    var caption = next.find('img').attr('rel');	
                        
	                    //Set the fade in effect for the next image, show class has higher z-index
	                    next.css({opacity: 0.0})
	                    .addClass('show')
	                    .animate({opacity: 1.0}, 1000);
                     
	                    //Hide the current image
	                    current.animate({opacity: 0.0}, 1000)
	                    .removeClass('show');
                        
	                    //Set the opacity to 0 and height to 1px
	                    $('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 });	
                        
	                    //Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect
	                    $('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '65px'},500 );
                        
	                    //Display the content
	                    $('#gallery .content').html(caption);                                               
                    }
                     
                    </script>
               ";

            int contentid = discover_content_id();

            if ((contentid <= 0) || (contentid > 0 && !LegoWebSite.Buslgic.MetaContents.is_META_CONTENTS_EXIST(contentid)))
            {
                this.litContent.Text = "<H3>No suitable data!</H3>";
                return;
            }

            CRecord myRec    = new CRecord();
            string  sMetaXml = LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(contentid, 0);
            myRec.load_Xml(sMetaXml);
            myRec.Sort();

            string sdefaultHeight = myRec.Datafields.Datafield("300").Subfields.Subfield("h").Value;
            string sdefaultWidth  = myRec.Datafields.Datafield("300").Subfields.Subfield("w").Value;

            CDatafields Dfs = myRec.Datafields;
            Dfs.Filter("856");
            if (Dfs.Count == 0)
            {
                this.litContent.Text = "<H3>No image info</H3>";
                return;
            }
            else
            {
                string sSliderHTML = "<div id='gallery'>";
                string aFormat     = "<a href='{0}' {1}> <img src='{2}' alt='{3}' width='{4}' height='{5}' rel='<h3>{3}</h3>{6}'/></a>";
                for (int i = 0; i < Dfs.Count; i++)
                {
                    CDatafield Df = Dfs.Datafield(i);
                    if (i == 0)
                    {
                        sSliderHTML += String.Format(aFormat, String.IsNullOrEmpty(Df.Subfields.Subfield("l").Value) ? "#" : Df.Subfields.Subfield("l").Value, " class='show'", Df.Subfields.Subfield("u").Value, Df.Subfields.Subfield("3").Value, String.IsNullOrEmpty(Df.Subfields.Subfield("w").Value) == true ? sdefaultWidth : Df.Subfields.Subfield("w").Value, String.IsNullOrEmpty(Df.Subfields.Subfield("h").Value) == true ? sdefaultHeight: Df.Subfields.Subfield("h").Value, Df.Subfields.Subfield("a").Value);
                    }
                    else
                    {
                        sSliderHTML += String.Format(aFormat, String.IsNullOrEmpty(Df.Subfields.Subfield("l").Value) ? "#" : Df.Subfields.Subfield("l").Value, "", Df.Subfields.Subfield("u").Value, Df.Subfields.Subfield("3").Value, String.IsNullOrEmpty(Df.Subfields.Subfield("w").Value) == true ? sdefaultWidth : Df.Subfields.Subfield("w").Value, String.IsNullOrEmpty(Df.Subfields.Subfield("h").Value) == true ? sdefaultHeight: Df.Subfields.Subfield("h").Value, Df.Subfields.Subfield("a").Value);
                    }
                }
                sSliderHTML         += "<div class='caption'><div class='content'></div></div>";
                sSliderHTML         += "</div";
                this.litContent.Text = sSliderHTML;
            }
            Page.RegisterStartupScript("slidershowscript", sliderShowScript);
        }
    }
    protected void linkExportButton_Click(object sender, EventArgs e)
    {
        CRecords      exRecs = new CRecords();
        CRecord       myRec  = new CRecord();
        CControlfield Cf     = new CControlfield();
        CDatafield    Df     = new CDatafield();
        CSubfield     Sf     = new CSubfield();

        DataTable tbData = new DataTable();

        try
        {
            switch (radioFilterType.SelectedValue)
            {
            case "0":
                int iSectionID  = 0;
                int iCategoryID = 0;
                if (dropSections.SelectedValue != null)
                {
                    iSectionID = int.Parse(dropSections.SelectedValue.ToString());
                }
                if (dropCategories.SelectedValue != null)
                {
                    iCategoryID = int.Parse(dropCategories.SelectedValue.ToString());
                }

                tbData = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_BY_CATEGORY_ID(iCategoryID, iSectionID).Tables[0];

                for (int i = 0; i < tbData.Rows.Count; i++)
                {
                    string sXmlContent = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_MARCXML(Int16.Parse(tbData.Rows[i]["META_CONTENT_ID"].ToString()), 1);
                    myRec.load_Xml(sXmlContent);
                    exRecs.Add(myRec);
                }
                break;

            case "1":

                int iFromID = String.IsNullOrEmpty(txtFromId.Text) ? 0 : int.Parse(txtFromId.Text);
                int iToID   = String.IsNullOrEmpty(txtToId.Text) ? 0 : int.Parse(txtToId.Text);
                tbData = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_BY_ID(iFromID, iToID).Tables[0];

                for (int i = 0; i < tbData.Rows.Count; i++)
                {
                    string sXmlContent = LegoWebAdmin.BusLogic.MetaContents.get_META_CONTENT_MARCXML(Int16.Parse(tbData.Rows[i]["META_CONTENT_ID"].ToString()), 1);
                    myRec.load_Xml(sXmlContent);
                    exRecs.Add(myRec);
                }

                break;

            case "2":
                //create each system table one MarcRecord
                //leader 06 = s mean system table data record
                //001 value is TABLE NAME

                //LEGOWEB_COMMON_PARAMETERS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_COMMON_PARAMETERS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_COMMON_PARAMETERS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.CommonParameters.get_LEGOWEB_COMMON_PARAMETERS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a PARAMETER_NAME	nvarchar(50)	Unchecked
                    //b PARAMETER_TYPE	smallint	Checked
                    //c PARAMETER_VI_VALUE	nvarchar(255)	Checked
                    //d PARAMETER_EN_VALUE	nvarchar(255)	Checked
                    //e PARAMETER_DESCRIPTION	nvarchar(255)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}", row["PARAMETER_NAME"].ToString(), row["PARAMETER_TYPE"].ToString(), row["PARAMETER_VI_VALUE"].ToString(), row["PARAMETER_EN_VALUE"].ToString(), row["PARAMETER_DESCRIPTION"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_SECTIONS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_SECTIONS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_SECTIONS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Sections.get_LEGOWEB_SECTIONS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a SECTION_ID	int	Unchecked
                    //b SECTION_VI_TITLE	nvarchar(250)	Unchecked
                    //c SECTION_EN_TITLE	nvarchar(250)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}", row["SECTION_ID"].ToString(), row["SECTION_VI_TITLE"].ToString(), row["SECTION_EN_TITLE"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_CATEGORIES
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_CATEGORIES";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_CATEGORIES TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Categories.get_LEGOWEB_CATEGORIES().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a CATEGORY_ID	int	Unchecked
                    //b PARENT_CATEGORY_ID	int	Checked
                    //c SECTION_ID	int	Unchecked
                    //d CATEGORY_VI_TITLE	nvarchar(250)	Unchecked
                    //e CATEGORY_EN_TITLE	nvarchar(250)	Checked
                    //f CATEGORY_ALIAS	nvarchar(250)	Checked
                    //g CATEGORY_TEMPLATE_NAME	nvarchar(50)	Checked
                    //h CATEGORY_IMAGE_URL	nvarchar(250)	Checked
                    //i MENU_ID	int	Unchecked
                    //j IS_PUBLIC	bit	Checked
                    //k ADMIN_LEVEL	smallint	Checked
                    //l ADMIN_ROLES	nvarchar(250)	Checked
                    //m SEO_TITLE	nvarchar(100)	Checked
                    //n SEO_DESCRIPTION	nvarchar(255)	Checked
                    //o SEO_KEYWORDS	nvarchar(255)	Checked
                    //p ORDER_NUMBER smallint
                    //q SORT_CONTENT_BY smallint -- since 10-03-2012
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}$k{10}$l{11}$m{12}$n{13}$o{14}$p{15}$q{16}", row["CATEGORY_ID"].ToString(), row["PARENT_CATEGORY_ID"].ToString(), row["SECTION_ID"].ToString(), row["CATEGORY_VI_TITLE"].ToString(), row["CATEGORY_EN_TITLE"].ToString(), row["CATEGORY_ALIAS"].ToString(), row["CATEGORY_TEMPLATE_NAME"].ToString(), row["CATEGORY_IMAGE_URL"].ToString(), row["MENU_ID"].ToString(), row["IS_PUBLIC"].ToString(), row["ADMIN_LEVEL"].ToString(), row["ADMIN_ROLES"].ToString(), row["SEO_TITLE"].ToString(), row["SEO_DESCRIPTION"].ToString(), row["SEO_KEYWORDS"].ToString(), row["ORDER_NUMBER"].ToString(), row["SORT_CONTENT_BY"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //LEGOWEB_MENU_TYPES
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_MENU_TYPES";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_MENU_TYPES TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.MenuTypes.get_LEGOWEB_MENU_TYPES().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a MENU_TYPE_ID	smallint	Unchecked
                    //b MENU_TYPE_VI_TITLE	nvarchar(50)	Unchecked
                    //c MENU_TYPE_EN_TITLE	nvarchar(50)	Unchecked
                    //d MENU_TYPE_DESCRIPTION	nvarchar(250)	Checked
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}", row["MENU_TYPE_ID"].ToString(), row["MENU_TYPE_VI_TITLE"].ToString(), row["MENU_TYPE_EN_TITLE"].ToString(), row["MENU_TYPE_DESCRIPTION"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);


                //LEGOWEB_MENUS
                myRec = new CRecord();
                myRec.set_LeaderValueByPos("s", 6, 6);
                Cf       = new CControlfield();
                Cf.Tag   = "001";
                Cf.Value = "LEGOWEB_MENUS";
                myRec.Controlfields.Add(Cf);

                Df               = new CDatafield();
                Df.Tag           = "245";
                Df.SubfieldsText = "$aLEGOWEB_MENUS TABLE DATA";
                myRec.Datafields.Add(Df);

                tbData = LegoWebAdmin.BusLogic.Menus.get_LEGOWEB_MENUS().Tables[0];

                foreach (DataRow row in tbData.Rows)
                {
                    //a MENU_ID	int	Unchecked
                    //b PARENT_MENU_ID	int	Unchecked
                    //c MENU_TYPE_ID	int	Unchecked
                    //d MENU_VI_TITLE	nvarchar(50)	Checked
                    //e MENU_EN_TITLE	nvarchar(50)	Checked
                    //f MENU_IMAGE_URL	nvarchar(250)	Checked
                    //g MENU_LINK_URL	nvarchar(50)	Checked
                    //h BROWSER_NAVIGATE	tinyint	Unchecked
                    //i IS_PUBLIC	bit	Unchecked
                    //j ORDER_NUMBER smallint
                    Df               = new CDatafield();
                    Df.Tag           = "650";
                    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}", row["MENU_ID"].ToString(), row["PARENT_MENU_ID"].ToString(), row["MENU_TYPE_ID"].ToString(), row["MENU_VI_TITLE"].ToString(), row["MENU_EN_TITLE"].ToString(), row["MENU_IMAGE_URL"].ToString(), row["MENU_LINK_URL"].ToString(), row["BROWSER_NAVIGATE"].ToString(), row["IS_PUBLIC"].ToString(), row["ORDER_NUMBER"].ToString());
                    myRec.Datafields.Add(Df);
                }

                exRecs.Add(myRec);

                //#region KIPOS TABLES

                //myRec = new CRecord();
                //myRec.set_LeaderValueByPos("s", 6, 6);
                //Cf = new CControlfield();
                //Cf.Tag = "001";
                //Cf.Value = "CAT_DMD_CATEGORY";
                //myRec.Controlfields.Add(Cf);

                //Df = new CDatafield();
                //Df.Tag = "245";
                //Df.SubfieldsText = "$aCAT_DMD_CATEGORY";
                //myRec.Datafields.Add(Df);

                //tbData = LegoWebAdmin.BusLogic.Menus.get_LEGOWEB_MENUS().Tables[0];

                //foreach (DataRow row in tbData.Rows)
                //{
                //    //a MENU_ID	int	Unchecked
                //    //b PARENT_MENU_ID	int	Unchecked
                //    //c MENU_TYPE_ID	int	Unchecked
                //    //d MENU_VI_TITLE	nvarchar(50)	Checked
                //    //e MENU_EN_TITLE	nvarchar(50)	Checked
                //    //f MENU_IMAGE_URL	nvarchar(250)	Checked
                //    //g MENU_LINK_URL	nvarchar(50)	Checked
                //    //h BROWSER_NAVIGATE	tinyint	Unchecked
                //    //i IS_PUBLIC	bit	Unchecked
                //    //j ORDER_NUMBER smallint
                //    Df = new CDatafield();
                //    Df.Tag = "650";
                //    Df.SubfieldsText = String.Format("$a{0}$b{1}$c{2}$d{3}$e{4}$f{5}$g{6}$h{7}$i{8}$j{9}", row["MENU_ID"].ToString(), row["PARENT_MENU_ID"].ToString(), row["MENU_TYPE_ID"].ToString(), row["MENU_VI_TITLE"].ToString(), row["MENU_EN_TITLE"].ToString(), row["MENU_IMAGE_URL"].ToString(), row["MENU_LINK_URL"].ToString(), row["BROWSER_NAVIGATE"].ToString(), row["IS_PUBLIC"].ToString(), row["ORDER_NUMBER"].ToString());
                //    myRec.Datafields.Add(Df);
                //}

                //exRecs.Add(myRec);
                //#endregion KIPOS TABLES
                break;
            }

            if (exRecs.Count <= 0)
            {
                throw new Exception("No data to export!");
            }
            Response.ContentType = "APPLICATION/OCTET-STREAM";
            //set the filename
            Response.AddHeader("Content-Disposition", "attachment;filename=\"legowebdata.xml\"");
            String outStream = exRecs.OuterXml;
            Response.Write(outStream);
            Response.End();
        }
        catch (Exception ex)
        {
            String errorFomat = @"<dl id='system-message'>
                                            <dd class='error message fade'>
	                                            <ul>
		                                            <li>{0}</li>
	                                            </ul>
                                            </dd>
                                            </dl>";
            litErrorSpaceHolder.Text = String.Format(errorFomat, ex.Message);
        }
    }
    protected void cmdAddTagOrSubfield_Click(object sender, EventArgs e)
    {
        save_MetaContentData();//save data first

        _MetaContent = new ContentEditorDataHelper();
        _MetaContent.load_Xml(Session["METADATA"].ToString());

        CRecord labelRec = new CRecord();

        labelRec.load_File(FileTemplateDataProvider.get_LabelTemplateFile(LegoWebAdmin.BusLogic.Categories.get_CATEGORY_TEMPLATE_NAME(int.Parse(dropCategories.SelectedValue.ToString()))));

        CDatafield Df = labelRec.Datafields.Datafield(listAddTag.SelectedValue.ToString());

        DataTable marcTable = _MetaContent.get_MarcDatafieldTable();
        int       iTagIndex = 0;

        if (marcTable.Rows.Count > 0)
        {
            DataRow[] maxRows = marcTable.Select("TAG_INDEX=Max(TAG_INDEX)");
            iTagIndex = int.Parse("0" + maxRows[0]["TAG_INDEX"].ToString());
        }
        if (listAddSubfieldCode.SelectedValue == "")//add new tag
        {
            for (int i = 0; i < Df.Subfields.Count; i++)
            {
                DataRow nRow = marcTable.NewRow();
                nRow["TAG"]            = Df.Tag;
                nRow["TAG_INDEX"]      = iTagIndex + 1;
                nRow["SUBFIELD_CODE"]  = Df.Subfields.Subfield(i).Code;
                nRow["SUBFIELD_TYPE"]  = Df.Subfields.Subfield(i).Type;
                nRow["SUBFIELD_LABEL"] = Df.Subfields.Subfield(i).Value;
                nRow["SUBFIELD_VALUE"] = txtAddValue.Text;
                marcTable.Rows.Add(nRow);
            }
            marcTable.DefaultView.Sort = "TAG, TAG_INDEX ASC";

            _MetaContent.set_DataTableLabel(ref marcTable, labelRec);
            repeater_DataBind(marcTable);
            _MetaContent.bind_TableDataToMarc(ref marcTable);
            Session["METADATA"] = _MetaContent.OuterXml;
            return;
        }
        else//add subfield to existing tag or new tag only one subfield
        {
            CSubfield Sf = Df.Subfields.Subfield(listAddSubfieldCode.SelectedValue.ToString());

            #region add to subfield to selected tag if have one
            for (int i = 0; i < this.marcTextRepeater.Items.Count; i++)
            {
                CheckBox cb = ((CheckBox)marcTextRepeater.Items[i].FindControl("RowLevelCheckBox"));
                if (cb.Checked)
                {
                    Label labelTag = (Label)marcTextRepeater.Items[i].FindControl("labelTag");
                    if (labelTag.Text == listAddTag.SelectedValue.ToString())
                    {
                        DataRow nRow = marcTable.NewRow();
                        nRow["TAG"] = labelTag.Text;
                        Label labelTagIndex = (Label)marcTextRepeater.Items[i].FindControl("labelTagIndex");
                        nRow["TAG_INDEX"]      = int.Parse(labelTagIndex.Text);
                        nRow["SUBFIELD_CODE"]  = Sf.Code;
                        nRow["SUBFIELD_TYPE"]  = Sf.Type;
                        nRow["SUBFIELD_LABEL"] = Sf.Value;
                        nRow["SUBFIELD_VALUE"] = txtAddValue.Text;
                        marcTable.Rows.Add(nRow);
                        //sort go here
                        marcTable.DefaultView.Sort = "TAG, TAG_INDEX ASC";
                        _MetaContent.set_DataTableLabel(ref marcTable, labelRec);
                        repeater_DataBind(marcTable);
                        _MetaContent.bind_TableDataToMarc(ref marcTable);
                        Session["METADATA"] = _MetaContent.OuterXml;
                        return;
                    }
                }
            }
            #endregion
            //if don't have match selected tag find existing tag
            for (int i = 0; i < marcTable.Rows.Count; i++)
            {
                if (marcTable.Rows[i]["TAG"].ToString() == listAddTag.SelectedValue.ToString())
                {
                    DataRow nRow = marcTable.NewRow();
                    nRow["TAG"]            = marcTable.Rows[i]["TAG"];
                    nRow["TAG_INDEX"]      = marcTable.Rows[i]["TAG_INDEX"];
                    nRow["SUBFIELD_CODE"]  = Sf.Code;
                    nRow["SUBFIELD_TYPE"]  = Sf.Type;
                    nRow["SUBFIELD_LABEL"] = Sf.Value;
                    nRow["SUBFIELD_VALUE"] = txtAddValue.Text;
                    marcTable.Rows.Add(nRow);
                    //sort go here
                    marcTable.DefaultView.Sort = "TAG, TAG_INDEX ASC";
                    _MetaContent.set_DataTableLabel(ref marcTable, labelRec);
                    repeater_DataBind(marcTable);
                    _MetaContent.bind_TableDataToMarc(ref marcTable);
                    Session["METADATA"] = _MetaContent.OuterXml;
                    return;
                }
            }
            //don't have existing match tag create new tag with one subfield
            DataRow addRow = marcTable.NewRow();
            addRow["TAG"]            = Df.Tag;
            addRow["TAG_INDEX"]      = iTagIndex + 1;
            addRow["SUBFIELD_CODE"]  = Sf.Code;
            addRow["SUBFIELD_TYPE"]  = Sf.Type;
            addRow["SUBFIELD_LABEL"] = Sf.Value;
            addRow["SUBFIELD_VALUE"] = txtAddValue.Text;
            marcTable.Rows.Add(addRow);
            //sort go here
            marcTable.DefaultView.Sort = "TAG, TAG_INDEX ASC";
            _MetaContent.set_DataTableLabel(ref marcTable, labelRec);
            repeater_DataBind(marcTable);
            _MetaContent.bind_TableDataToMarc(ref marcTable);
            Session["METADATA"] = _MetaContent.OuterXml;
            return;
        }
    }
コード例 #8
0
    protected void import_SystemTableData(CRecord tblRec)
    {
        CDatafields Dfs;
        CDatafield  Df = new CDatafield();

        switch (tblRec.Controlfields.Controlfield("001").Value)
        {
        case "LEGOWEB_COMMON_PARAMETERS":
            //Df.SubfieldsText = String.Format("$a{0} $b{1} $c{2} $d{3} $e{4}", row["PARAMETER_NAME"].ToString(), row["PARAMETER_TYPE"].ToString(), row["PARAMETER_VI_VALUE"].ToString(), row["PARAMETER_EN_VALUE"].ToString(), row["PARAMETER_DESCRIPTION"].ToString());
            Dfs = tblRec.Datafields;
            Dfs.Filter("650");
            for (int i = 0; i < Dfs.Count; i++)
            {
                Df = Dfs.Datafield(i);
                LegoWebAdmin.BusLogic.CommonParameters.addudp_LEGOWEB_COMMON_PARAMETER(Df.Subfields.Subfield("a").Value, int.Parse(Df.Subfields.Subfield("b").Value), Df.Subfields.Subfield("c").Value, Df.Subfields.Subfield("d").Value, Df.Subfields.Subfield("e").Value);
            }
            break;

        case "LEGOWEB_SECTIONS":
            //Df.SubfieldsText = String.Format("$a{0} $b{1} $c{2}", row["SECTION_ID"].ToString(), row["SECTION_VI_TITLE"].ToString(), row["SECTION_EN_TITLE"].ToString());
            Dfs = tblRec.Datafields;
            Dfs.Filter("650");
            for (int i = 0; i < Dfs.Count; i++)
            {
                Df = Dfs.Datafield(i);
                LegoWebAdmin.BusLogic.Sections.add_Update(int.Parse(Df.Subfields.Subfield("a").Value), Df.Subfields.Subfield("b").Value, Df.Subfields.Subfield("c").Value);
            }
            break;

        case "LEGOWEB_CATEGORIES":
            //Df.SubfieldsText = String.Format("$a{0} $b{1} $c{2} $d{3} $e{4} $f{5} $g{6} $h{7} $i{8} $j{9} $k{10} $l{11} $m{12} $n{13} $o{14} $p{15}", row["CATEGORY_ID"].ToString(), row["PARENT_CATEGORY_ID"].ToString(), row["SECTION_ID"].ToString(), row["CATEGORY_VI_TITLE"].ToString(), row["CATEGORY_EN_TITLE"].ToString(), row["CATEGORY_ALIAS"].ToString(), row["CATEGORY_TEMPLATE_NAME"].ToString(), row["CATEGORY_IMAGE_URL"].ToString(), row["MENU_ID"].ToString(), row["IS_PUBLIC"].ToString(), row["ADMIN_LEVEL"].ToString(), row["ADMIN_ROLES"].ToString(), row["SEO_TITLE"].ToString(), row["SEO_DESCRIPTION"].ToString(), row["SEO_KEYWORDS"].ToString(),row["ORDER_NUMBER"].ToString());

            Dfs = tblRec.Datafields;
            Dfs.Filter("650");
            for (int i = 0; i < Dfs.Count; i++)
            {
                Df = Dfs.Datafield(i);
                LegoWebAdmin.BusLogic.Categories.addUpdate_CATEGORY(int.Parse(Df.Subfields.Subfield("a").Value), int.Parse(Df.Subfields.Subfield("b").Value), int.Parse(Df.Subfields.Subfield("c").Value), Df.Subfields.Subfield("d").Value, Df.Subfields.Subfield("e").Value, Df.Subfields.Subfield("f").Value, Df.Subfields.Subfield("g").Value, Df.Subfields.Subfield("h").Value, int.Parse(Df.Subfields.Subfield("i").Value), int.Parse("0" + Df.Subfields.Subfield("q").Value), Convert.ToBoolean(Df.Subfields.Subfield("j").Value), int.Parse(Df.Subfields.Subfield("k").Value), Df.Subfields.Subfield("l").Value, Df.Subfields.Subfield("m").Value, Df.Subfields.Subfield("n").Value, Df.Subfields.Subfield("o").Value);
                if (!String.IsNullOrEmpty(Df.Subfields.Subfield("p").Value))
                {
                    LegoWebAdmin.BusLogic.Categories.update_CATEGORY_ORDER(int.Parse(Df.Subfields.Subfield("a").Value), int.Parse(Df.Subfields.Subfield("p").Value));
                }
            }
            break;

        case "LEGOWEB_MENU_TYPES":
            //Df.SubfieldsText = String.Format("$a{0} $b{1} $c{2} $d{3}", row["MENU_TYPE_ID"].ToString(), row["MENU_TYPE_VI_TITLE"].ToString(), row["MENU_TYPE_EN_TITLE"].ToString(), row["MENU_TYPE_DESCRIPTION"].ToString());
            Dfs = tblRec.Datafields;
            Dfs.Filter("650");
            for (int i = 0; i < Dfs.Count; i++)
            {
                Df = Dfs.Datafield(i);
                LegoWebAdmin.BusLogic.MenuTypes.addUpdate_MenuType(int.Parse(Df.Subfields.Subfield("a").Value), Df.Subfields.Subfield("b").Value, Df.Subfields.Subfield("c").Value, Df.Subfields.Subfield("d").Value);
            }
            break;


        case "LEGOWEB_MENUS":
            //Df.SubfieldsText = String.Format("$a{0} $b{1} $c{2} $d{3} $e{4} $f{5} $g{6} $h{7} $i{8} $j{9}", row["MENU_ID"].ToString(), row["PARENT_MENU_ID"].ToString(), row["MENU_TYPE_ID"].ToString(), row["MENU_VI_TITLE"].ToString(), row["MENU_EN_TITLE"].ToString(), row["MENU_IMAGE_URL"].ToString(), row["MENU_LINK_URL"].ToString(), row["BROWSER_NAVIGATE"].ToString(), row["IS_PUBLIC"].ToString(),row["ORDER_NUMBER"].ToString());
            Dfs = tblRec.Datafields;
            Dfs.Filter("650");
            for (int i = 0; i < Dfs.Count; i++)
            {
                Df = Dfs.Datafield(i);
                LegoWebAdmin.BusLogic.Menus.addUpdate_MENU(int.Parse(Df.Subfields.Subfield("a").Value), int.Parse(Df.Subfields.Subfield("b").Value), int.Parse(Df.Subfields.Subfield("c").Value), Df.Subfields.Subfield("d").Value, Df.Subfields.Subfield("e").Value, Df.Subfields.Subfield("f").Value, Df.Subfields.Subfield("g").Value, int.Parse(Df.Subfields.Subfield("h").Value), Convert.ToBoolean(Df.Subfields.Subfield("i").Value));
                if (!String.IsNullOrEmpty(Df.Subfields.Subfield("j").Value))
                {
                    LegoWebAdmin.BusLogic.Menus.update_MENU_ORDER(int.Parse(Df.Subfields.Subfield("a").Value), int.Parse(Df.Subfields.Subfield("j").Value));
                }
            }
            break;
        }
    }
コード例 #9
0
        public static DataTable get_PollData(int iPollContentId, out string sQuestion, out int iTotalVoteCount)
        {
            iTotalVoteCount = 0;
            sQuestion       = null;
            DataTable  pollData = new DataTable();
            DataColumn IDcol    = new DataColumn("ID");

            IDcol.DataType = System.Type.GetType("System.Int32");
            pollData.Columns.Add(IDcol);

            DataColumn voteCountCol = new DataColumn("VoteCount");

            voteCountCol.DataType = System.Type.GetType("System.Int32");
            pollData.Columns.Add(voteCountCol);

            DataColumn ChoiceCol = new DataColumn("Choice");

            ChoiceCol.DataType = System.Type.GetType("System.String");
            pollData.Columns.Add(ChoiceCol);

            DataColumn orderCol = new DataColumn("OrderNumber");

            orderCol.DataType = System.Type.GetType("System.Int32");
            pollData.Columns.Add(orderCol);

            CRecord    pollRecord = new CRecord();
            CDatafield Df         = new CDatafield();
            CSubfield  Sf         = new CSubfield();

            pollRecord.load_Xml(LegoWebSite.Buslgic.MetaContents.get_META_CONTENT_MARCXML(iPollContentId, 0));

            pollRecord.Sort();
            //get Question First
            sQuestion = pollRecord.Datafields.Datafield("245").Subfields.Subfield("a").Value;

            CDatafields ChoiceDfs = pollRecord.Datafields;

            ChoiceDfs.Filter("650");

            for (int i = 0; i < ChoiceDfs.Count; i++)
            {
                string sChoice      = "";
                int    iID          = 0;
                int    iVoteCount   = 0;
                int    iOrderNumber = 0;
                Df = ChoiceDfs.Datafield(i);

                if (Df.Subfields.get_Subfield("0", ref Sf))
                {
                    iOrderNumber = String.IsNullOrEmpty(Sf.Value)?0:int.Parse(Sf.Value);
                }

                if (Df.Subfields.get_Subfield("a", ref Sf))
                {
                    sChoice = Sf.Value;
                    iID     = int.Parse(Sf.ID);
                }
                else
                {
                    sChoice = "No choice info";
                }

                if (Df.Subfields.get_Subfield("n", ref Sf))
                {
                    iTotalVoteCount += int.Parse(Sf.Value);
                    iVoteCount       = int.Parse(Sf.Value);
                }

                DataRow row = pollData.NewRow();
                row["ID"]          = iID;
                row["Choice"]      = sChoice;
                row["VoteCount"]   = iVoteCount;
                row["OrderNumber"] = iOrderNumber;
                pollData.Rows.Add(row);
            }
            pollData.DefaultView.Sort = " OrderNumber ASC";
            return(pollData);
        }