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.clsTopic Topic = new DBLL.clsTopic(); bool _Result = Topic.update_tb_TopicBynTopicID(int.Parse(hfTopicUpdateID.Value), txtsTopicNameCN.Text, txtsTopicNameEN.Text, Session["user"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue)); if (_Result == true) { //ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateSuccess"); //ShowMsg1.Show(); } else { //失败就一条 //ShowMsg1.InnerContent = option.GetOptionValue("FormatSetting", "CommandControl", "UpdateFail"); //ShowMsg1.Show(); } } } catch (Exception) { throw; } }
protected void lvTopicCategoryList_ItemDataBound(object sender, ListViewItemEventArgs e) { try { DBLL.OptionSysDBLL option = new DBLL.OptionSysDBLL(); if (e.Item.ItemType == ListViewItemType.DataItem) { DBLL.clsTopic Topic = new DBLL.clsTopic(); int nType = 0; Label lblnTopicID = (Label)e.Item.FindControl("lblnTopicID"); if (int.TryParse(lblnTopicID.Text, out nType)) { nType = int.Parse(lblnTopicID.Text); string sTopicName = Topic.Select_tb_TopicBynTopicID(nType).Rows[0]["sTopicNameCN"].ToString(); lblnTopicID.Text = sTopicName; } Label lblsTCategoryNameCN = (Label)e.Item.FindControl("lblsTCategoryNameCN"); if (lblsTCategoryNameCN.Text.Length > 5) { lblsTCategoryNameCN.Text = lblsTCategoryNameCN.Text.Substring(0, 5).ToString() + "...."; } Label lblsTCategoryNameEN = (Label)e.Item.FindControl("lblsTCategoryNameEN"); if (lblsTCategoryNameEN.Text.Length > 6) { lblsTCategoryNameEN.Text = lblsTCategoryNameEN.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 lvTopicList_SelectedIndexChanging(object sender, ListViewSelectEventArgs e) { Label lblnID = (Label)lvTopicList.Items[e.NewSelectedIndex].FindControl("lblnTopicID"); int _nID = 0; DBLL.clsTopic Topic = new DBLL.clsTopic(); if (int.TryParse(lblnID.Text.Trim(), out _nID) && _nID > 0) { MultiView1.ActiveViewIndex = 1; DataTable dt = Topic.Select_tb_TopicBynTopicID(_nID); txtsTopicNameCN.Text = dt.Rows[0]["sTopicNameCN"].ToString(); txtsTopicNameEN.Text = dt.Rows[0]["sTopicNameEN"].ToString(); ddlnSorting.SelectedValue = dt.Rows[0]["nSorting"].ToString(); hfTopicUpdateID.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.clsTopic Topic = new DBLL.clsTopic(); int _Result = Topic.insert_tb_Topic(txtsTopicNameCN.Text, txtsTopicNameEN.Text, Session["User"].ToString(), DateTime.Now, Session["User"].ToString(), DateTime.Now, true, int.Parse(ddlnSorting.SelectedValue)); if (_Result > 0) { Clear(); } else { } } else { } }