156 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			156 lines
		
	
	
		
			6.2 KiB
		
	
	
	
		
			C#
		
	
	
	
|  | using System; | |||
|  | using System.Collections.Generic; | |||
|  | using System.Linq; | |||
|  | using System.Web; | |||
|  | using System.Web.UI; | |||
|  | using System.Web.UI.WebControls; | |||
|  | using BLL; | |||
|  | 
 | |||
|  | namespace FineUIPro.Web.Party | |||
|  | { | |||
|  |     public partial class TwoOneGoodSelectionEdit : 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["twoOneGoodSelectionId"]; | |||
|  |                 string year = DateTime.Now.Year.ToString(); | |||
|  |                 if (!string.IsNullOrEmpty(Request.Params["Year"])) | |||
|  |                 { | |||
|  |                     year = Request.Params["Year"]; | |||
|  |                 } | |||
|  |                 Funs.FineUIPleaseSelect(this.drpSelectionType); | |||
|  |                 PartyerService.InitPartyerDropDownList(drpPartyer, false); | |||
|  |                 if (!string.IsNullOrEmpty(id)) | |||
|  |                 { | |||
|  |                     Model.Party_TwoOneGoodSelection twoOneGoodSelection = BLL.TwoOneGoodSelectionService.GetTwoOneGoodSelectionById(id); | |||
|  |                     if (twoOneGoodSelection != null) | |||
|  |                     { | |||
|  |                         this.hdId.Text = id; | |||
|  |                         if (twoOneGoodSelection.Year != null) | |||
|  |                         { | |||
|  |                             this.txtYear.Text = twoOneGoodSelection.Year.ToString(); | |||
|  |                         } | |||
|  |                         if (!string.IsNullOrEmpty(twoOneGoodSelection.SelectionType)) | |||
|  |                         { | |||
|  |                             this.drpSelectionType.SelectedValue = twoOneGoodSelection.SelectionType; | |||
|  |                             if (twoOneGoodSelection.SelectionType == "3") | |||
|  |                             { | |||
|  |                                 this.txtPartyBranch.Hidden = false; | |||
|  |                                 this.txtPartyBranch.Text = twoOneGoodSelection.PartyBranch; | |||
|  |                             } | |||
|  |                             else | |||
|  |                             { | |||
|  |                                 this.drpPartyer.Hidden = false; | |||
|  |                                 if (!string.IsNullOrEmpty(twoOneGoodSelection.PartyerId)) | |||
|  |                                 { | |||
|  |                                     this.drpPartyer.SelectedValue = twoOneGoodSelection.PartyerId; | |||
|  |                                 } | |||
|  |                             } | |||
|  |                         } | |||
|  |                     } | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     this.txtYear.Text = year; | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  |         #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.Party_TwoOneGoodSelection)); | |||
|  |             } | |||
|  |             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/TwoOneGoodSelection&menuId={1}", this.hdId.Text, BLL.Const.TwoOneGoodSelectionMenuId))); | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         #region 保存 | |||
|  |         /// <summary> | |||
|  |         /// 保存按钮 | |||
|  |         /// </summary> | |||
|  |         /// <param name="sender"></param> | |||
|  |         /// <param name="e"></param> | |||
|  |         protected void btnSave_Click(object sender, EventArgs e) | |||
|  |         { | |||
|  |             if (this.drpSelectionType.SelectedValue == BLL.Const._Null) | |||
|  |             { | |||
|  |                 Alert.ShowInTop("请选择类别", MessageBoxIcon.Warning); | |||
|  |                 return; | |||
|  |             } | |||
|  |             string id = Request.Params["twoOneGoodSelectionId"]; | |||
|  |             Model.Party_TwoOneGoodSelection newTwoOneGoodSelection = new Model.Party_TwoOneGoodSelection(); | |||
|  |             newTwoOneGoodSelection.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim()); | |||
|  |             newTwoOneGoodSelection.SelectionType = this.drpSelectionType.SelectedValue; | |||
|  |             if (this.drpSelectionType.SelectedValue == "3") | |||
|  |             { | |||
|  |                 newTwoOneGoodSelection.PartyBranch = this.txtPartyBranch.Text.Trim(); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 if (string.IsNullOrEmpty(this.drpPartyer.SelectedValue)) | |||
|  |                 { | |||
|  |                     Alert.ShowInTop("请选择当选人", MessageBoxIcon.Warning); | |||
|  |                     return; | |||
|  |                 } | |||
|  |                 newTwoOneGoodSelection.PartyerId = this.drpPartyer.SelectedValue; | |||
|  |             } | |||
|  |             if (!string.IsNullOrEmpty(id)) | |||
|  |             { | |||
|  |                 newTwoOneGoodSelection.TwoOneGoodSelectionId = id; | |||
|  |                 BLL.TwoOneGoodSelectionService.UpdateTwoOneGoodSelection(newTwoOneGoodSelection); | |||
|  |             } | |||
|  |             else | |||
|  |             { | |||
|  |                 if (!string.IsNullOrEmpty(this.hdId.Text)) | |||
|  |                 { | |||
|  |                     newTwoOneGoodSelection.TwoOneGoodSelectionId = this.hdId.Text.Trim(); | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     newTwoOneGoodSelection.TwoOneGoodSelectionId = SQLHelper.GetNewID(typeof(Model.Party_TwoOneGoodSelection)); | |||
|  |                     this.hdId.Text = newTwoOneGoodSelection.TwoOneGoodSelectionId; | |||
|  |                 } | |||
|  |                 newTwoOneGoodSelection.CompileMan = this.CurrUser.UserId; | |||
|  |                 newTwoOneGoodSelection.CompileDate = DateTime.Now; | |||
|  |                 BLL.TwoOneGoodSelectionService.AddTwoOneGoodSelection(newTwoOneGoodSelection); | |||
|  |             } | |||
|  |             ShowNotify("保存成功!", MessageBoxIcon.Success); | |||
|  |             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); | |||
|  |         } | |||
|  |         #endregion | |||
|  | 
 | |||
|  |         protected void drpSelectionType_SelectedIndexChanged(object sender, EventArgs e) | |||
|  |         { | |||
|  |             this.drpPartyer.Hidden = true; | |||
|  |             this.txtPartyBranch.Hidden = true; | |||
|  |             if (this.drpSelectionType.SelectedValue != BLL.Const._Null) | |||
|  |             { | |||
|  |                 if (this.drpSelectionType.SelectedValue == "3") | |||
|  |                 { | |||
|  |                     this.txtPartyBranch.Hidden = false; | |||
|  |                 } | |||
|  |                 else | |||
|  |                 { | |||
|  |                     this.drpPartyer.Hidden = false; | |||
|  |                 } | |||
|  |             } | |||
|  |         } | |||
|  |     } | |||
|  | } |