⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 system_work_sumup11_edit1.aspx.cs

📁 ASP.NET的一些开发实例,有论坛管理系统等
💻 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;

namespace BDStudioBase.syssoft
{
	/// <summary>
	/// system_work_sumup11_edit1 的摘要说明。
	/// </summary>
	public class system_work_sumup11_edit1 :FormBase
	{
		protected System.Web.UI.WebControls.Label Label02;
		protected System.Web.UI.WebControls.Label Out_Label1;
		protected System.Web.UI.WebControls.TextBox In_TextBox1;
		protected System.Web.UI.WebControls.Label Out_Label2;
		protected System.Web.UI.WebControls.TextBox In_TextBox2;
		protected System.Web.UI.WebControls.Label Out_Label3;
		protected System.Web.UI.WebControls.Label Out_Label5;
		protected System.Web.UI.WebControls.Label Out_Label6;
		protected System.Web.UI.WebControls.Label labMessage1;
		protected System.Web.UI.WebControls.ImageButton cbReturn;
		protected System.Web.UI.WebControls.ImageButton cbSaveSearch;
		protected System.Web.UI.WebControls.ImageButton cbSaveRun;
		protected System.Web.UI.WebControls.ImageButton cbSaveReturn;
		protected System.Web.UI.WebControls.TextBox In_TextBox4;
		protected System.Web.UI.WebControls.TextBox In_TextBox5;
		protected System.Web.UI.WebControls.TextBox C_TextBox3;
		protected System.Web.UI.WebControls.TextBox In_TextBox3;
				
		string[] sFieldName={"work_num","w_date","start_emp","work_topic","work_note"};
		protected COM_SystemWorkPlan COM_SystemWorkPlan=new COM_SystemWorkPlan();
		protected COM_NumToChina COM_NumToChina=new COM_NumToChina();
	    private string as_type="";

	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			this.o_str_DisplayFile1="system_work_sumup11_display1.aspx";
			this.o_str_FormUrl="system_work_sumup11.aspx"; 
			this.o_str_FormName = "system_work_sumup11_edit1";
			this.o_str_Pk1 = "work_num";
			string strPKValue=string.Empty;

			if(!Page.IsPostBack)
			{
				if (this.Param_check(this.o_str_FormName)==1)//该页是否需要接收值
				{
					strPKValue=this.Param_get("work_num");
					this.as_type=this.Param_get("as_type");
				}
			
				DataFill(strPKValue,"0"); 
			}
		}

		#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.cbSaveReturn.Click += new System.Web.UI.ImageClickEventHandler(this.cbSaveReturn_Click);
			this.cbSaveRun.Click += new System.Web.UI.ImageClickEventHandler(this.cbSaveRun_Click);
			this.cbSaveSearch.Click += new System.Web.UI.ImageClickEventHandler(this.cbSaveSearch_Click);
			this.cbReturn.Click += new System.Web.UI.ImageClickEventHandler(this.cbReturn_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void DataFill(string s_pk,string SearchType)
		{
			string sReturn = string.Empty;
			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();
					this.In_TextBox4.Text=row[9].ToString();
					this.In_TextBox5.Text=row[10].ToString();
					this.C_TextBox3.Text=this.COM_NumToChina.GetAccountEmp(this.In_TextBox3.Text);
											
				}	
			
			}
			if (sReturn == "没有下一条!")
			{
				this.labMessage1.Text = sReturn;
				this.labMessage1.Visible=true;
			}
		}

		private void DataSave(string InsertType)
		{
			DataSet dsData=new DataSet();
			DataTable dtData=new DataTable();
			DataRow dr;
			for(int i=0;i<sFieldName.Length;i++)
			{
				dtData.Columns.Add(new DataColumn(sFieldName[i],typeof(string)));
			}
			string ls_id;
			int    li_start,li_count;
			dr=dtData.NewRow();
			foreach (System.Web.UI.Control con in this.Controls[1].Controls)
			{
				ls_id=con.ID;
				if (ls_id==null) continue;
				li_start=ls_id.IndexOf("In_TextBox");                   
				if (li_start>=0)//如果是字段标题
				{
					li_count=int.Parse(ls_id.Substring(10));
					if (con.GetType().ToString()== "System.Web.UI.WebControls.TextBox")
					{
						dr[sFieldName[li_count -1]]=((System.Web.UI.WebControls.TextBox)con).Text;
					}
				}
			}
			dtData.Rows.Add(dr);
			dsData.Tables.Add(dtData);
			//DataGrid1.DataSource=dsData;
			//DataGrid1.DataBind();
			string sReturn = string.Empty;
			this.COM_SystemWorkPlan.EditData(dsData,InsertType,ref sReturn);
			this.labMessage1.Text = sReturn;
			this.labMessage1.Visible=true;
		}

		private void ImageButton1_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			Response.Redirect("../forums/forums_main_public.aspx");
		}

		private void cbReturn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			this.ReturnToParent(this.o_str_FormName);
		}

		private void cbSaveSearch_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			this.DataSave("2");
			this.Param_Open("system_work_sumup11_display1");
			this.Param_set(this.o_str_Pk1,this.In_TextBox1.Text);
			this.Param_set("as_type",this.as_type);
			this.Param_set("as_sendid","W");
			this.CreatUserLogParentWindow("system_work_sumup11_display1",this.o_str_FormUrl);//建立子窗口的父窗口数据值
			Response.Redirect(this.o_str_DisplayFile1);
		}

		private void cbSaveRun_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			this.DataSave("1");
			DataFill(this.In_TextBox1.Text,"2");	
		}

		private void cbSaveReturn_Click(object sender, System.Web.UI.ImageClickEventArgs e)
		{
			this.DataSave("0");
			if (this.labMessage1.Text == "修改成功")
			{
				this.ReturnToParent(this.o_str_FormName);
			}
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -