예제 #1
0
    protected void Btnedit_Click(object sender, EventArgs e)
    {
        string fckstr = mcontent.InnerText;
        string mtitle = Texttitle.Text.Trim();

        if (mtitle != "" && fckstr != "")
        {
            if (Request.QueryString["Mcid"] != null && Request.QueryString["Mid"] != null)
            {
                Labelmsg.Text = "无";
                string Mcid = Request.QueryString["Mcid"].ToString();
                string Mid  = Request.QueryString["Mid"].ToString();
                LearnSite.Model.TxtForm tmode = new LearnSite.Model.TxtForm();
                tmode.Mid      = Int32.Parse(Mid);
                tmode.Mcid     = Int32.Parse(Mcid);
                tmode.Mtitle   = mtitle;
                tmode.Mpublish = CheckPublish.Checked;
                tmode.Mcontent = HttpUtility.HtmlEncode(fckstr);
                tmode.Mdate    = DateTime.Now;
                tmode.Mhit     = 0;
                tmode.Mdelete  = false;
                LearnSite.BLL.TxtForm tfmbll = new LearnSite.BLL.TxtForm();
                tfmbll.Update(tmode);

                //string msg = tmode.Mtitle + "<br>\r\n" + tmode.Mcontent + "<br>\r\n" + tmode.Mdate.ToString() + "<br>\r\n" + tmode.Mpublish.ToString() + "<br>\r\n" + Mid;
                // Labelmsg.Text = msg;

                LearnSite.Model.ListMenu lmodel = new LearnSite.Model.ListMenu();
                LearnSite.BLL.ListMenu   lbll   = new LearnSite.BLL.ListMenu();

                lmodel.Lcid   = Int32.Parse(Mcid);
                lmodel.Lxid   = Int32.Parse(Mid);
                lmodel.Ltype  = 4;
                lmodel.Lshow  = CheckPublish.Checked;
                lmodel.Ltitle = mtitle;
                lbll.UpdateMenuThree(lmodel);

                System.Threading.Thread.Sleep(500);
                string url = "~/Teacher/txtformshow.aspx?Mcid=" + Mcid + "&Mid=" + Mid;
                Response.Redirect(url, false);
            }
            else
            {
                Labelmsg.Text = "取不到表单编号Mid!";
            }
        }
        else
        {
            Labelmsg.Text = "内容及标题不能为空!";
        }
    }
예제 #2
0
    protected void Btnedit_Click(object sender, EventArgs e)
    {
        string fckstr = mcontent.InnerText;

        if (Texttitle.Text != "" && fckstr != "")
        {
            if (Request.QueryString["Mcid"] != null && Request.QueryString["Mid"] != null)
            {
                string Mcid    = Request.QueryString["Mcid"].ToString();
                string Mid     = Request.QueryString["Mid"].ToString();
                string Example = HlExample.NavigateUrl;
                if (Fupload.HasFile)
                {
                    string savePath      = LearnSite.Store.CourseStore.GetSaveUrl("Course", Mcid);
                    string sbfilename    = Fupload.FileName;
                    string shortFileName = Path.GetFileName(sbfilename);
                    string savefilename  = savePath + shortFileName;
                    string sbpath        = this.Server.MapPath(savefilename);
                    Fupload.SaveAs(sbpath);
                    Example = savefilename;
                }
                LearnSite.Model.Mission mission = new LearnSite.Model.Mission();
                mission.Mid        = Int32.Parse(Mid);
                mission.Mtitle     = Texttitle.Text.Trim();
                mission.Mupload    = true;
                mission.Mcategory  = 2;       //编程页面
                mission.Mexample   = Example; //编程实例
                mission.Microworld = CheckMicoWorld.Checked;
                mission.Mpublish   = CheckPublish.Checked;
                mission.Mcontent   = HttpUtility.HtmlEncode(fckstr);
                mission.Mfiletype  = "sb2";
                mission.Mdate      = DateTime.Now;
                mission.Mhit       = 0;
                mission.Mgroup     = false;
                if (DDLMgid.SelectedValue != "")
                {
                    mission.Mgid = Int32.Parse(DDLMgid.SelectedValue);
                }
                else
                {
                    mission.Mgid = 0;
                }
                LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission();
                missionbll.Update(mission);

                LearnSite.Model.ListMenu lmodel = new LearnSite.Model.ListMenu();
                LearnSite.BLL.ListMenu   lbll   = new LearnSite.BLL.ListMenu();

                lmodel.Lcid   = Int32.Parse(Mcid);
                lmodel.Lxid   = Int32.Parse(Mid);
                lmodel.Ltype  = 5;//页面类型为5 编程
                lmodel.Lshow  = CheckPublish.Checked;
                lmodel.Ltitle = Texttitle.Text.Trim();
                lbll.UpdateMenuThree(lmodel);
                System.Threading.Thread.Sleep(500);
                string url = "~/Teacher/programshow.aspx?Mcid=" + Mcid + "&Mid=" + Mid;
                Response.Redirect(url, false);
            }
            else
            {
                Labelmsg.Text = "取不到主题编号Mid!";
            }
        }
        else
        {
            Labelmsg.Text = "内容及标题不能为空!";
        }
    }