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 DriverSubSetContactorEdit : PageBase { public string DriverSubPlanId { get { return (string)ViewState["DriverSubPlanId"]; } set { ViewState["DriverSubPlanId"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.btnClose.OnClientClick = ActiveWindow.GetHideReference(); DriverSubPlanId = Request.Params["DriverSubPlanId"]; Bind(); } } void Save() { DriverSubContactService.SetBidirectional(DriverSubPlanId, drpCatalystLoading.SelectedValue); DriverSubContactService.SetBidirectional(DriverSubPlanId, drpOven.SelectedValue); DriverSubContactService.SetBidirectional(DriverSubPlanId, drpChemicalCleaning.SelectedValue); DriverSubContactService.SetBidirectional(DriverSubPlanId, drpDrivingTeam.SelectedValue); ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } void Bind() { var model = BLL.DriverSubPlanService.GetDriverSubPlanById(DriverSubPlanId); if (model != null) { var subcontractingtypeList= model.SubcontractingTypes.Split(','); foreach (string item in subcontractingtypeList) { if (item.Contains("1")) { drpCatalystLoading.Hidden = false; DriverSubContactService.InitDropListByDriverSubPlanId(DriverSubPlanId,item, drpCatalystLoading); drpCatalystLoading.SelectedValue = DriverSubContactService .GetBidirectional(DriverSubPlanId, "1")?.DriverSubContractorsId; } else if (item.Contains("2")) { drpOven.Hidden = false; DriverSubContactService.InitDropListByDriverSubPlanId(DriverSubPlanId, item, drpOven); drpOven.SelectedValue = DriverSubContactService .GetBidirectional(DriverSubPlanId, "2")?.DriverSubContractorsId; } else if (item.Contains("3")) { drpChemicalCleaning.Hidden = false; DriverSubContactService.InitDropListByDriverSubPlanId(DriverSubPlanId, item, drpChemicalCleaning); drpChemicalCleaning.SelectedValue = DriverSubContactService .GetBidirectional(DriverSubPlanId, "3")?.DriverSubContractorsId; } else if (item.Contains("4")) { drpDrivingTeam.Hidden = false; DriverSubContactService.InitDropListByDriverSubPlanId(DriverSubPlanId, item, drpDrivingTeam); drpDrivingTeam.SelectedValue = DriverSubContactService .GetBidirectional(DriverSubPlanId, "4")?.DriverSubContractorsId; } } } } protected void btnSave_Click(object sender, EventArgs e) { Save(); } } }