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

📄 carcheck.aspx.cs

📁 视野车辆管理系统源码
💻 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 Views.Car
{
	/// <summary>
	/// CarCheck 的摘要说明。
	/// </summary>
	public class CarCheck : Views.CarModule.CarPage
	{
		protected System.Web.UI.WebControls.DataGrid dgMyCarApply;
		protected System.Web.UI.WebControls.TextBox txtCheckMemo;
		protected System.Web.UI.WebControls.Label lblApplyID;
		protected System.Web.UI.WebControls.DropDownList ddlDrivers;
		protected System.Web.UI.WebControls.CheckBox cbCheckStatus;
		protected System.Web.UI.WebControls.Button Button1;
		protected System.Web.UI.HtmlControls.HtmlTableRow trCarCheck;
	
		private int m_iCurCarApply=-1;

		//
		//页面加载事件代理
		//本代理函数初始化当前选择的数据行
		//
		private void Page_Load(object sender, System.EventArgs e)
		{
			// 在此处放置用户代码以初始化页面
			try
			{
				this.m_iCurCarApply=(int)this.ViewState["CurCarApply"];
			}
			catch
			{
				this.m_iCurCarApply=-1;
			}
		}
		//
		//页面预输出事件代理
		//本代理函数绑定数据,同时根据当前是否选择了数据而显示该申请数据对应的审批状态
		//
		private void Page_PreRender(object sender, System.EventArgs e)
		{
			if(this.theUserInfo.PrivilID<=1)
			{
				this.Alert("对不起,您不具备审批权限。");
				this.WriteJS("window.location.assign('Index.Aspx');");
			}
			else
			{
				System.Data.DataView dvTmp;
				if(this.theUserInfo.PrivilID==2)
					dvTmp=this.DB.GetData("vMyCarApply",-1,"1=1 or (ApplyCnt=0 And DeptID="+this.theUserInfo.DeptID.ToString()+")","ApplyID Desc").DefaultView;
				else if(this.theUserInfo.PrivilID==3)
					dvTmp=this.DB.GetData("vMyCarApply",-1,"1=1 or ApplyCnt=1","ApplyID Desc").DefaultView;
				else if(this.theUserInfo.PrivilID==4)
					dvTmp=this.DB.GetData("vMyCarApply",-1,"1=1 or ApplyCnt=2","ApplyID Desc").DefaultView;
				else
					dvTmp=this.DB.GetData("vMyCarApply",-1,"1=1 or (ApplyCnt=3 And CEOCheck)","ApplyID Desc").DefaultView;
				this.dgMyCarApply.DataSource=dvTmp;
				this.dgMyCarApply.DataBind();
				this.ViewState["CurCarApply"]=this.m_iCurCarApply;
				this.trCarCheck.Visible=this.m_iCurCarApply>=0;
				if(this.m_iCurCarApply>=0)
				{
					this.lblApplyID.Text=dvTmp[m_iCurCarApply]["ApplyID"].ToString();
					this.ddlDrivers.Visible=this.theUserInfo.PrivilID==3;
					this.ddlDrivers.DataSource=this.DB.GetData("DriverID,DriverName","vDrivers",-1,null,"DriverID Asc");
					this.ddlDrivers.DataTextField="DriverName";
					this.ddlDrivers.DataValueField="DriverID";
					this.ddlDrivers.DataBind();
				}
			}
		}

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

		}
		#endregion

		//
		//数据选择索引修改事件代理
		//
		private void dgMyCarApply_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			this.m_iCurCarApply=this.dgMyCarApply.SelectedIndex;
		}
		//
		//审批按钮点击事件代理函数
		//本函数保存审批信息
		//
		private void Button1_Click(object sender, System.EventArgs e)
		{
			int iApplyID=Convert.ToInt32(this.lblApplyID.Text);
			int iUserID=this.theUserInfo.UserID;
			bool blCheckStatus=this.cbCheckStatus.Checked;
			string strMemo=this.txtCheckMemo.Text;
			int iDriverID=-1;
			if(this.theUserInfo.PrivilID==3)
				iDriverID=Convert.ToInt32(this.ddlDrivers.SelectedItem.Value);
			this.DB.NewCarCheck(iApplyID,iUserID,iDriverID,blCheckStatus,strMemo);
			this.m_iCurCarApply=-1;
		}
	}
}

⌨️ 快捷键说明

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