using BLL; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; using System.Linq; using System.Security.Policy; using System.Web.UI.WebControls; using AspNet = System.Web.UI.WebControls; namespace FineUIPro.Web.CQMS.ProjectHighlightsSite { public partial class ProjectHighlightsSitePicEdit : PageBase { /// /// 主键 /// public string Id { get { return (string)ViewState["Id"]; } set { ViewState["Id"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.Id = Request.Params["Id"]; if (!string.IsNullOrEmpty(Id)) { Model.CQMS_ProjectHighlightsSitePic model = BLL.ProjectHighlightsSiteService.GetProjectHighlightsSiteById(Id); this.txtMainTypeName.Text = model.MainTypeName; this.txtSubType.Text = model.SubType; this.txtResume.Text = model.Resume; } else { Alert.ShowInTop("请选择一条记录", MessageBoxIcon.Warning); return; } } } protected void Grid1_Sort(object sender, GridSortEventArgs e) { } protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) { } protected void imgBtnFile_Click(object sender, EventArgs e) { PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=1&toKeyId={0}&path=FileUpload/CQMS/ProjectHighlightsSite&menuId={1}", this.Id, BLL.Const.ProjectHighlightsSitePicMenuId))); } protected void btnSave_Click(object sender, EventArgs e) { SaveDate(); } /// /// 保存 /// public void SaveDate() { Model.CQMS_ProjectHighlightsSitePic model = new Model.CQMS_ProjectHighlightsSitePic(); model.Id = this.Id; model.Resume = this.txtResume.Text.Trim(); model.CompileMan = this.CurrUser.UserId; model.CompileManName = this.CurrUser.UserName; model.CompileDate = DateTime.Now; var attachFile = Funs.DB.AttachFile.FirstOrDefault(x => x.ToKeyId == this.Id); if (attachFile != null) { model.PicUrl = attachFile.AttachUrl; } else { Alert.ShowInTop("请上传项目亮点照片", MessageBoxIcon.Warning); return; } ProjectHighlightsSiteService.UpdateProjectHighlightsSite(model); LogService.AddSys_Log(CurrUser, $"{model.MainTypeName}-{model.SubType}", model.Id, Const.ProjectHighlightsSitePicMenuId, "维护项目亮点"); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } } }