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 ThemePartyDayEdit : PageBase { #region 加载 /// /// 页面加载 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["themePartyDayId"]; string year = DateTime.Now.Year.ToString(); if (!string.IsNullOrEmpty(Request.Params["Year"])) { year = Request.Params["Year"]; } if (!string.IsNullOrEmpty(Request.Params["type"])) { this.btnSave.Hidden = true; } if (!string.IsNullOrEmpty(id)) { Model.Party_ThemePartyDay themePartyDay = BLL.ThemePartyDayService.GetThemePartyDayById(id); if (themePartyDay != null) { this.hdId.Text = id; if (themePartyDay.Year != null) { this.txtYear.Text = themePartyDay.Year.ToString(); } if (themePartyDay.ConveneDate != null) { this.txtConveneDate.Text = string.Format("{0:yyyy-MM-dd}", themePartyDay.ConveneDate); } this.txtTheme.Text = themePartyDay.Theme; } } else { this.txtYear.Text = year; this.txtConveneDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now); } } } #endregion #region 附件上传 /// /// 附件上传 /// /// /// protected void btnAttach_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Party_ThemePartyDay)); } if (!string.IsNullOrEmpty(Request.Params["type"])) { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=-1&toKeyId={0}&path=FileUpload/Party/ThemePartyDay&menuId={1}", this.hdId.Text, BLL.Const.ThemePartyDayMenuId))); } else { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/ThemePartyDay&menuId={1}", this.hdId.Text, BLL.Const.ThemePartyDayMenuId))); } } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { string id = Request.Params["themePartyDayId"]; Model.Party_ThemePartyDay newThemePartyDay = new Model.Party_ThemePartyDay(); newThemePartyDay.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim()); newThemePartyDay.ConveneDate = Funs.GetNewDateTimeOrNow(this.txtConveneDate.Text.Trim()); newThemePartyDay.Theme = this.txtTheme.Text.Trim(); if (!string.IsNullOrEmpty(id)) { newThemePartyDay.ThemePartyDayId = id; BLL.ThemePartyDayService.UpdateThemePartyDay(newThemePartyDay); } else { if (!string.IsNullOrEmpty(this.hdId.Text)) { newThemePartyDay.ThemePartyDayId = this.hdId.Text.Trim(); } else { newThemePartyDay.ThemePartyDayId = SQLHelper.GetNewID(typeof(Model.Party_ThemePartyDay)); this.hdId.Text = newThemePartyDay.ThemePartyDayId; } newThemePartyDay.CompileMan = this.CurrUser.UserId; newThemePartyDay.CompileDate = DateTime.Now; BLL.ThemePartyDayService.AddThemePartyDay(newThemePartyDay); } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #endregion } }