system_work_plan11_display1.aspx.cs
来自「ASP.NET的一些开发实例,有论坛管理系统等」· CS 代码 · 共 326 行
CS
326 行
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.Text;
namespace BDStudioBase.syssoft
{
/// <summary>
/// system_work_plan11_display1 的摘要说明。
/// </summary>
public class system_work_plan11_display1 : FormBase
{
protected System.Web.UI.WebControls.Label Label02;
protected System.Web.UI.WebControls.Label Out_Label1;
protected System.Web.UI.WebControls.Label Out_Label2;
protected System.Web.UI.WebControls.Label Out_Label3;
protected System.Web.UI.WebControls.Label In_TextBox1;
protected System.Web.UI.WebControls.Label In_TextBox2;
protected System.Web.UI.WebControls.Label In_TextBox3;
protected System.Web.UI.WebControls.LinkButton cbAdd;
protected System.Web.UI.WebControls.LinkButton cbEdit;
protected System.Web.UI.WebControls.LinkButton cbDelete;
protected System.Web.UI.WebControls.LinkButton cbReturn;
protected System.Web.UI.WebControls.LinkButton linkbPrev1;
protected System.Web.UI.WebControls.Label labPage1;
protected System.Web.UI.WebControls.LinkButton linkbNext1;
protected System.Web.UI.WebControls.Label labMessage1;
protected System.Web.UI.WebControls.Label Out_Label4;
protected System.Web.UI.WebControls.Label Out_Label5;
protected System.Web.UI.WebControls.Label Out_Label6;
protected System.Web.UI.WebControls.Label In_TextBox4;
protected System.Web.UI.WebControls.Label In_TextBox5;
protected System.Web.UI.WebControls.Label In_TextBox6;
protected System.Web.UI.WebControls.Label In_TextBox7;
protected System.Web.UI.WebControls.Label Out_Label8;
protected System.Web.UI.WebControls.Label Out_Label7;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Table tableSysDd;
protected System.Web.UI.WebControls.Label Label_msg;
protected System.Web.UI.WebControls.LinkButton Link_yes;
protected System.Web.UI.WebControls.LinkButton Link_no;
protected System.Web.UI.WebControls.Label In_TextBox8;
protected System.Web.UI.WebControls.Panel PL1;
protected System.Web.UI.WebControls.Label labCurrentRow;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.ImageButton ImageButton1;
protected COM_SystemWorkPlan COM_SystemWorkPlan=new COM_SystemWorkPlan();
protected COM_WorkPlanReply COM_WorkPlanReply=new COM_WorkPlanReply();
protected COM_NumToChina COM_NumToChina=new COM_NumToChina();
string sReturn=string.Empty;
private string sUserName="";
private string as_type="";
public string as_note="";
string[] str_FieldValue=new string[3];
private int i_RowCount=0;
private int i_CurrentRow=0;
private string sReceiveId="";
private string[] arr_ReceiveId;
private void Page_Load(object sender, System.EventArgs e)
{
sUserName=(string)Session["userid"];
// 在此处放置用户代码以初始化页面
this.o_str_InputFile1="system_work_plan11_input1.aspx";
this.o_str_ModifyFile1="system_work_plan11_edit1.aspx";
this.o_str_FormUrl="system_work_plan11.aspx";
this.o_str_FormName = "system_work_plan11_display1";
if (this.Param_check(this.o_str_FormName)==1)
{
this.o_str_Pk1=this.Param_get("work_num");
this.as_type=this.Param_get("as_type");
this.sReceiveId=this.Param_get("as_sendid");
}
if(this.sReceiveId=="W")
{
this.linkbPrev1.Visible=false;
this.linkbNext1.Visible=false;
this.labPage1.Visible=false;
}
else
{
arr_ReceiveId=this.sReceiveId.Split(new char[]{','});
i_RowCount=arr_ReceiveId.Length;
}
WhereInit();
if(!Page.IsPostBack)
{
if(this.sReceiveId!="W")
{
i_CurrentRow=this.COMGfunction.GetNumFromArray(this.o_str_Pk1,arr_ReceiveId)+1;
this.labCurrentRow.Text=i_CurrentRow.ToString();
}
this.COM_SystemWorkPlan.EditViewEmp(this.o_str_Pk1,Session["userid"].ToString());
this.COM_WorkPlanReply.EditViewEmp(this.o_str_Pk1,Session["userid"].ToString());
DataFill(this.o_str_Pk1,"0");
this.PageLabelShow(ref this.labPage1);
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.ImageButton1.Click += new System.Web.UI.ImageClickEventHandler(this.ImageButton1_Click);
this.cbAdd.Click += new System.EventHandler(this.cbAdd_Click);
this.cbEdit.Click += new System.EventHandler(this.cbEdit_Click);
this.cbDelete.Click += new System.EventHandler(this.cbDelete_Click);
this.cbReturn.Click += new System.EventHandler(this.cbReturn_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DataFill(string s_pk,string SearchType)
{
if(s_pk !="")
{
string[] str_FieldValue = {s_pk};
DataSet dsData=this.COM_SystemWorkPlan.DsSelectSingleData(str_FieldValue,SearchType,ref sReturn);
foreach(DataRow row in dsData.Tables[0].Rows)
{
this.In_TextBox1.Text=row[0].ToString();
this.In_TextBox2.Text=row[1].ToString();
//this.In_TextBox3.Text=row[3].ToString();
string str=row[3].ToString();
//str=str.Substring(1,str.Length-2);
this.In_TextBox3.Text=COM_NumToChina.GetAccountEmp(str);
this.In_TextBox4.Text=row[5].ToString();
this.In_TextBox5.Text=row[6].ToString();
//this.In_TextBox6.Text=row[4].ToString();
str=row[4].ToString();
str=str.Substring(1,str.Length-2);
this.In_TextBox6.Text=COM_NumToChina.GetAccountEmp(str);
this.In_TextBox7.Text=row[9].ToString();
this.In_TextBox8.Text="<br> "+row[10].ToString().Replace("\n","<br> ")+"<p>";
TableInit();
}
}
}
private void TableInit()
{
TableRow tRow;
TableCell tCell;
//填充数据
DataSet ds=this.COM_SystemWorkPlan.DsMainReplyForAll(this.In_TextBox1.Text);
if(ds.Tables.Count>0)
{
foreach(DataRow row in ds.Tables[0].Rows)
{
for(int j=0;j<=1;j++)
{
tRow=new TableRow();
tRow.CssClass="dbtable_data4";
if(j==0)
{
tCell=new TableCell();
tCell.RowSpan=2;
tCell.Width=new Unit(50);
tCell.CssClass="txt_box1";
tCell.Text="<br> "+row["start_emp"].ToString().Replace("\n","<br> ");
tRow.Cells.Add(tCell);
tCell=new TableCell();
System.Web.UI.WebControls.Label LB1=new System.Web.UI.WebControls.Label();
LB1.CssClass="txt_box2";
LB1.Text="<br> "+"主题:";
tCell.Controls.Add(LB1);
System.Web.UI.WebControls.Label LB2=new System.Web.UI.WebControls.Label();
LB2.CssClass="txt_box1";
LB2.Text=row["replay_title"].ToString();
tCell.Controls.Add(LB2);
System.Web.UI.WebControls.Label LB3=new System.Web.UI.WebControls.Label();
LB3.CssClass="txt_box2";
LB3.Text=" "+"回复时间:";
tCell.Controls.Add(LB3);
System.Web.UI.WebControls.Label LB4=new System.Web.UI.WebControls.Label();
LB4.CssClass="txt_box1";
LB4.Text=row["w_date"].ToString();
tCell.Controls.Add(LB4);
// string str="<br> "+ds.Tables[0].Rows[0]["t_message"].ToString().Replace("\n","<br> ");
// StrReplace(ref str);
// tCell.Text=str;
tRow.Cells.Add(tCell);
this.tableSysDd.Rows.Add(tRow);
}
if(j==1)
{
tCell = new TableCell();
tCell.Width=new Unit(922);
tCell.Text="<br> "+row["replay_note"].ToString().Replace("\n","<br> ")+"<br>"+"<br>";
tRow.Cells.Add(tCell);
this.tableSysDd.Rows.Add(tRow);
}
}
}
}
}
private void WhereInit()
{
if(as_type=="1")
{
str_FieldValue[0]="01";
str_FieldValue[1]=sUserName;
str_FieldValue[2]="";
}
else
{
str_FieldValue[0]="01";
str_FieldValue[1]="";
str_FieldValue[2]=sUserName;
}
}
protected void PagerButtonClick(object sender, System.EventArgs e)
{
i_CurrentRow=Int32.Parse(this.labCurrentRow.Text);
string arg=((LinkButton)sender).CommandArgument;
switch(arg)
{
case("prev"):
i_CurrentRow--;
this.PageLabelShow(ref this.labPage1);
this.DataFill(arr_ReceiveId[i_CurrentRow-1],"0");
break;
case("next"):
i_CurrentRow++;
this.PageLabelShow(ref this.labPage1);
this.DataFill(arr_ReceiveId[i_CurrentRow-1],"0");
break;
}
this.labCurrentRow.Text=i_CurrentRow.ToString();
}
protected void PageLabelShow(ref Label l_lab_Page)
{
if(i_CurrentRow<=0)
{
i_CurrentRow=1;
}
else
{
if(i_CurrentRow>=i_RowCount)
{
i_CurrentRow=i_RowCount;
}
}
l_lab_Page.Text="第"+i_CurrentRow.ToString()+"条/共"+i_RowCount.ToString()+"条";
}
private void cbAdd_Click(object sender, System.EventArgs e)
{
this.CreatUserLogParentWindow("system_work_plan11_input1",this.o_str_FormUrl);//建立子窗口的父窗口数据值
Response.Redirect(this.o_str_InputFile1);
}
private void cbEdit_Click(object sender, System.EventArgs e)
{
this.Param_Open("system_work_plan11_edit1");
this.Param_set("work_num",this.In_TextBox1.Text);
this.CreatUserLogParentWindow("system_work_plan11_edit1",this.o_str_FormUrl);//建立子窗口的父窗口数据值
Response.Redirect(this.o_str_ModifyFile1);
}
private void cbDelete_Click(object sender, System.EventArgs e)
{
string strSql = string.Format("schema_num = '{0}'",this.In_TextBox1.Text);
string sReturn1 = string.Empty;
this.COM_SystemWorkPlan.DeleteData(strSql,ref sReturn1);
if(sReturn1=="删除成功")
{
if (sReturn == "没有下一条!")
{
this.ReturnToParent(this.o_str_FormName);
}
this.DataFill(this.In_TextBox1.Text,"2");
}
this.labMessage1.Text=sReturn1;
this.labMessage1.Visible=true;
}
private void cbReturn_Click(object sender, System.EventArgs e)
{
this.ReturnToParent(this.o_str_FormName);
}
private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
Response.Redirect("../forums/forums_main_public.aspx");
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?