119 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			119 lines
		
	
	
		
			5.3 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| 
 | |
| namespace FineUIPro.Web.TestRun.PersonTrain
 | |
| {
 | |
|     public partial class PersonTrainPlanEdit : PageBase
 | |
|     {
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 页面加载
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 ///培训类型
 | |
|                 //this.drpTrainType.DataTextField = "Text";
 | |
|                 //this.drpTrainType.DataValueField = "Value";
 | |
|                 //this.drpTrainType.DataSource=BLL.DropListService.drpTrainTypeList();
 | |
|                 //this.drpTrainType.DataBind();
 | |
| 
 | |
|                 string id = Request.Params["id"];
 | |
|                 if (!string.IsNullOrEmpty(id))
 | |
|                 {
 | |
|                     Model.TestRun_PersonTrainPlan data = BLL.PersonTrainPlanService.GetPersonTrainPlanById(id);
 | |
|                     if (data != null)
 | |
|                     {
 | |
|                         this.hdId.Text = id;
 | |
|                         //if (!string.IsNullOrEmpty(data.TrainType))
 | |
|                         //{
 | |
|                         //    this.drpTrainType.SelectedValue = data.TrainType;
 | |
|                         //}
 | |
|                         //this.txtPurpose.Text = data.Purpose;
 | |
|                         this.txtTrainingContent.Text = data.TrainingContent;
 | |
|                         this.txtTrainingAddress.Text = data.TrainingAddress;
 | |
|                         this.txtTrainingDate.Text = data.TrainingDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.TrainingDate) : "";
 | |
|                         //this.txtTrainingPersonNum.Text = data.TrainingPersonNum;
 | |
|                         //this.txtTrainingHours.Text = data.TrainingHours.HasValue ? data.TrainingHours.ToString() : "";
 | |
|                         //this.txtTrainingManager.Text = data.TrainingManager;
 | |
|                         //this.txtTrainingTeacher.Text = data.TrainingTeacher;
 | |
|                         //this.txtAssessmentMethod.Text = data.AssessmentMethod;
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.txtTrainingDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #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.TestRun_PersonTrainPlan));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/PersonTrain/PersonTrainPlan&menuId={1}", this.hdId.Text, BLL.Const.PersonTrainPlanMenuId)));
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             //if (string.IsNullOrEmpty(this.drpTrainType.SelectedValue)||this.drpTrainType.SelectedValue==BLL.Const._Null)
 | |
|             //{
 | |
|             //    Alert.ShowInTop("请选择培训类型!", MessageBoxIcon.Warning);
 | |
|             //    return;
 | |
|             //}
 | |
|             string id = Request.Params["id"];
 | |
|             Model.TestRun_PersonTrainPlan newData = new Model.TestRun_PersonTrainPlan();
 | |
|             //newData.TrainType = this.drpTrainType.SelectedValue;
 | |
|             //newData.Purpose = this.txtPurpose.Text.Trim();
 | |
|             newData.TrainingContent = this.txtTrainingContent.Text.Trim();
 | |
|             newData.TrainingAddress = this.txtTrainingAddress.Text.Trim();
 | |
|             newData.TrainingDate = Funs.GetNewDateTime(this.txtTrainingDate.Text.Trim());
 | |
|             //newData.TrainingPersonNum = this.txtTrainingPersonNum.Text.Trim();
 | |
|             //newData.TrainingHours = Funs.GetNewDecimal(this.txtTrainingHours.Text.Trim());
 | |
|             //newData.TrainingManager = this.txtTrainingManager.Text.Trim();
 | |
|             //newData.TrainingTeacher = this.txtTrainingTeacher.Text.Trim();
 | |
|             //newData.AssessmentMethod = this.txtAssessmentMethod.Text.Trim();
 | |
|             newData.ProjectId = this.CurrUser.LoginProjectId;
 | |
|             if (!string.IsNullOrEmpty(id))
 | |
|             {
 | |
|                 newData.PersonTrainPlanId = id;
 | |
|                 BLL.PersonTrainPlanService.UpdatePersonTrainPlan(newData);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 if (!string.IsNullOrEmpty(this.hdId.Text))
 | |
|                 {
 | |
|                     newData.PersonTrainPlanId = this.hdId.Text.Trim();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newData.PersonTrainPlanId = SQLHelper.GetNewID(typeof(Model.TestRun_PersonTrainPlan));
 | |
|                     this.hdId.Text = newData.PersonTrainPlanId;
 | |
|                 }
 | |
|                 BLL.PersonTrainPlanService.AddPersonTrainPlan(newData);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |