Esempio n. 1
0
    protected void lvNewsList_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        try
        {
            DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL();
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                Label lblnLangType = (Label)e.Item.FindControl("lblnLangType");
                if (int.Parse(lblnLangType.Text) == 1)
                {
                    lblnLangType.Text = "中文";
                }
                else if (int.Parse(lblnLangType.Text) == 2)
                {
                    lblnLangType.Text = "英文";
                }

                DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory();
                int   nType           = 0;
                Label lblnTCategoryID = (Label)e.Item.FindControl("lblnTCategoryID");
                if (int.TryParse(lblnTCategoryID.Text, out nType))
                {
                    nType = int.Parse(lblnTCategoryID.Text);
                    string sTCategoryNameCN = TopicCategory.Select_tb_TopicCategoryBynTCategoryID(nType).Rows[0]["sTCategoryNameCN"].ToString();
                    lblnTCategoryID.Text = sTCategoryNameCN;
                }
                Label lblsTitle = (Label)e.Item.FindControl("lblsTitle");
                if (lblsTitle.Text.Length > 5)
                {
                    lblsTitle.Text = lblsTitle.Text.Substring(0, 6).ToString() + "....";
                }
                Label lblsAuthor = (Label)e.Item.FindControl("lblsAuthor");
                if (lblsAuthor.Text.Length > 5)
                {
                    lblsAuthor.Text = lblsAuthor.Text.Substring(0, 6).ToString() + "....";
                }
            }
            ImageButton imgDelete = (ImageButton)e.Item.FindControl("imgDelete");
            imgDelete.OnClientClick = "javascript:if (confirm('" + option.GetOptionValue("FormatSetting", "CommandControl", "bIsDelete") + "')){$('#EntryForm').block({ message: null });}else{return false;}";
        }
        catch (Exception)
        {
        }
    }
    protected void lvTopicCategoryList_SelectedIndexChanging(object sender, ListViewSelectEventArgs e)
    {
        Label lblnID = (Label)lvTopicCategoryList.Items[e.NewSelectedIndex].FindControl("lblnTCategoryID");
        int   _nID   = 0;

        DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory();
        if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0)
        {
            MultiView1.ActiveViewIndex = 1;
            DBLL.DBcommon dbcom   = new DBLL.DBcommon();
            DataTable     Topicdt = dbcom.selectNormalTableofAll(false, "tb_Topic");
            ddlnTopicID.DataSource     = Topicdt;
            ddlnTopicID.DataValueField = "nTopicID";
            ddlnTopicID.DataTextField  = "sTopicNameCN";
            ddlnTopicID.DataBind();
            DataTable dt = TopicCategory.Select_tb_TopicCategoryBynTCategoryID(_nID);

            ddlnTopicID.SelectedValue = dt.Rows[0]["nTopicID"].ToString();
            txtsTCategoryNameCN.Text  = dt.Rows[0]["sTCategoryNameCN"].ToString();
            txtsTCategoryNameEN.Text  = dt.Rows[0]["sTCategoryNameEN"].ToString();
            rblnType.SelectedValue    = dt.Rows[0]["nType"].ToString();
            if (rblnType.SelectedValue == "1")
            {
                CKEditorControl1.Enabled = true;
                CKEditorControl2.Enabled = true;
            }
            else
            {
                CKEditorControl1.Enabled = false;
                CKEditorControl2.Enabled = false;
            }
            CKEditorControl1.Text         = dt.Rows[0]["sContentCN"].ToString();
            CKEditorControl2.Text         = dt.Rows[0]["sContentEN"].ToString();
            ddlnSorting.SelectedValue     = dt.Rows[0]["nSorting"].ToString();
            hfTopicCategoryUpdateID.Value = _nID.ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            OnSetLanguage();
            MultiView1.ActiveViewIndex = 0;
            DBLL.clsTopicCategory clsTopicCate = new DBLL.clsTopicCategory();
            int _nTCategoryID = 0;

            if (Request.QueryString["nTCategoryID"] != null && int.TryParse(Request.QueryString["nTCategoryID"], out _nTCategoryID))
            {
                DataTable dttc = clsTopicCate.Select_tb_TopicCategoryBynTCategoryID(_nTCategoryID);
                if (dttc != null && dttc.Rows.Count > 0)
                {
                    int nType = int.Parse(dttc.Rows[0]["nType"].ToString());

                    switch (nType)
                    {
                    case 1:
                    {
                        if (Session["languageGlobal"] == "en")
                        {
                            SetType1DivContent(dttc.Rows[0]["sTCategoryNameEN"].ToString(), dttc.Rows[0]["sContentEN"].ToString());
                        }
                        else
                        {
                            SetType1DivContent(dttc.Rows[0]["sTCategoryNameCN"].ToString(), dttc.Rows[0]["sContentCN"].ToString());
                        }

                        break;
                    }

                    case 2:
                    {
                        if (Session["languageGlobal"] == "en")
                        {
                            SetTyp2Ablum(dttc.Rows[0]["sTCategoryNameEN"].ToString(), _nTCategoryID);
                        }
                        else
                        {
                            SetTyp2Ablum(dttc.Rows[0]["sTCategoryNameCN"].ToString(), _nTCategoryID);
                        }

                        break;
                    }

                    case 3:
                    {
                        if (Session["languageGlobal"] == "en")
                        {
                            SetTyp3News(dttc.Rows[0]["sTCategoryNameEN"].ToString(), _nTCategoryID, 2);
                        }
                        else
                        {
                            SetTyp3News(dttc.Rows[0]["sTCategoryNameCN"].ToString(), _nTCategoryID, 1);
                        }

                        break;
                    }

                    case 4:
                    {
                        if (Session["languageGlobal"] == "en")
                        {
                            SetTyp4FAQs(dttc.Rows[0]["sTCategoryNameEN"].ToString(), _nTCategoryID);
                        }
                        else
                        {
                            SetTyp4FAQs(dttc.Rows[0]["sTCategoryNameCN"].ToString(), _nTCategoryID);
                        }

                        break;
                    }

                    default:
                        break;
                    }

                    int nFAQsID = 0;
                    if (Session["nFAQsRidectSet"] != null && int.TryParse(Session["nFAQsRidectSet"].ToString(), out nFAQsID) && nFAQsID > 0)
                    {
                        Session["nFAQsRidectSet"] = "";
                        DBLL.clsFAQs clsnews = new DBLL.clsFAQs();
                        DataTable    dtnews  = clsnews.Select_tb_FAQsBynFAQID(nFAQsID);
                        if (dtnews != null && dtnews.Rows.Count > 0)
                        {
                            if (Session["languageGlobal"] == "en")
                            {
                                lblFAQsDetailtitle.Text = dtnews.Rows[0]["sQuestionEN"].ToString();
                                lblFAQsDetailTime.Text  = dtnews.Rows[0]["dCreatedTime"].ToString();
                                divFAQsDetail.InnerHtml = dtnews.Rows[0]["sAnswerEN"].ToString();
                            }
                            else
                            {
                                lblFAQsDetailtitle.Text = dtnews.Rows[0]["sQuestionCN"].ToString();
                                lblFAQsDetailTime.Text  = dtnews.Rows[0]["dCreatedTime"].ToString();
                                divFAQsDetail.InnerHtml = dtnews.Rows[0]["sAnswerCN"].ToString();
                            }
                            PnlFAQsDetail.Visible = true;
                            lvFAQs.Visible        = false;
                        }
                    }
                }
            }
        }
    }