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 PartyLectureEdit : PageBase { #region 加载 /// /// 页面加载 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.Params["partyLectureId"]; string year = DateTime.Now.Year.ToString(); if (!string.IsNullOrEmpty(Request.Params["Year"])) { year = Request.Params["Year"]; } ConstValue.InitConstValueDropDownList(this.drpQuarter, ConstValue.Group_0011, true); if (!string.IsNullOrEmpty(id)) { Model.Party_PartyLecture partyLecture = BLL.PartyLectureService.GetPartyLectureById(id); if (partyLecture != null) { this.hdId.Text = id; if (partyLecture.Year != null) { this.txtYear.Text = partyLecture.Year.ToString(); } if (partyLecture.Quarter != null) { this.drpQuarter.SelectedValue = partyLecture.Quarter.ToString(); } } } else { this.txtYear.Text = year; } } } #endregion #region 附件上传 /// /// 附件上传 /// /// /// protected void btnAttach_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Party_PartyLecture)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/PartyLecture&menuId={1}", this.hdId.Text, BLL.Const.PartyLectureMenuId))); } protected void btnAttach2_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Party_PartyLecture)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/PartyLecture&menuId={1}", this.hdId.Text + "2", BLL.Const.PartyLectureMenuId))); } protected void btnAttach3_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(typeof(Model.Party_PartyLecture)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/Party/PartyLecture&menuId={1}", this.hdId.Text + "3", BLL.Const.PartyLectureMenuId))); } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (this.drpQuarter.SelectedValue == BLL.Const._Null) { Alert.ShowInTop("请选择季度", MessageBoxIcon.Warning); return; } string id = Request.Params["partyLectureId"]; Model.Party_PartyLecture newPartyLecture = new Model.Party_PartyLecture(); newPartyLecture.Year = Funs.GetNewIntOrZero(this.txtYear.Text.Trim()); newPartyLecture.Quarter = Funs.GetNewInt(this.drpQuarter.SelectedValue); if (!string.IsNullOrEmpty(id)) { newPartyLecture.PartyLectureId = id; BLL.PartyLectureService.UpdatePartyLecture(newPartyLecture); } else { if (!string.IsNullOrEmpty(this.hdId.Text)) { newPartyLecture.PartyLectureId = this.hdId.Text.Trim(); } else { newPartyLecture.PartyLectureId = SQLHelper.GetNewID(typeof(Model.Party_PartyLecture)); this.hdId.Text = newPartyLecture.PartyLectureId; } newPartyLecture.CompileMan = this.CurrUser.UserId; newPartyLecture.CompileDate = DateTime.Now; BLL.PartyLectureService.AddPartyLecture(newPartyLecture); } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #endregion } }