protected void BtnUpdate_Click(object sender, EventArgs e) { //判断session if (Session["User"] == null || Session["User"].ToString().Length < 1) { Response.Redirect(Request.RawUrl); } try { if (ValiEdit()) { DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory(); DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); bool _Result = TopicCategory.update_tb_TopicCategoryBynTCategoryID(int.Parse(hfTopicCategoryUpdateID.Value), int.Parse(ddlnTopicID.SelectedValue), txtsTCategoryNameCN.Text, txtsTCategoryNameEN.Text, int.Parse(rblnType.SelectedValue), CKEditorControl1.Text, CKEditorControl2.Text, Session["user"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue)); if (_Result == true) { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess"); ShowMsg1.Show(); MultiView1.ActiveViewIndex = 0; ReBindPageList(); } else { //失败就一条 ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail"); ShowMsg1.Show(); } } } catch (Exception) { throw; } }
public void ReBindPageList() { DBLL.DBcommon dbcom = new DBLL.DBcommon(); DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory(); DataTable TopicCategorydt = TopicCategory.sp_selectNormalTableOfAllByTopicCategoryAndnType(false, 2); ddlnTCategoryID.DataSource = TopicCategorydt; ddlnTCategoryID.DataValueField = "nTCategoryID"; ddlnTCategoryID.DataTextField = "sTCategoryNameCN"; ddlnTCategoryID.DataBind(); AlbumList.Clear(); DBLL.clsAlbum Album = new DBLL.clsAlbum(); DataTable dt = new DataTable(); dt = Album.sp_selectNormalTableOfAllByAlbum(false, int.Parse(ddlnTCategoryID.SelectedValue)); if (dt != null) { AlbumList.Merge(dt); lvAlbumList.DataSource = AlbumList; lvAlbumList.DataBind(); } else { lvAlbumList.DataSource = null; lvAlbumList.DataBind(); } }
public void SetTyp2Ablum(string sName, int nTCID) { MultiView1.ActiveViewIndex = 1; lblBigTitle.Text = sName; DBLL.clsTopicCategory clstc = new DBLL.clsTopicCategory(); DBLL.clsAlbum clsa = new DBLL.clsAlbum(); dlAlbum.DataSource = clsa.Select_tb_AlbumBynTCategoryID(nTCID); dlAlbum.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DBLL.DBcommon dbcom = new DBLL.DBcommon(); DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory(); DataTable TopicCategorydt = TopicCategory.sp_selectNormalTableOfAllByTopicCategoryAndnType(false, 3); ddlnTCategoryID.DataSource = TopicCategorydt; ddlnTCategoryID.DataValueField = "nTCategoryID"; ddlnTCategoryID.DataTextField = "sTCategoryNameCN"; ddlnTCategoryID.DataBind(); } }
public void ReBindPageList() { DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory(); DataTable dt = new DataTable(); dt = TopicCategory.sp_selectNormalTableOfAllByTopicCategory(false); if (dt != null) { TopicCategoryList.Merge(dt); lvTopicCategoryList.DataSource = TopicCategoryList; lvTopicCategoryList.DataBind(); } else { lvTopicCategoryList.DataSource = null; lvTopicCategoryList.DataBind(); } }
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 BtnAdd_Click(object sender, EventArgs e) { //判断session if (Session["User"] == null || Session["User"].ToString().Length < 1) { Response.Redirect(Request.RawUrl); } if (ValiAdd()) { DBLL.clsTopicCategory TopicCategory = new DBLL.clsTopicCategory(); DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); int _Result = 0; if (rblnType.SelectedValue == "1") { _Result = TopicCategory.insert_tb_TopicCategory(int.Parse(ddlnTopicID.SelectedValue), txtsTCategoryNameCN.Text, txtsTCategoryNameEN.Text, int.Parse(ddlnTopicID.SelectedValue), CKEditorControl1.Text, CKEditorControl2.Text, Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue)); } else { _Result = TopicCategory.insert_tb_TopicCategory(int.Parse(ddlnTopicID.SelectedValue), txtsTCategoryNameCN.Text, txtsTCategoryNameEN.Text, int.Parse(ddlnTopicID.SelectedValue), "", "", Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue)); } if (_Result > 0) { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertSuccess"); ShowMsg1.Show(); Clear(); } else { ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "InsertFail"); ShowMsg1.Show(); } } else { ShowMsg1.Show(); } }
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; } } } } } }