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

📄 productinoutsearch.aspx.cs

📁 可供共享学习.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;
using Botheighten.Yanghui.BusinessFacade;
using Botheighten.Yanghui.Framework;
using Botheighten.Yanghui.BusinessRules;
using Botheighten.Yanghui.Web.Controls;

namespace Botheighten.Yanghui.Web
{
	/// <summary>
	/// ProductInOutSearch 的摘要说明。
	/// </summary>
	public class ProductInOutSearch : BasePage
	{
		protected System.Web.UI.WebControls.Label lblTitle;
		protected System.Web.UI.WebControls.Label lblTransType;
		protected System.Web.UI.WebControls.DropDownList ddlTransType;
		protected System.Web.UI.WebControls.Label lblReference;
		protected System.Web.UI.WebControls.TextBox txtReference;
		protected System.Web.UI.WebControls.Label Label1;
		protected System.Web.UI.WebControls.DropDownList txtLastUpdate;
		protected System.Web.UI.WebControls.Label lblCustom;
		protected System.Web.UI.WebControls.DropDownList ddlCustom;
		protected System.Web.UI.WebControls.DropDownList ddlUser;
		protected System.Web.UI.WebControls.Button btnSearch;
		protected System.Web.UI.WebControls.Label lblMessage;
		protected System.Web.UI.WebControls.TextBox txtProductCode;
		protected System.Web.UI.WebControls.DataGrid grid;
	
		protected DateBegToEnd DateBegToEnd1;
	
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			Principal p=this.CurrentUser();
			this.CheckPermissionPage(p.Id,"","705");
			this.lblMessage.Visible=false;
			if(!Page.IsPostBack)
			{

				//this.lblCompanyName.Text = Application["CompanyInfo"].ToString();
				this.grid.PageSize=int.Parse(Application["PageSize"].ToString());

				DataTable dt=ProductTransType.GetProductTransType();
				Common.BindDrop(this.ddlTransType,dt,"Name","Code","所有","");

				DataTable dtCustom=CustomSystem.AllCustom("Y");
				Common.BindDrop(this.ddlCustom,dtCustom,Custom.CODE,Custom.ID,"所有","");

				TransTypeChanged();
				DataTable dtUser=LoginSystem.AllUser("","","","Y");
				Common.BindDrop(this.ddlUser,dtUser,BusinessRules.User.ID,BusinessRules.User.ID,"所有","");

				this.BindGrid();
			}
		}

		private void TransTypeChanged()
		{
			string transType=this.ddlTransType.SelectedItem.Value;
			switch(transType)
			{
				case ProductTransType.CHECKTICKET :
					this.lblReference.Text ="送检单号:";
					this.grid.Columns[0].HeaderText="送检单号";
					break;

				case ProductTransType.DELIVERTICKET :
					this.lblReference.Text ="送货单号:";
					this.grid.Columns[0].HeaderText="送货单号";
					
					break;
				
			}
		}

		private void BindCustomLine(bool custom,bool line)
		{
			if(custom)
			{
				this.lblCustom.Visible=true;
				this.ddlCustom.Visible=true;
				this.grid.Columns[1].Visible=true;
				
			}
			else
			{
				this.lblCustom.Visible=false;
				this.ddlCustom.Visible=false;
				this.ddlCustom.SelectedIndex=0;
				this.grid.Columns[1].Visible=false;
				
			}

			if(line)
			{
				
				this.grid.Columns[2].Visible=true;
				
			}
			else
			{
				
				this.grid.Columns[2].Visible=false;
				
			}
				
		}

		private void BindGrid()
		{
			string transType=this.ddlTransType.SelectedItem.Value;
			string reference=this.txtReference.Text.Trim();
			string startDate = "" ,endDate = "";
			switch (this.txtLastUpdate.SelectedItem.Value)
			{
				case "T":
					startDate=DateTime.Now.ToShortDateString();
					endDate=DateTime.Now.AddDays(1).ToShortDateString();
					break;
				case "W":
					startDate = DateTime.Now.AddDays(-7).ToString();
					endDate = DateTime.Now.ToString();
					break;
				case "M":
					startDate = DateTime.Now.AddMonths(-1).ToString();
					endDate = DateTime.Now.ToString();
					break;
				case "Y":
					startDate = DateTime.Now.AddYears(-1).ToString();
					endDate = DateTime.Now.ToString();
					break;
				case "L":
					startDate=DateBegToEnd1.Bdate.ToString();
					endDate=DateBegToEnd1.Edate.ToString();
					break;
				default:
					break;
			}

			string user=this.ddlUser.SelectedItem.Value;
			
			string pcode=this.txtProductCode.Text.Trim();
			string custom=this.ddlCustom.SelectedItem.Value;
			
			DataTable dt=ProductSystem.AllTransLine(transType,reference,startDate,endDate,user,pcode,custom);
			Common.ReSet(this.grid,dt.DefaultView);
			grid.DataSource=dt;
			grid.DataBind();
		}

		#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.ddlTransType.SelectedIndexChanged += new System.EventHandler(this.ddlTransType_SelectedIndexChanged);
			this.txtLastUpdate.SelectedIndexChanged += new System.EventHandler(this.txtLastUpdate_SelectedIndexChanged);
			this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
			this.grid.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.grid_ItemDataBound);
			this.Load += new System.EventHandler(this.Page_Load);

		}
		#endregion

		private void btnSearch_Click(object sender, System.EventArgs e)
		{
			this.BindGrid();
		}

		private void ddlTransType_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			TransTypeChanged();
			this.BindGrid();
		
		}

		private void grid_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
		{
			if(e.Item.ItemType==ListItemType.AlternatingItem || e.Item.ItemType==ListItemType.Item)
			{
				e.Item.Cells[0].Text = ProductTransType.GetTypeName(e.Item.Cells[0].Text .Trim());
				e.Item.Cells[2].Text = CustomSystem.GetCustomCodeName(e.Item.Cells[2].Text.Trim());
				//e.Item.Cells[2].Text=LineSystem.GetLineCode(e.Item.Cells[2].Text.Trim());
			}
		}

		private void txtLastUpdate_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			if (this.txtLastUpdate.SelectedItem.Value=="L")
			{				
				DateBegToEnd1.Visible=true;
			}
			else
			{			
				DateBegToEnd1.Visible=false;
			}
		}
	}
}

⌨️ 快捷键说明

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