protected void Page_Load(object sender, EventArgs e) { if (!artPicMgr.Initialize(c.qsPicId, c.qsArtId)) { string errMsg = ResUtility.GetErrMsgOfAttFileErrState(artPicMgr.GetErrState()); Master.ShowErrorMsg(errMsg); return; } if (!IsPostBack) { // Authenticate if (!empAuth.CanEditThisPage()) { string jsClose = "closeThisForm();"; ClientScript.RegisterStartupScript(this.GetType(), "invalid", jsClose, true); return; } LoadUIData(); DisplayArticlePictureData(); txtSortNo.Focus(); } LoadTitle(); }
protected void btnSave_Click(object sender, EventArgs e) { Master.ShowErrorMsg(""); if (!IsValid) { return; } if (c.qsAct == ConfigFormAction.add && !fuPickedFile.HasFile) { return; } try { bool result = false; txtPicSubjectZhTw.Text = txtPicSubjectZhTw.Text.Trim(); txtPicSubjectEn.Text = txtPicSubjectEn.Text.Trim(); artPicMgr.SortNo = Convert.ToInt32(txtSortNo.Text); artPicMgr.AttSubjectZhTw = txtPicSubjectZhTw.Text; artPicMgr.AttSubjectEn = txtPicSubjectEn.Text; artPicMgr.IsShowInLangZhTw = chkIsShowInLangZhTw.Checked; artPicMgr.IsShowInLangEn = chkIsShowInLangEn.Checked; result = artPicMgr.SaveData(fuPickedFile, c.GetEmpAccount()); if (result) { ClientScript.RegisterStartupScript(this.GetType(), "", StringUtility.GetNoticeOpenerJs("Picture"), true); } else { string errMsg = ResUtility.GetErrMsgOfAttFileErrState(artPicMgr.GetErrState()); if (errMsg == "") { errMsg = Resources.Lang.ErrMsg_SaveFailed; } Master.ShowErrorMsg(errMsg); } //新增後端操作記錄 string description = string.Format(".{0} .儲存網頁照片/Save article picture[{1}][{2}]" + " 有檔案/has file[{3}] PicId[{4}] 結果/result[{5}]", Title, txtPicSubjectZhTw.Text, txtPicSubjectEn.Text, fuPickedFile.HasFile, artPicMgr.AttId, result); empAuth.InsertBackEndLogData(new BackEndLogData() { EmpAccount = c.GetEmpAccount(), Description = description, IP = c.GetClientIP() }); } catch (Exception ex) { c.LoggerOfUI.Error("", ex); Master.ShowErrorMsg(ex.Message); } }