Esempio n. 1
0
        /// <summary>
        /// 保存事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void EBtnSubmit_Click(object sender, EventArgs e)
        {
            string[] cont = GetContent();
            bq = new B_Exam_Sys_Questions();
            int id = DataConverter.CLng(hfpid.Value);
            M_Exam_Sys_Questions questions = bq.GetSelect(id);

            questions.p_Shipin        = hffilename.Value;
            questions.p_shuming       = this.shuming.Text;
            questions.p_Content       = this.txtP_Content.Text;
            questions.p_ChoseNum      = DataConverter.CLng(ddlNumber1.SelectedValue);
            questions.p_defaultScores = DataConverter.CFloat(txtCourse.Text);
            if (cont != null && cont.Length > 0)
            {
                questions.p_Answer = cont[1];
            }
            if (cont != null && cont.Length > 0)
            {
                SafeSC.WriteFile(M_Exam_Sys_Questions.OptionDir + id + ".opt", cont[0]);
            }
            //questions.p_Optioninfo = cont[0];
            if (id > 0) //修改
            {
                bool result = bq.GetUpdate(questions);
                if (result)
                {
                    function.WriteSuccessMsg("修改成功!");
                    Response.Write("<script>window.close();</script>");
                }
                else
                {
                    function.WriteErrMsg("修改失败!");
                }
            }
            else  //添加
            {
                questions.p_Type       = DataConverter.CLng(ddlType.SelectedValue);
                questions.p_Inputer    = badmin.GetAdminLogin().AdminName; //当前登录ID
                questions.p_CreateTime = DateTime.Now.Date;
                questions.p_Views      = 1;
                questions.parentId     = DataConverter.CLng(hfParentId.Value);
                int result = bq.GetInsert(questions);
                if (result > 0)
                {
                    Response.Write("<script>alert('添加成功!');window.close();</script>");
                }
                else
                {
                    function.WriteErrMsg("添加失败!");
                }
            }
        }