96 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			96 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using BLL; | |||
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Web; | |||
|  | using System.Web.UI; | |||
|  | using System.Web.UI.WebControls; | |||
|  | 
 | |||
|  | namespace FineUIPro.Web.TestRun.DriverSub | |||
|  | { | |||
|  |     public partial class DriverSubContactorEdit | |||
|  | 
 | |||
|  | : PageBase | |||
|  |     { | |||
|  |         #region   | |||
|  |         /// <summary> | |||
|  |         /// 主键 | |||
|  |         /// </summary> | |||
|  |         public string DriverSubContractorsId | |||
|  |         { | |||
|  |             get | |||
|  |             { | |||
|  |                 return (string)ViewState["DriverSubContractorsId"]; | |||
|  |             } | |||
|  |             set | |||
|  |             { | |||
|  |                 ViewState["DriverSubContractorsId"] = value; | |||
|  |             } | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         protected void Page_Load(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (!IsPostBack) | |||
|  |             { | |||
|  |                 this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); | |||
|  |                 DrpSubcontractingType.DataSource = DropListService.drpDriverSubNameList(); | |||
|  |                 DrpSubcontractingType.DataTextField = "Text"; | |||
|  |                 DrpSubcontractingType.DataValueField = "Value"; | |||
|  |                 DrpSubcontractingType.DataBind(); | |||
|  |                 this.DriverSubContractorsId = Request.Params["DriverSubContractorsId"]; | |||
|  |                 if (!string.IsNullOrEmpty(this.DriverSubContractorsId)) | |||
|  |                 { | |||
|  |                     Model.DriverSub_DriverSubContractors model = BLL.DriversubcontractorsService.GetDriverSub_DriverSubContractorsById(this.DriverSubContractorsId); | |||
|  |                     if (model != null) | |||
|  |                     { | |||
|  |                         this.txtSubUnitName.Text = model.SubUnitName; | |||
|  |                         this.txtEnterpriseNature.Text = model.EnterpriseNature; | |||
|  |                         this.DrpSubcontractingType.SelectedValue = model.SubcontractingType; | |||
|  |                         this.txtCollCropCode.Text = model.CollCropCode; | |||
|  |                         this.txtSafetyProductionLicense.Text = model.SafetyProductionLicense; | |||
|  |                         this.txtQualificationCertificateNumber.Text = model.QualificationCertificateNumber; | |||
|  |                         this.txtQualificationType.Text = model.QualificationType; | |||
|  |                         this.txtQualificationLevel.Text = model.QualificationLevel; | |||
|  |                         this.txtProvince.Text = model.Province; | |||
|  |                         this.txtCity.Text = model.City;  | |||
|  | 
 | |||
|  |                     } | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  | 
 | |||
|  |         /// <summary> | |||
|  |         /// 保存按钮 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnSave_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             Model.DriverSub_DriverSubContractors table = new Model.DriverSub_DriverSubContractors(); | |||
|  |             table.SubUnitName = this.txtSubUnitName.Text; | |||
|  |             table.EnterpriseNature = this.txtEnterpriseNature.Text; | |||
|  |             table.SubcontractingType = this.DrpSubcontractingType.SelectedValue; | |||
|  |             table.CollCropCode = this.txtCollCropCode.Text; | |||
|  |             table.SafetyProductionLicense = this.txtSafetyProductionLicense.Text; | |||
|  |             table.QualificationCertificateNumber = this.txtQualificationCertificateNumber.Text; | |||
|  |             table.QualificationType = this.txtQualificationType.Text; | |||
|  |             table.QualificationLevel = this.txtQualificationLevel.Text; | |||
|  |             table.Province = this.txtProvince.Text; | |||
|  |             table.City = this.txtCity.Text;  | |||
|  |             if (string.IsNullOrEmpty(this.DriverSubContractorsId)) | |||
|  |             { | |||
|  |                 table.DriverSubContractorsId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubContractors)); | |||
|  |                 BLL.DriversubcontractorsService.AddDriverSub_DriverSubContractors(table); | |||
|  | 
 | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 table.DriverSubContractorsId = this.DriverSubContractorsId; | |||
|  |                 BLL.DriversubcontractorsService.UpdateDriverSub_DriverSubContractors(table); | |||
|  |             } | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); | |||
|  |         } | |||
|  | 
 | |||
|  |     } | |||
|  | } |