121 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			121 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.TestRun.DriverGoods
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class MaterialTraceEdit : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 加载
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 页面加载
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                string id = Request.Params["id"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(id))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Model.DriverGoods_MaterialTrace data = BLL.MaterialTraceService.GetMaterialTraceById(id);
							 | 
						|||
| 
								 | 
							
								                    if (data != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        this.hdId.Text = id;
							 | 
						|||
| 
								 | 
							
								                        this.txtCode.Text = data.Code;
							 | 
						|||
| 
								 | 
							
								                        this.txtMaterialName.Text = data.MaterialName;
							 | 
						|||
| 
								 | 
							
								                        this.txtType.Text = data.Type;
							 | 
						|||
| 
								 | 
							
								                        this.txtSpecificationModel.Text = data.SpecificationModel;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchStorage_1.Text = data.BatchStorage_1;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchStorage_2.Text = data.BatchStorage_2;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchStorage_3.Text = data.BatchStorage_3;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchOutStorage_1.Text = data.BatchOutStorage_1;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchOutStorage_2.Text = data.BatchOutStorage_2;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchOutStorage_3.Text = data.BatchOutStorage_3;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchOutStorage_4.Text = data.BatchOutStorage_4;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchOutStorage_5.Text = data.BatchOutStorage_5;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchOutStorage_6.Text = data.BatchOutStorage_6;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchSurplus_1.Text = data.BatchSurplus_1;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchSurplus_2.Text = data.BatchSurplus_2;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchSurplus_3.Text = data.BatchSurplus_3;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchSurplus_4.Text = data.BatchSurplus_4;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchSurplus_5.Text = data.BatchSurplus_5;
							 | 
						|||
| 
								 | 
							
								                        this.txtBatchSurplus_6.Text = data.BatchSurplus_6;
							 | 
						|||
| 
								 | 
							
								                        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_MaterialTrace));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/TestRun/DriverGoods/MaterialTrace&menuId={1}", this.hdId.Text, BLL.Const.MaterialTraceMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #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_MaterialTrace newData = new Model.DriverGoods_MaterialTrace();
							 | 
						|||
| 
								 | 
							
								            newData.Code = this.txtCode.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.Type = this.txtType.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.MaterialName = this.txtMaterialName.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.SpecificationModel = this.txtSpecificationModel.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchStorage_1 = this.txtBatchStorage_1.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchStorage_2 = this.txtBatchStorage_2.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchStorage_3 = this.txtBatchStorage_3.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchOutStorage_1 = this.txtBatchOutStorage_1.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchOutStorage_2 = this.txtBatchOutStorage_2.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchOutStorage_3 = this.txtBatchOutStorage_3.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchOutStorage_4 = this.txtBatchOutStorage_4.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchOutStorage_5 = this.txtBatchOutStorage_5.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchOutStorage_6 = this.txtBatchOutStorage_6.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchSurplus_1 = this.txtBatchSurplus_1.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchSurplus_2 = this.txtBatchSurplus_2.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchSurplus_3 = this.txtBatchSurplus_3.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchSurplus_4 = this.txtBatchSurplus_4.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchSurplus_5 = this.txtBatchSurplus_5.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.BatchSurplus_6 = this.txtBatchSurplus_6.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.Remark = this.txtRemark.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            newData.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(id))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                newData.MaterialTraceId = id;
							 | 
						|||
| 
								 | 
							
								                BLL.MaterialTraceService.UpdateMaterialTrace(newData);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.hdId.Text))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newData.MaterialTraceId = this.hdId.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    newData.MaterialTraceId = SQLHelper.GetNewID(typeof(Model.DriverGoods_MaterialTrace));
							 | 
						|||
| 
								 | 
							
								                    this.hdId.Text = newData.MaterialTraceId;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                BLL.MaterialTraceService.AddMaterialTrace(newData);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            ShowNotify("保存成功!", MessageBoxIcon.Success);
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |