Esempio n. 1
0
        //第1个标签:结束
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtTitle.Text.Trim().Length == 0 || Textarea1.Value.Trim().Length == 0)
            {
                Javascript.GoHistory(-1, "标题和内容不能为空,请输入!", Page);
                Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page);
            }
            else
            {
                DalOperationAboutEnglishExam dalOperationAboutEnglishExam = new DalOperationAboutEnglishExam();
                EnglishExamNotify englishExamNotify = new EnglishExamNotify();
                englishExamNotify.englishExamNotifyTitle = txtTitle.Text.Trim();
                englishExamNotify.englishExamNotifyContent = Textarea1.Value.Trim();
                englishExamNotify.deadLineTime = Convert.ToDateTime(datepicker.Value.Trim());
                englishExamNotify.locale = ddlLocale.SelectedValue;

                //以下提交附件的判断与相关操作
                if (hidAttachmentId.Value.CompareTo(string.Empty) != 0)
                {
                    englishExamNotify.attachmentIds = hidAttachmentId.Value;//保存了附件并且返回了attachmentId(自增长类型主键)
                }

                try
                {
                    dalOperationAboutEnglishExam.AddEnglishExamNotify(englishExamNotify);//保存通知
                    Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page);
                    Javascript.AlertAndRedirect("添加成功!", "/Administrator/EnglishExamManage.aspx?fragment=1", Page);
                }
                catch (Exception ex)
                {
                    MongoDBLog.LogRecord(ex);
                    Javascript.ExcuteJavascriptCode("delBeforeUnloadEvent();", Page);
                    Javascript.GoHistory(-1, "添加失败,请检查格式是否有误!", Page);
                }

            }
        }