101 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			101 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			C#
		
	
	
	
| using BLL;
 | |
| using System;
 | |
| 
 | |
| namespace FineUIPro.Web.TestRun.DriverGoods
 | |
| {
 | |
|     public partial class GoodsPlanEdit : PageBase
 | |
|     {
 | |
|         #region 加载
 | |
|         /// <summary>
 | |
|         /// 页面加载
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void Page_Load(object sender, EventArgs e)
 | |
|         {
 | |
|             if (!IsPostBack)
 | |
|             {
 | |
|                 BLL.UserService.InitUserDropDownList(this.drpCompileMan, this.CurrUser.LoginProjectId, true);
 | |
| 
 | |
|                 string id = Request.Params["id"];
 | |
|                 if (!string.IsNullOrEmpty(id))
 | |
|                 {
 | |
|                     Model.DriverGoods_GoodsPlan data = BLL.GoodsPlanService.GetGoodsPlanById(id);
 | |
|                     if (data != null)
 | |
|                     {
 | |
|                         this.hdId.Text = id;
 | |
|                         this.txtCode.Text = data.Code;
 | |
|                         this.txtPlanName.Text = data.PlanName;
 | |
|                         this.txtPlanCode.Text = data.PlanCode;
 | |
|                         if (!string.IsNullOrEmpty(data.CompileMan))
 | |
|                         {
 | |
|                             this.drpCompileMan.SelectedValue = data.CompileMan;
 | |
|                         }
 | |
|                         this.txtApprovalDate.Text = data.ApprovalDate.HasValue ? string.Format("{0:yyyy-MM-dd}", data.ApprovalDate) : "";
 | |
|                         this.txtRemark.Text = data.Remark;
 | |
|                     }
 | |
|                 }
 | |
|             }
 | |
|         }
 | |
|         #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.DriverGoods_GoodsPlan));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverGoods/GoodsPlan&menuId={1}", this.hdId.Text, BLL.Const.GoodsPlanMenuId)));
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string id = Request.Params["id"];
 | |
|             Model.DriverGoods_GoodsPlan newData = new Model.DriverGoods_GoodsPlan();
 | |
|             newData.Code = this.txtCode.Text.Trim();
 | |
|             newData.PlanName = this.txtPlanName.Text.Trim();
 | |
|             newData.PlanCode = this.txtPlanCode.Text.Trim();
 | |
|             if (this.drpCompileMan.SelectedValue!=BLL.Const._Null)
 | |
|             {
 | |
|                 newData.CompileMan = this.drpCompileMan.SelectedValue;
 | |
|             }
 | |
|             newData.ApprovalDate = Funs.GetNewDateTime(this.txtApprovalDate.Text.Trim());
 | |
|             newData.Remark = this.txtRemark.Text.Trim();
 | |
|             newData.ProjectId = this.CurrUser.LoginProjectId;
 | |
|             if (!string.IsNullOrEmpty(id))
 | |
|             {
 | |
|                 newData.GoodsPlanId = id;
 | |
|                 BLL.GoodsPlanService.UpdateGoodsPlan(newData);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 if (!string.IsNullOrEmpty(this.hdId.Text))
 | |
|                 {
 | |
|                     newData.GoodsPlanId = this.hdId.Text.Trim();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newData.GoodsPlanId = SQLHelper.GetNewID(typeof(Model.DriverGoods_GoodsPlan));
 | |
|                     this.hdId.Text = newData.GoodsPlanId;
 | |
|                 }
 | |
|                 BLL.GoodsPlanService.AddGoodsPlan(newData);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |