コード例 #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (!IsValid)
        {
            return;
        }

        try
        {
            txtOpSubject.Text      = txtOpSubject.Text.Trim();
            txtEnglishSubject.Text = txtEnglishSubject.Text.Trim();
            txtIconImageFile.Text  = txtIconImageFile.Text.Trim();
            txtLinkUrl.Text        = txtLinkUrl.Text.Trim();
            txtCommonClass.Text    = txtCommonClass.Text.Trim();

            OpParams param = new OpParams()
            {
                SortNo         = Convert.ToInt32(txtSortNo.Text),
                OpSubject      = txtOpSubject.Text,
                EnglishSubject = txtEnglishSubject.Text,
                IconImageFile  = txtIconImageFile.Text,
                LinkUrl        = txtLinkUrl.Text,
                IsNewWindow    = chkIsNewWindow.Checked,
                IsHideSelf     = chkIsHideSelf.Checked,
                CommonClass    = txtCommonClass.Text,
                PostAccount    = c.GetEmpAccount()
            };

            bool result = false;

            if (c.qsAct == ConfigFormAction.add)
            {
                param.ParentId = c.qsId;
                result         = empAuth.InsertOperationData(param);

                if (!result)
                {
                    Master.ShowErrorMsg(Resources.Lang.ErrMsg_AddFailed);
                }
            }
            else if (c.qsAct == ConfigFormAction.edit)
            {
                param.OpId = c.qsId;
                result     = empAuth.UpdateOperaionData(param);

                if (!result)
                {
                    Master.ShowErrorMsg(Resources.Lang.ErrMsg_UpdateFailed);
                }
            }

            if (result)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "", StringUtility.GetNoticeOpenerJs("Config"), true);
            }

            //新增後端操作記錄
            empAuth.InsertBackEndLogData(new BackEndLogData()
            {
                EmpAccount  = c.GetEmpAccount(),
                Description = string.Format(".{0} .儲存後端作業選項/Save operation[{1}][{2}] OpId[{3}] 結果/result[{4}]", Title, txtOpSubject.Text, txtEnglishSubject.Text, param.OpId, result),
                IP          = c.GetClientIP()
            });
        }
        catch (Exception ex)
        {
            c.LoggerOfUI.Error("", ex);
            Master.ShowErrorMsg(ex.Message);
        }
    }