📄 carout.aspx.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>
/// CarOut 的摘要说明。
/// </summary>
public class CarOut :Views.CarModule.CarPage
{
protected System.Web.UI.WebControls.Label lblCarOutOkInfo;
protected System.Web.UI.HtmlControls.HtmlTable tblCarOut;
protected System.Web.UI.HtmlControls.HtmlTable tblInfo;
protected System.Web.UI.WebControls.TextBox txtApplyDate;
protected System.Web.UI.WebControls.TextBox txtDstArea;
protected System.Web.UI.WebControls.TextBox txtDurTime;
protected System.Web.UI.WebControls.TextBox txtCar;
protected System.Web.UI.WebControls.TextBox txtDriver;
protected System.Web.UI.WebControls.TextBox txtMemo;
protected System.Web.UI.WebControls.TextBox txtDeptCheck;
protected System.Web.UI.WebControls.TextBox txtCarsCheck;
protected System.Web.UI.WebControls.TextBox txtDeanCheck;
protected System.Web.UI.WebControls.TextBox txtCEOCheck;
protected System.Web.UI.WebControls.Label lblDeptCheck;
protected System.Web.UI.WebControls.Label lblCarsCheck;
protected System.Web.UI.WebControls.Label lblDeanCheck;
protected System.Web.UI.WebControls.Label lblCEOCheck;
protected System.Web.UI.WebControls.Label lblRelUser;
protected System.Web.UI.WebControls.Label lblApplyID;
protected System.Web.UI.WebControls.TextBox txtCarOutMemo;
protected System.Web.UI.WebControls.Button btnCarOut;
protected System.Web.UI.WebControls.Label lblCarID;
protected System.Web.UI.WebControls.Label lblNoCarOutInfo;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!this.IsPostBack)
{
//
//以下代码初始化页面显示内容
//
this.tblCarOut.Visible=false;
this.tblInfo.Visible=true;
this.lblNoCarOutInfo.Visible=true;
this.lblCarOutOkInfo.Visible=false;
//
//以下代码获取用户的出车任务,然后根据审批结果设置页面显示内容
//
System.Data.OleDb.OleDbDataReader oleDR;
oleDR=this.DB.GetDataReader("Select * From vMyCarApply Where StartDate>=DateValue('"+System.DateTime.Today.ToShortDateString()+"') And (UserID="+this.theUserInfo.UserID+" Or DriverID="+this.theUserInfo.UserID+") Order By StartDate Asc");
if(oleDR.Read())
//
//有申请用车任务
//
{
//
//设置相关显示信息的内容
//
int iDeptID=(int)oleDR["DeptID"];
int iApplyID=(int)oleDR["ApplyID"];
int iCarID=(int)oleDR["CarID"];
this.lblCarID.Text=iCarID.ToString();
this.lblApplyID.Text=iApplyID.ToString();
this.txtApplyDate.Text=Convert.ToDateTime(oleDR["ApplyDate"]).ToShortDateString();
this.txtDurTime.Text=Convert.ToDateTime(oleDR["StartDate"]).ToShortDateString()+"——"+Convert.ToDateTime(oleDR["EndDate"]).ToShortDateString();
this.txtDstArea.Text=oleDR["AreaName"].ToString();
this.txtCar.Text=oleDR["CarName"].ToString();
//
//下面设置相关人员,如果是申请用户,则显示分配司机,如果是分配司机则显示相关员工
//
if((int)oleDR["UserID"]==this.theUserInfo.UserID)
{
this.txtDriver.Text=oleDR["DriverName"].ToString();
this.lblRelUser.Text="执行司机";
}
else
{
this.txtDriver.Text=oleDR["DeptName"].ToString()+"/"+oleDR["DriverName"].ToString();
this.lblRelUser.Text="用车人员";
}
oleDR.Close();
//
//如果当前用于对应的出车任务还没有作出车签名,则显示数据,等待用户签名
//
if(this.DB.GetRSCount("CarOut","ApplyID="+iApplyID+",And UserID="+this.theUserInfo.UserID)==0)
{
//
//显示任务信息
//
this.tblCarOut.Visible=true;
this.tblInfo.Visible=false;
this.lblNoCarOutInfo.Visible=false;
this.lblCarOutOkInfo.Visible=true;
this.txtMemo.Text=this.DB.RunScalar("select [Memo] From CarApply Where ApplyID="+iApplyID).ToString();
//是否为需要总经理审批车辆
bool blIsCEOCheckCar=(bool)this.DB.RunScalar("Select CEOCheck From Cars Where CarID="+iCarID);
//
//获取用车申请的审批数据
//
oleDR=this.DB.GetDataReader("Select * From ApplyCheck Where ApplyID="+iApplyID);
bool blCheckOK=false;
this.lblDeptCheck.Text="待审";
this.lblCarsCheck.Text="待审";
this.lblDeanCheck.Text="待审";
this.lblCEOCheck.Text=blIsCEOCheckCar?"待审":"免审";
if(oleDR.Read())
{
//
//部门已经审批,设置审批数据,如果审批通过,则继续监测下一步审批
//
this.txtDeptCheck.Text=oleDR["Memo"].ToString();
this.lblDeptCheck.Text="不通过";
if((bool)oleDR["CheckStatus"])
{
//
//部门审批通过
//
this.lblDeptCheck.Text="通过";
if(oleDR.Read())
{
//
//车队已经审批,设置审批数据,如果审批通过,则继续监测下一步审批
//
this.txtCarsCheck.Text=oleDR["Memo"].ToString();
this.lblCarsCheck.Text="不通过";
if((bool)oleDR["CheckStatus"])
{
//
//车队审批通过
//
this.lblCarsCheck.Text="通过";
if(oleDR.Read())
{
//
//行政部已经审批,设置审批数据,如果审批通过,则继续监测下一步审批
//
this.txtDeanCheck.Text=oleDR["Memo"].ToString();
this.lblDeanCheck.Text="不通过";
if((bool)oleDR["CheckStatus"])
{
//
//行政部审批通过
//
this.lblDeanCheck.Text="通过";
if(blIsCEOCheckCar)
{
if(oleDR.Read())
{
//
//需要总经理审批且总经理已经批复
//
this.txtCEOCheck.Text=oleDR["Memo"].ToString();
this.lblCEOCheck.Text="不通过";
if((bool)oleDR["CheckStatus"])
{
//
//总经理审批通过
//
blCheckOK=true;
this.lblCEOCheck.Text="通过";
}
}
}
else
{
blCheckOK=true;
}
}
}
}
}
}
}
oleDR.Close();
this.btnCarOut.Enabled=blCheckOK;
}
}
else
oleDR.Close();
}
else
{
//
//页面回调,用户进行出车签名
//
this.DB.CarOutSign(this.theUserInfo.UserID,Convert.ToInt32(this.lblApplyID.Text),Convert.ToInt32(this.lblCarID.Text),this.txtCarOutMemo.Text);
this.tblInfo.Visible=true;
this.tblCarOut.Visible=false;
this.lblNoCarOutInfo.Visible=false;
this.lblCarOutOkInfo.Visible=true;
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -