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

📄 viewgatheringmethod.aspx.cs

📁 MIS系统开发与应用配套的源代码
💻 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;
using MisSale.Components;

namespace MisSale.DesktopModules.GatheringMethod
{
	/// <summary>
	/// ViewGatheringMethod 的摘要说明。
	/// </summary>
	public class ViewGatheringMethod : System.Web.UI.Page
	{
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.DropDownList SaleOrderList;
		protected System.Web.UI.WebControls.Label Label3;
		protected System.Web.UI.WebControls.DropDownList TypeList;
		protected System.Web.UI.WebControls.Label Label4;
		protected System.Web.UI.WebControls.DropDownList StatusList;
		protected System.Web.UI.WebControls.Label lblAdditionalNo;
		protected System.Web.UI.WebControls.TextBox GatheringSum;
		protected System.Web.UI.WebControls.Label Label5;
		protected System.Web.UI.WebControls.TextBox PubDate;
		protected System.Web.UI.WebControls.Label Label6;
		protected System.Web.UI.WebControls.TextBox Remark;
		protected System.Web.UI.WebControls.Button ReturnBtn;
	
		private int nGatheringMethodID = -1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			///判断用户是否登陆
			if(Session["UserID"] == null)
			{
				Response.Redirect("~/Default.aspx");
			}
			///判断用户是否是超级管理员
			if(Components.User.IsAuthorityAdmin(Session["UserID"].ToString()) >= Components.User.USERTYPENORMAL)
			{
				Response.Write("<script>alert(\"你没有权限,请与管理员联系!\")</script>");
				Response.Write("<script>history.back();</script>");
			}			
			if(Request.Params["GatheringMethodID"] != null)
			{
				nGatheringMethodID = Int32.Parse(Request.Params["GatheringMethodID"].ToString());
			}
			if(!Page.IsPostBack)
			{
				///绑定控件的数据
				BindSaleOrderData();
				BindTypeData();

				if(nGatheringMethodID > -1)
				{
					///显示信息
					BindGatheringMethodData(nGatheringMethodID);
				}
			}	
		}

		private void BindSaleOrderData()
		{
			///定义获取数据的类
			MisSale.Components.SaleOrder order = new MisSale.Components.SaleOrder();
			SqlDataReader reco = order.GetSaleOrders();

			///设定控件的数据源
			SaleOrderList.DataSource = reco;
			
			///设定控件的Text属性和Value属性
			SaleOrderList.DataTextField = "SaleOrderID";
			SaleOrderList.DataValueField = "SaleOrderID";

			///绑定控件的数据
			SaleOrderList.DataBind();

			///关闭数据读取器和数据库的连接
			reco.Close();
		}

		private void BindTypeData()
		{
			///定义获取数据的类
			MisSale.Components.Type type = new MisSale.Components.Type();
			SqlDataReader rect = type.GetTypes(Int32.Parse(MisSystem.TYPEFLAG));

			///设定控件的数据源
			TypeList.DataSource = rect;
			
			///设定控件的Text属性和Value属性
			TypeList.DataTextField = "Name";
			TypeList.DataValueField = "TypeID";

			///绑定控件的数据
			TypeList.DataBind();

			///关闭数据读取器和数据库的连接
			rect.Close();
		}

		private void BindGatheringMethodData(int nGatheringMethodID)
		{
			///定义获取数据的类
			MisSale.Components.GatheringMethod gathering = new MisSale.Components.GatheringMethod();
			SqlDataReader recg = gathering.GetSingleGatheringMethod(nGatheringMethodID);

			///从获取的数据中读取数据
			if(recg.Read())
			{				
				GatheringSum.Text  = recg["GatheringSum"].ToString();
				PubDate.Text = Convert.ToDateTime(recg["PubDate"].ToString()).ToShortDateString();
				Remark.Text   = recg["Remark"].ToString();

				///设置列表控件的数据
				MisSystem.SetListBoxItem(SaleOrderList,recg["SaleOrderID"].ToString());
				MisSystem.SetListBoxItem(TypeList,recg["TypeID"].ToString());
				MisSystem.SetListBoxItem(StatusList,recg["TypeFlag"].ToString());
				
			}
			///关闭数据读取器和数据库的连接
			recg.Close();
		}

		#region Web 窗体设计器生成的代码
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{    
			this.ReturnBtn.Click += new System.EventHandler(this.ReturnBtn_Click);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void ReturnBtn_Click(object sender, System.EventArgs e)
		{
			///跳转到管理页面
			Response.Redirect("~/DesktopModules/GatheringMethod/GatheringMethodManage.aspx");
		}
	}
}

⌨️ 快捷键说明

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