📄 topic_add.aspx.cs
字号:
//======================================================
//== (c)2008 aspxcms inc by NeTCMS v1.0 ==
//== Forum:bbs.aspxcms.com ==
//== Website:www.aspxcms.com ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;
using NetCMS.Content.Common;
using NetCMS.Model;
public partial class manage_survey_Topic_Add : NetCMS.Web.UI.ManagePage
{
Survey sur = new Survey();
protected void Page_Load(object sender, EventArgs e)
{
#region 初始代码
Response.CacheControl = "no-cache"; //清除缓存
if (!IsPostBack) //判断页面是否重载
{
//判断用户是否登录
copyright.InnerHtml = CopyRight; //获取版权信息
if (SiteID == "0")
{
param_id.InnerHtml = "<a href=\"setParam.aspx\" class=\"list_link\">系统参数设置</a> ┊ ";
}
DataTable dt = sur.sel_voteInfo(3);
this.DdlClass.DataTextField = "ClassName";
this.DdlClass.DataValueField = "VID";
this.DdlClass.DataSource = dt;
this.DdlClass.DataBind();
this.LtrCaption.Text = "新增";
this.HidTID.Value = "0";
this.RadFillinNo.Checked = true;
this.RadFillinYes.Checked = false;
if (Request.QueryString["tid"] != null && Request.QueryString["tid"] != string.Empty)
{
int tid = int.Parse(Request.QueryString["tid"]);
this.LtrCaption.Text = "修改";
this.HidTID.Value = tid.ToString();
BindData(tid);
}
}
#endregion
}
void BindData(int TID)
{
VoteTopicInfo info = sur.GetTopic(TID);
{
this.DdlClass.SelectedValue = info.VID.ToString();
this.TxtCaption.Text = info.Title;
this.DdlType.SelectedValue = info.Type.ToString();
this.DdlDisModel.SelectedValue = info.DisMode.ToString();
this.TxtStarttime.Text = info.StartDate.ToShortDateString();
this.TxtEndtime.Text = info.EndDate.ToShortDateString();
this.DdlSortStyle.SelectedValue = info.ItemMode.ToString();
this.DdlSeries.SelectedValue = info.SeriesMode.ToString();
if (info.AllowFillIn)
{
this.RadFillinYes.Checked = true;
this.RadFillinNo.Checked = false;
}
}
}
protected void BtnSave_ServerClick(object sender, EventArgs e)
{
if (Page.IsValid)//判断页面是否通过验证
{
int TID = int.Parse(this.HidTID.Value);
//取得修改中的表单信息
VoteTopicInfo info = new VoteTopicInfo();
info.TID = TID;
info.VID = int.Parse(this.DdlClass.SelectedValue);
info.Title = this.TxtCaption.Text.Trim();
info.Type = byte.Parse(this.DdlType.SelectedValue);
info.SeriesMode = byte.Parse(this.DdlSeries.SelectedValue);
info.DisMode = byte.Parse(this.DdlDisModel.SelectedValue);
info.StartDate = DateTime.Parse(this.TxtStarttime.Text);
info.EndDate = DateTime.Parse(this.TxtEndtime.Text);
info.ItemMode = byte.Parse(this.DdlSortStyle.SelectedValue);
if (RadFillinYes.Checked)
info.AllowFillIn = true;
else
info.AllowFillIn = false;
info.SiteID = NetCMS.Global.Current.SiteID;
int n = sur.EditTopic(info);
//刷新页面
if (n > 0)
{
rootPublic rp = new rootPublic();
string s = "新增";
if (info.TID > 0)
s = "修改";
rp.SaveUserAdminLogs(1, 1, UserNum, "问卷调查系统" + s + "主题", s + "成功");
PageRight(s + "成功", "VoteTopic.aspx");
}
else
{
PageError("意外错误:未知错误,可能是没找到记录", "VoteTopic.aspx");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -