📄 lookquestion.aspx.cs
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
namespace Service
{
/// <summary>
/// Summary description for LookQuestion.
/// </summary>
public partial class LookQuestion : System.Web.UI.Page
{
private int nQuestionID = 0;
protected void Page_Load(object sender, System.EventArgs e)
{
if(Request.Params["QuestionID"] != null)
{
nQuestionID = Int32.Parse(Request.Params["QuestionID"].ToString());
}
if(!Page.IsPostBack)
{
if(Request.UrlReferrer != null)
{
ViewState["BackUrl"] = Request.UrlReferrer.ToString();
SubmitBtn.Text = "返回";
}
else
{
ViewState["BackUrl"] = "";
SubmitBtn.Text = "关闭窗口";
}
if(nQuestionID > 0)
{
BindAllData(nQuestionID);
}
}
}
private void BindAllData(int nQuestionID)
{
QuestionDB question = new QuestionDB();
int[] arrayID = question.GetAllID(nQuestionID);
DirectionList.Items.Clear();
ChannelList.Items.Clear();
TopicList.Items.Clear();
SubTopicList.Items.Clear();
if(arrayID[0] > 0)
{
DirectionDB direction = new DirectionDB();
SqlDataReader recd = direction.GetSingleDirection(arrayID[0]);
DirectionList.DataSource = recd;
DirectionList.DataTextField = "DirectionName";
DirectionList.DataValueField = "ID";
DirectionList.DataBind();
recd.Close();
}
if(arrayID[1] > 0)
{
ChannelDB channel = new ChannelDB();
SqlDataReader recc = channel.GetSingleChannel(arrayID[1]);
ChannelList.DataSource = recc;
ChannelList.DataTextField = "ChannelName";
ChannelList.DataValueField = "ID";
ChannelList.DataBind();
recc.Close();
}
if(arrayID[2] > 0)
{
TopicDB topic = new TopicDB();
SqlDataReader recc = topic.GetSingleTopic(arrayID[2]);
TopicList.DataSource = recc;
TopicList.DataTextField = "TopicName";
TopicList.DataValueField = "ID";
TopicList.DataBind();
recc.Close();
}
if(arrayID[3] > 0)
{
SubTopicDB subtopic = new SubTopicDB();
SqlDataReader recs = subtopic.GetSingleSubtopic(arrayID[3]);
SubTopicList.DataSource = recs;
SubTopicList.DataTextField = "SubTopicName";
SubTopicList.DataValueField = "ID";
SubTopicList.DataBind();
recs.Close();
}
SqlDataReader recq = question.GetSingleQuestion(nQuestionID);
while(recq.Read())
{
Title.Text = recq["Title"].ToString();
Body.Text = recq["Question"].ToString();
CreateTime.Text = recq["PubTime"].ToString();
if(recq["SoluteState"].ToString() == "0")
{
SoluteState.Text = "问题未处理";
SoluteState.ForeColor = Color.Red;
}
if(recq["SoluteState"].ToString() == "1")
{
SoluteState.Text = "正在处理";
SoluteState.ForeColor = Color.Blue;
}
if(recq["SoluteState"].ToString() == "2")
{
SoluteState.Text = "已经完成";
SoluteState.ForeColor = Color.Black;
}
if(recq["SoluteState"].ToString() == "3")
{
SoluteState.Text = "报修类型错误";
SoluteState.ForeColor = Color.Red;
}
if(recq["IsTypeError"].ToString() == "1")
{
IsTypeError.Checked = true;
}
else
{
IsTypeError.Checked = false;
}
}
recq.Close();
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
protected void SubmitBtn_Click(object sender, System.EventArgs e)
{
if(ViewState["BackUrl"].ToString() != "")
{
Response.Redirect(ViewState["BackUrl"].ToString());
}
else
{
Response.Write("<script>window.close();</script>");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -