protected void Btnadd_Click(object sender, EventArgs e) { string fckstr = FCKeditor1.Value; if (Texttitle.Text != "" && fckstr != "") { if (Request.QueryString["Mcid"] != null) { string serverUrl = LearnSite.Common.WordProcess.ServerUrl(); fckstr = fckstr.Replace(serverUrl, ""); int Mcid = Int32.Parse(Request.QueryString["Mcid"].ToString()); int Msort = Int32.Parse(DDLsort.SelectedValue); LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission(); if (!missionbll.MsortExists(Mcid, Msort)) { LearnSite.Model.Mission mission = new LearnSite.Model.Mission(); mission.Mcid = Mcid; mission.Mtitle = Texttitle.Text.Trim(); mission.Msort = Msort; mission.Mupload = CheckUpload.Checked; mission.Mpublish = CheckPublish.Checked; mission.Mcontent = HttpUtility.HtmlEncode(fckstr); mission.Mfiletype = DDLmfiletype.SelectedValue; mission.Mdate = DateTime.Now; mission.Mhit = 0; missionbll.Add(mission); Texttitle.Text = ""; FCKeditor1.Value = ""; System.Threading.Thread.Sleep(1000); Labelmsg.Text = "添加课程活动成功"; string url = "~/Teacher/courseshow.aspx?Cid=" +Mcid.ToString(); Response.Redirect(url, false); } else { Labelmsg.Text = "该课程活动序号已经存在,请重新选择"; } } } else { Labelmsg.Text = "内容及标题不能为空!"; } }
protected void Btnadd_Click(object sender, EventArgs e) { string fckstr = Request.Form["textareaItem"].Trim(); if (Texttitle.Text != "" && fckstr != "") { if (Request.QueryString["Mcid"] != null) { string Mcidstr = Request.QueryString["Mcid"].ToString(); int Mcid = Int32.Parse(Mcidstr); LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission(); LearnSite.BLL.ListMenu lbll = new LearnSite.BLL.ListMenu(); int maxSort = lbll.GetMaxLsort(Mcid) + 1; string exampleurl = "~/Statics/cat.sb2";//实例路径 if (Fupload.HasFile) { string sbfilename = Fupload.FileName; string savePath = LearnSite.Store.CourseStore.GetSaveUrl("Course", Mcidstr); string shortFileName = Path.GetFileName(sbfilename); string savefilename = savePath + shortFileName; string sbpath = this.Server.MapPath(savefilename); Fupload.SaveAs(sbpath); exampleurl = savefilename; } LearnSite.Model.Mission mission = new LearnSite.Model.Mission(); mission.Mcid = Mcid; mission.Mtitle = Texttitle.Text.Trim(); mission.Msort = maxSort; mission.Mupload = true; mission.Mcategory = 2;//编程页面 mission.Mexample = exampleurl;//编程实例 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; } int mid = missionbll.Add(mission); LearnSite.Model.ListMenu lmodel = new LearnSite.Model.ListMenu(); lmodel.Lcid = Mcid; lmodel.Lshow = CheckPublish.Checked; lmodel.Lsort = maxSort; lmodel.Ltitle = Texttitle.Text.Trim(); lmodel.Ltype = 5;//页面类型为5 编程 lmodel.Lxid = mid; lbll.Add(lmodel); System.Threading.Thread.Sleep(500); string url = "~/Teacher/courseshow.aspx?Cid=" + Mcid.ToString(); Response.Redirect(url, false); } } else { Labelmsg.Text = "请填写标题或选择实例!"; } }
protected void Btnadd_Click(object sender, EventArgs e) { string fckstr = Request.Form["textareaItem"].Trim(); if (Texttitle.Text != "" && fckstr != "") { if (Request.QueryString["Mcid"] != null) { string Mcidstr = Request.QueryString["Mcid"].ToString(); int Mcid = Int32.Parse(Mcidstr); string coursePath = LearnSite.Store.CourseStore.CoursePath(Mcidstr); if (CheckRemote.Checked) { fckstr = LearnSite.Common.ImageDown.UploadRemote(fckstr, coursePath); } LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission(); LearnSite.Model.Mission mission = new LearnSite.Model.Mission(); LearnSite.BLL.ListMenu lbll = new LearnSite.BLL.ListMenu(); int maxSort = lbll.GetMaxLsort(Mcid) + 1; mission.Mcid = Mcid; mission.Mtitle = Texttitle.Text.Trim(); mission.Msort = maxSort; bool uploadcan = CheckUpload.Checked; mission.Mupload = uploadcan; if (uploadcan) { mission.Mcategory = 0;//有作业提交 } else { mission.Mcategory = 1;//无作业提交 } mission.Mexample = ""; mission.Mpublish = CheckPublish.Checked; mission.Mcontent = HttpUtility.HtmlEncode(fckstr); mission.Mfiletype = DDLmfiletype.SelectedValue; mission.Mdate = DateTime.Now; mission.Mhit = 0; mission.Mgroup = CheckGroup.Checked; if (DDLMgid.SelectedValue != "") { mission.Mgid = Int32.Parse(DDLMgid.SelectedValue); } else { mission.Mgid = 0; } int mid = missionbll.Add(mission); LearnSite.Model.ListMenu lmodel = new LearnSite.Model.ListMenu(); lmodel.Lcid = Mcid; lmodel.Lshow = CheckPublish.Checked; lmodel.Lsort = maxSort; lmodel.Ltitle = Texttitle.Text.Trim(); if (uploadcan) { lmodel.Ltype = 1; } else { lmodel.Ltype = 6;//描述页面 } lmodel.Lxid = mid; lbll.Add(lmodel); System.Threading.Thread.Sleep(500); //Labelmsg.Text = "添加学案活动成功"; string url = "~/Teacher/courseshow.aspx?Cid=" + Mcid.ToString(); Response.Redirect(url, false); } } else { Labelmsg.Text = "内容及标题不能为空!"; } }