| 
									
										
										
										
											2024-01-25 15:21:19 +08:00
										 |  |  |  | using BLL; | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace FineUIPro.Web.TestRun.DriverSub | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class DriverSubPlanEdit :PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         #region 加载 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 页面加载 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-01-26 17:12:01 +08:00
										 |  |  |  |                 //BLL.UnitService.InitUnitDownList(this.drpSubUnitId, this.CurrUser.LoginProjectId, true); | 
					
						
							|  |  |  |  |                 //BLL.UnitWorkService.InitUnitWorkDropDownList(this.drpUnitWorkIds, this.CurrUser.LoginProjectId, true); | 
					
						
							| 
									
										
										
										
											2024-01-25 15:21:19 +08:00
										 |  |  |  |                 string id = Request.Params["id"]; | 
					
						
							| 
									
										
										
										
											2024-02-19 10:32:15 +08:00
										 |  |  |  |                 SubcontractingTypes.DataSource=DropListService.drpDriverSubNameList(); | 
					
						
							|  |  |  |  |                 SubcontractingTypes.DataTextField = "Text"; | 
					
						
							|  |  |  |  |                 SubcontractingTypes.DataValueField = "Value"; | 
					
						
							|  |  |  |  |                 SubcontractingTypes.DataBind(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-02-21 15:13:54 +08:00
										 |  |  |  |               | 
					
						
							| 
									
										
										
										
											2024-01-25 15:21:19 +08:00
										 |  |  |  |                 if (!string.IsNullOrEmpty(id)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Model.DriverSub_DriverSubPlan data = BLL.DriverSubPlanService.GetDriverSubPlanById(id); | 
					
						
							|  |  |  |  |                     if (data != null) | 
					
						
							|  |  |  |  |                     { | 
					
						
							|  |  |  |  |                         this.hdId.Text = id; | 
					
						
							|  |  |  |  |                         this.txtCode.Text = data.Code; | 
					
						
							| 
									
										
										
										
											2024-02-19 10:32:15 +08:00
										 |  |  |  |                         this.SubcontractingTypes.SelectedValueArray= data.SubcontractingTypes.Split(','); | 
					
						
							| 
									
										
										
										
											2024-02-21 15:13:54 +08:00
										 |  |  |  |                 | 
					
						
							| 
									
										
										
										
											2024-01-25 15:21:19 +08:00
										 |  |  |  |                     } | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 附件上传 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 附件上传 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnAttach_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(this.hdId.Text))   //新增记录 | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubPlan)); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverSub/DriverSubPlan&menuId={1}", this.hdId.Text, BLL.Const.DriverSubPlanMenuId))); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 保存 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存按钮 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnSave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-02-19 10:32:15 +08:00
										 |  |  |  |             | 
					
						
							| 
									
										
										
										
											2024-01-25 15:21:19 +08:00
										 |  |  |  |             string id = Request.Params["id"]; | 
					
						
							|  |  |  |  |             Model.DriverSub_DriverSubPlan newData = new Model.DriverSub_DriverSubPlan(); | 
					
						
							|  |  |  |  |             newData.Code = this.txtCode.Text.Trim(); | 
					
						
							| 
									
										
										
										
											2024-02-19 10:32:15 +08:00
										 |  |  |  |             newData.SubcontractingTypes = GetStringByArray(this.SubcontractingTypes.SelectedValueArray); | 
					
						
							| 
									
										
										
										
											2024-01-25 15:21:19 +08:00
										 |  |  |  |             newData.ProjectId = this.CurrUser.LoginProjectId; | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(id)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 newData.DriverSubPlanId = id; | 
					
						
							|  |  |  |  |                 BLL.DriverSubPlanService.UpdateDriverSubPlan(newData); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             else | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(this.hdId.Text)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     newData.DriverSubPlanId = this.hdId.Text.Trim(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 else | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     newData.DriverSubPlanId = SQLHelper.GetNewID(typeof(Model.DriverSub_DriverSubPlan)); | 
					
						
							|  |  |  |  |                     this.hdId.Text = newData.DriverSubPlanId; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 BLL.DriverSubPlanService.AddDriverSubPlan(newData); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-26 17:12:01 +08:00
										 |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取字符串 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="array"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							| 
									
										
										
										
											2024-01-25 15:21:19 +08:00
										 |  |  |  |         private string GetStringByArray(string[] array) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string str = string.Empty; | 
					
						
							|  |  |  |  |             foreach (var item in array) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if (item != BLL.Const._Null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     str += item + ","; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(str)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 str = str.Substring(0, str.LastIndexOf(",")); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return str; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |