📄 taskallinfo.aspx.cs
字号:
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 System.Data.SqlClient;
public partial class Module_ProRes_TaskAllInfo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["UserName"] != null)
{
if (Session["Popedom"].ToString() == "0")
{
this.Panel1.Visible = true;
}
}
else
{
Response.Write("<script language=javascript>top.location.href='../../Index.aspx'</script>");
}
SqlData da = new SqlData();
if (!IsPostBack)
{
string cmdtxt1 = "select Distinct Name from tb_User";
string cmdtxt2 = "select Distinct DepName from tb_Department";
SqlCommand Com1 = new SqlCommand(cmdtxt1, da.ExceCon());
SqlDataReader dr1 = Com1.ExecuteReader();
while (dr1.Read())
{
this.dropRePro.Items.Add(dr1["Name"].ToString());
}
dr1.Close();
SqlCommand Com2 = new SqlCommand(cmdtxt2, da.ExceCon());
SqlDataReader dr2 = Com2.ExecuteReader();
while (dr2.Read())
{
this.dropAcceptPro.Items.Add(dr2["DepName"].ToString());
}
dr2.Close();
string str = Request["ID"].ToString();
string cmdtxt3 = "select * from tb_DepTask where ID='" + str + "'";
SqlCommand Com3 = new SqlCommand(cmdtxt3, da.ExceCon());
SqlDataReader dr3 = Com3.ExecuteReader();
dr3.Read();
if (dr3.HasRows)
{
this.txtComPitch.Text = dr3["CompletePitch"].ToString();
this.txtAcceptPro.Text = dr3["DepName"].ToString();
this.txtDescription.Text = dr3["TaskDescription"].ToString();
this.txtEndTime.Text = Convert.ToDateTime(dr3["EndTime"]).ToString("yyyy-MM-dd");
this.txtReleaseTime.Text = Convert.ToDateTime(dr3["ReleaseTime"]).ToString("yyyy-MM-dd");
this.txtRePro.Text = dr3["ReleasePerson"].ToString();
this.txtStartTime.Text = Convert.ToDateTime(dr3["StartTime"]).ToString("yyyy-MM-dd");
this.dropImport.SelectedValue = dr3["IsMain"].ToString();
}
dr3.Close();
}
}
protected void btnOK_Click(object sender, EventArgs e)
{
this.Panel2.Visible = false;
this.Panel3.Visible = true;
this.Panel4.Visible = false;
this.Panel5.Visible = true;
this.txtAcceptPro.ReadOnly = false;
this.txtComPitch.ReadOnly = false;
this.txtDescription.ReadOnly = false;
this.txtEndTime.ReadOnly = false;
this.txtReleaseTime.ReadOnly = false;
this.txtRePro.ReadOnly = false;
this.txtStartTime.ReadOnly = false;
this.btnDelete.Enabled = true;
this.btnSave.Enabled = true;
}
protected void btnDelete_Click(object sender, EventArgs e)
{
string cmdtxt = "DELETE FROM tb_DepTask where ID='" + Request["ID"].ToString() + "'";
SqlData da = new SqlData();
if (da.ExceSQL(cmdtxt))
{
Response.Write("<script language=javascript>alert('操作成功!');location='Task.aspx'</script>");
}
else
{
Response.Write("<script language=javascript>alert('操作失败!')</script>");
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
string cmdtxt = "UPDATE tb_DepTask SET TaskDescription='" + this.txtDescription.Text + "',DepName='"+this.dropAcceptPro.SelectedValue+"'";
cmdtxt += ",StartTime='"+this.txtStartTime.Text+"',EndTime='"+this.txtEndTime.Text+"',IsMain='"+this.dropImport.SelectedValue+"'";
cmdtxt += ",CompletePitch='"+this.txtComPitch.Text+"' where ID='"+Request["ID"].ToString()+"'";
SqlData da = new SqlData();
if (da.ExceSQL(cmdtxt))
{
Response.Write("<script language=javascript>alert('操作成功!');location='Task.aspx'</script>");
}
else
{
Response.Write("<script language=javascript>alert('操作失败!');location='TaskAllInfo.aspx'</script>");
}
}
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Write("<script>this.parent.rightFrame.location='Task.aspx'</script>");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -