121 lines
		
	
	
		
			4.9 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			121 lines
		
	
	
		
			4.9 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 PartyMoneyUseEdit : 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["partyMoneyUseId"];
 | |
|                 string year = DateTime.Now.Year.ToString();
 | |
|                 if (!string.IsNullOrEmpty(Request.Params["Year"]))
 | |
|                 {
 | |
|                     year = Request.Params["Year"];
 | |
|                 }
 | |
|                 PartyerService.InitPartyerDropDownList(drpPartyers, false);
 | |
|                 if (!string.IsNullOrEmpty(id))
 | |
|                 {
 | |
|                     Model.Party_PartyMoneyUse partyMoneyUse = BLL.PartyMoneyUseService.GetPartyMoneyUseById(id);
 | |
|                     if (partyMoneyUse != null)
 | |
|                     {
 | |
|                         this.hdId.Text = id;
 | |
|                         if (partyMoneyUse.Year != null)
 | |
|                         {
 | |
|                             this.txtYear.Text = partyMoneyUse.Year.ToString();
 | |
|                         }
 | |
|                         if (partyMoneyUse.UseDate != null)
 | |
|                         {
 | |
|                             this.txtUseDate.Text = string.Format("{0:yyyy-MM-dd}", partyMoneyUse.UseDate);
 | |
|                         }
 | |
|                         this.txtPurpose.Text = partyMoneyUse.Purpose;
 | |
|                         if (partyMoneyUse.Cost != null)
 | |
|                         {
 | |
|                             this.txtCost.Text = partyMoneyUse.Cost.ToString();
 | |
|                         }
 | |
|                         if (!string.IsNullOrEmpty(partyMoneyUse.Partyers))
 | |
|                         {
 | |
|                             this.drpPartyers.SelectedValueArray = partyMoneyUse.Partyers.Split(',');
 | |
|                         }
 | |
|                     }
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     this.txtYear.Text = year;
 | |
|                     this.txtUseDate.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.Party_PartyMoneyUse));
 | |
|             }
 | |
|             PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/PartyMoneyUse&menuId={1}", this.hdId.Text, BLL.Const.PartyMoneyUseMenuId)));
 | |
|         }
 | |
|         #endregion
 | |
| 
 | |
|         #region 保存
 | |
|         /// <summary>
 | |
|         /// 保存按钮
 | |
|         /// </summary>
 | |
|         /// <param name="sender"></param>
 | |
|         /// <param name="e"></param>
 | |
|         protected void btnSave_Click(object sender, EventArgs e)
 | |
|         {
 | |
|             string id = Request.Params["partyMoneyUseId"];
 | |
|             Model.Party_PartyMoneyUse newPartyMoneyUse = new Model.Party_PartyMoneyUse();
 | |
|             newPartyMoneyUse.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim());
 | |
|             newPartyMoneyUse.UseDate = Funs.GetNewDateTimeOrNow(this.txtUseDate.Text.Trim());
 | |
|             newPartyMoneyUse.Purpose = this.txtPurpose.Text.Trim();
 | |
|             newPartyMoneyUse.Cost = Funs.GetNewDecimalOrZero(this.txtCost.Text.Trim());
 | |
|             string partyers = Funs.GetStringByArray(this.drpPartyers.SelectedValueArray);
 | |
|             newPartyMoneyUse.Partyers = partyers;
 | |
|             if (!string.IsNullOrEmpty(id))
 | |
|             {
 | |
|                 newPartyMoneyUse.PartyMoneyUseId = id;
 | |
|                 BLL.PartyMoneyUseService.UpdatePartyMoneyUse(newPartyMoneyUse);
 | |
|             }
 | |
|             else
 | |
|             {
 | |
|                 if (!string.IsNullOrEmpty(this.hdId.Text))
 | |
|                 {
 | |
|                     newPartyMoneyUse.PartyMoneyUseId = this.hdId.Text.Trim();
 | |
|                 }
 | |
|                 else
 | |
|                 {
 | |
|                     newPartyMoneyUse.PartyMoneyUseId = SQLHelper.GetNewID(typeof(Model.Party_PartyMoneyUse));
 | |
|                     this.hdId.Text = newPartyMoneyUse.PartyMoneyUseId;
 | |
|                 }
 | |
|                 newPartyMoneyUse.CompileMan = this.CurrUser.UserId;
 | |
|                 newPartyMoneyUse.CompileDate = DateTime.Now;
 | |
|                 BLL.PartyMoneyUseService.AddPartyMoneyUse(newPartyMoneyUse);
 | |
|             }
 | |
|             ShowNotify("保存成功!", MessageBoxIcon.Success);
 | |
|             PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
 | |
|         }
 | |
|         #endregion
 | |
|     }
 | |
| } |