private void showmission() { string Mcid = Request.QueryString["Mcid"].ToString(); string Mid = Request.QueryString["Mid"].ToString(); LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { LabelMtitle.Text = model.Mtitle; CheckPublish.Checked = model.Mpublish; Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent); LabelMdate.Text = model.Mdate.ToString(); LabelMfiletype.Text = model.Mfiletype; ImageType.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif"; CkMupload.Checked = model.Mupload; CheckGroup.Checked = model.Mgroup; int Mgid = model.Mgid.Value; if (Mgid != 0) { HLMgid.NavigateUrl = "~/Teacher/GaugeItem.aspx?Gid=" + Mgid.ToString(); } } }
private void showmission() { string Mcid = Request.QueryString["Mcid"].ToString(); string Mid = Request.QueryString["Mid"].ToString(); LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { LabelMtitle.Text = model.Mtitle; Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent); string sburl = model.Mexample; Hlexample.NavigateUrl = sburl; Hlexample.Text = LearnSite.Common.WordProcess.getshortfname(sburl); CheckPublish.Checked = model.Mpublish; CheckMicoWorld.Checked = model.Microworld; LabelMdate.Text = model.Mdate.ToString(); LabelMfiletype.Text = model.Mfiletype; ImageType.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif"; int Mgid = model.Mgid.Value; if (Mgid != 0) { HLMgid.NavigateUrl = "~/Teacher/GaugeItem.aspx?Gid=" + Mgid.ToString(); } } }
private void ShowMission() { string Mid = Request.QueryString["Mid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Mid)) { LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { LabelMtitle.Text = model.Mtitle; Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent); string exampleurl = model.Mexample; string ext = LearnSite.Common.WordProcess.getext(exampleurl); if (!ext.Contains("sb")) { BtnScratch.Visible = false; Labelmsg.Text = ext + "请检查学案的实例是否为Scratch格式(sb,sb2,sbx)"; } } else { Mcontent.InnerHtml = "此学案活动不存在!"; } } }
/// <summary> /// ��������б� /// </summary> public List<LearnSite.Model.Mission> DataTableToList(DataTable dt) { List<LearnSite.Model.Mission> modelList = new List<LearnSite.Model.Mission>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Mission model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Mission(); if(dt.Rows[n]["Mid"].ToString()!="") { model.Mid=int.Parse(dt.Rows[n]["Mid"].ToString()); } model.Mtitle=dt.Rows[n]["Mtitle"].ToString(); if(dt.Rows[n]["Mcid"].ToString()!="") { model.Mcid=int.Parse(dt.Rows[n]["Mcid"].ToString()); } model.Mcontent=dt.Rows[n]["Mcontent"].ToString(); if(dt.Rows[n]["Mdate"].ToString()!="") { model.Mdate=DateTime.Parse(dt.Rows[n]["Mdate"].ToString()); } if(dt.Rows[n]["Mhit"].ToString()!="") { model.Mhit=int.Parse(dt.Rows[n]["Mhit"].ToString()); } model.Mfiletype=dt.Rows[n]["Mfiletype"].ToString(); if(dt.Rows[n]["Mupload"].ToString()!="") { if((dt.Rows[n]["Mupload"].ToString()=="1")||(dt.Rows[n]["Mupload"].ToString().ToLower()=="true")) { model.Mupload=true; } else { model.Mupload=false; } } if(dt.Rows[n]["Msort"].ToString()!="") { model.Msort=int.Parse(dt.Rows[n]["Msort"].ToString()); } if(dt.Rows[n]["Mpublish"].ToString()!="") { if((dt.Rows[n]["Mpublish"].ToString()=="1")||(dt.Rows[n]["Mpublish"].ToString().ToLower()=="true")) { model.Mpublish=true; } else { model.Mpublish=false; } } modelList.Add(model); } } return modelList; }
private void ShowMission() { string Mid = Request.QueryString["Mid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Mid)) { LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { string sWcid = model.Mcid.ToString(); string sWmid = Mid; string sWmsort = model.Msort.ToString(); string sWfiletype = model.Mfiletype; LabelMtitle.Text = model.Mtitle; Mcontents.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent); LabelMdate.Text = model.Mdate.Value.ToShortDateString(); LabelMfiletype.Text = sWfiletype; CkMupload.Checked = model.Mupload; CkMgroup.Checked = model.Mgroup; ImageType.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif"; } else { Mcontents.InnerHtml = "此学案活动不存在!"; } } }
private void ShowMission() { string Mid = Request.QueryString["Mid"].ToString(); string Cid = Request.QueryString["Cid"].ToString(); Id = Cid + "-" + Mid; int mill = DateTime.Now.Millisecond; Fpage = "program.aspx?Cid=" + Cid + "&Mid=" + Mid + "&Mill=" + mill; if (LearnSite.Common.WordProcess.IsNum(Mid)) { LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); string Sname = cook.Sname; string Snum = cook.Snum; this.Page.Title = HttpUtility.UrlDecode(Sname) + " " + model.Mtitle + "—>" + DateTime.Now.ToString(); Microworld = model.Microworld.ToString().ToLower(); Mcontents = HttpUtility.HtmlDecode(model.Mcontent); Owner = HttpUtility.UrlDecode(Sname); Titles = model.Mtitle; Filename = LearnSite.Common.WordProcess.getshortfname(model.Mexample); LearnSite.BLL.Works wbll = new LearnSite.BLL.Works(); if (!Snum.Contains("s")) { if (wbll.ExistsMyMissonWork(Int32.Parse(Mid), Snum)) { Filename = Owner + " " + Filename; } } else { Owner = "老师"; } } } }
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 = "内容及标题不能为空!"; } }
private void ShowMission() { string Mid = Request.QueryString["Mid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Mid)) { LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { LabelMtitle.Text = model.Mtitle; Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent); } else { Mcontent.InnerHtml = "此学案活动不存在!"; } } }
private void missionview() { if (Request.QueryString["Mid"] != null) { int Mid = Int32.Parse(Request.QueryString["Mid"].ToString()); LearnSite.Model.Mission mission = new LearnSite.Model.Mission(); LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission(); mission = missionbll.GetModel(Mid); mcontent.InnerText = HttpUtility.HtmlDecode(mission.Mcontent); DDLmfiletype.SelectedValue = mission.Mfiletype; CheckPublish.Checked = mission.Mpublish; Texttitle.Text = mission.Mtitle; CheckUpload.Checked = mission.Mupload; CheckGroup.Checked = mission.Mgroup; string mgid = mission.Mgid.ToString(); if (DDLMgid.Items.FindByValue(mgid) != null) { DDLMgid.SelectedValue = mgid; } } }
protected void Btnedit_Click(object sender, EventArgs e) { string fckstr = FCKeditor1.Value; if (Texttitle.Text != "" && fckstr != "") { if (Request.QueryString["Mcid"] != null && Request.QueryString["Mid"] != null) { string serverUrl = LearnSite.Common.WordProcess.ServerUrl(); fckstr = fckstr.Replace(serverUrl, ""); string Mcid = Request.QueryString["Mcid"].ToString(); string Mid = Request.QueryString["Mid"].ToString(); LearnSite.Model.Mission mission = new LearnSite.Model.Mission(); mission.Mid = Int32.Parse(Mid); mission.Mtitle = Texttitle.Text.Trim(); mission.Msort = Int32.Parse(DDLsort.SelectedValue); mission.Mupload = CheckUpload.Checked; mission.Mpublish = CheckPublish.Checked; mission.Mcontent = HttpUtility.HtmlEncode(fckstr); mission.Mfiletype = DDLmfiletype.SelectedValue; mission.Mdate = DateTime.Now; mission.Mhit = 0; LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission(); missionbll.Update(mission); Texttitle.Text = ""; FCKeditor1.Value = ""; System.Threading.Thread.Sleep(1000); Labelmsg.Text = "添加活动成功"; string url = "~/Teacher/missionshow.aspx?Mcid=" + Mcid + "&Mid=" + Mid; Response.Redirect(url, false); } else { Labelmsg.Text = "取不到活动编号Mid!"; } } else { Labelmsg.Text = "内容及标题不能为空!"; } }
private void showmission() { string Mcid = Request.QueryString["Mcid"].ToString(); string Mid = Request.QueryString["Mid"].ToString(); LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { LabelMtitle.Text = model.Mtitle; LabelMcid.Text = model.Mcid.ToString(); Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent); LabelMdate.Text = model.Mdate.ToString(); LabelMfiletype.Text = model.Mfiletype; ImageType.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif"; CheckBoxMupload.Checked = model.Mupload; LabelMsort.Text = model.Msort.ToString(); GVmission.DataSource = mn.GetMissions(Int32.Parse(Mcid)); GVmission.DataBind(); } }
private void missionview() { if (Request.QueryString["Mid"] != null) { int Mid = Int32.Parse(Request.QueryString["Mid"].ToString()); LearnSite.Model.Mission mission = new LearnSite.Model.Mission(); LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission(); mission = missionbll.GetModel(Mid); CheckPublish.Checked = mission.Mpublish; Texttitle.Text = mission.Mtitle; mcontent.InnerText = HttpUtility.HtmlDecode(mission.Mcontent); string sburl = mission.Mexample; CheckMicoWorld.Checked = mission.Microworld; string filename = LearnSite.Common.WordProcess.getshortfname(sburl); HlExample.Text = filename; HlExample.NavigateUrl = sburl; string mgid = mission.Mgid.ToString(); if (DDLMgid.Items.FindByValue(mgid) != null) { DDLMgid.SelectedValue = mgid; } } }
/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.Mission> DataTableToList(DataTable dt) { List <LearnSite.Model.Mission> modelList = new List <LearnSite.Model.Mission>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Mission model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Mission(); if (dt.Rows[n]["Mid"].ToString() != "") { model.Mid = int.Parse(dt.Rows[n]["Mid"].ToString()); } model.Mtitle = dt.Rows[n]["Mtitle"].ToString(); if (dt.Rows[n]["Mcid"].ToString() != "") { model.Mcid = int.Parse(dt.Rows[n]["Mcid"].ToString()); } model.Mcontent = dt.Rows[n]["Mcontent"].ToString(); if (dt.Rows[n]["Mdate"].ToString() != "") { model.Mdate = DateTime.Parse(dt.Rows[n]["Mdate"].ToString()); } if (dt.Rows[n]["Mhit"].ToString() != "") { model.Mhit = int.Parse(dt.Rows[n]["Mhit"].ToString()); } model.Mfiletype = dt.Rows[n]["Mfiletype"].ToString(); if (dt.Rows[n]["Mupload"].ToString() != "") { if ((dt.Rows[n]["Mupload"].ToString() == "1") || (dt.Rows[n]["Mupload"].ToString().ToLower() == "true")) { model.Mupload = true; } else { model.Mupload = false; } } if (dt.Rows[n]["Msort"].ToString() != "") { model.Msort = int.Parse(dt.Rows[n]["Msort"].ToString()); } if (dt.Rows[n]["Mpublish"].ToString() != "") { if ((dt.Rows[n]["Mpublish"].ToString() == "1") || (dt.Rows[n]["Mpublish"].ToString().ToLower() == "true")) { model.Mpublish = true; } else { model.Mpublish = false; } } if (dt.Rows[n]["Mgroup"].ToString() != "") { if ((dt.Rows[n]["Mgroup"].ToString() == "1") || (dt.Rows[n]["Mgroup"].ToString().ToLower() == "true")) { model.Mgroup = true; } else { model.Mgroup = false; } } if (dt.Rows[n]["Mgid"] != null && dt.Rows[n]["Mgid"].ToString() != "") { model.Mgid = int.Parse(dt.Rows[n]["Mgid"].ToString()); } modelList.Add(model); } } return(modelList); }
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 && Request.QueryString["Lid"] != null) { string Mcid = Request.QueryString["Mcid"].ToString(); string Mid = Request.QueryString["Mid"].ToString(); string Lid = Request.QueryString["Lid"].ToString(); string coursePath = LearnSite.Store.CourseStore.CoursePath(Mcid); if (CheckRemote.Checked) { fckstr = LearnSite.Common.ImageDown.UploadRemote(fckstr, coursePath); } LearnSite.Model.Mission mission = new LearnSite.Model.Mission(); mission.Mid = Int32.Parse(Mid); mission.Mtitle = Texttitle.Text.Trim(); 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; } 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.Lid = Int32.Parse(Lid); if (uploadcan) { lmodel.Ltype = 1; } else { lmodel.Ltype = 6;//描述页面 } lmodel.Lshow = CheckPublish.Checked; lmodel.Ltitle = Texttitle.Text.Trim(); lbll.UpdateMenuMission(lmodel);//专用活动分类更新 System.Threading.Thread.Sleep(500); string url = "~/Teacher/missionshow.aspx?Mcid=" + Mcid + "&Mid=" + Mid + "&Lid=" + Lid; Response.Redirect(url, false); } else { Labelmsg.Text = "取不到活动编号Mid!"; } } else { Labelmsg.Text = "内容及标题不能为空!"; } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.Mission model) { return(dal.Add(model)); }
/// <summary> /// 更新一条数据(无mcid) /// </summary> public void Update(LearnSite.Model.Mission model) { dal.Update(model); }
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 = "内容及标题不能为空!"; } }
private void uploadthiswork() { HttpPostedFile work_upload = Request.Files["imgFile"]; int maxSize = 104857600;//定义上传最大值为100MB if (work_upload != null) { string Wmid = Request.QueryString["mid"].ToString(); string Wnum = Request.QueryString["num"].ToString(); LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission(); LearnSite.Model.Mission mmodel = new LearnSite.Model.Mission(); mmodel = mbll.GetModel(Int32.Parse(Wmid)); string Wcid = mmodel.Mcid.ToString(); string Wmsort = mmodel.Msort.ToString(); string Wfiletype = work_upload.FileName.Substring(work_upload.FileName.LastIndexOf(".") + 1).ToLower(); string Wextention = mmodel.Mfiletype; string limitext = Wextention;//初始化,随意 switch (Wextention) { case "doc": limitext = "*.doc;*.docx"; break; case "ppt": limitext = "*.ppt;*.pptx"; break; case "xls": limitext = "*.xls;*.xlsx"; break; case "office": limitext = "*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx"; break; case "sb": limitext = "*.sb;*.sb2"; break; default: limitext = "*." + Wextention; break; } if (Wfiletype == Wextention || limitext.Contains(Wfiletype)) { if (work_upload.InputStream != null || work_upload.InputStream.Length < maxSize) { int Wlength = work_upload.ContentLength; string Syear = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString(); string Sgrade = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString(); string Sclass = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString(); string Wsid = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sid"].ToString(); string Wip = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["LoginIp"].ToString(); string Sname = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sname"].ToString(); string Wterm = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["ThisTerm"].ToString(); DateTime Wdate = DateTime.Now; bool checkcan = true; LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); string Wid = ws.WorkDone(Wnum, Int32.Parse(Wcid), Int32.Parse(Wmid));//返回空字符表示不存在该记录 if (Wid != "") { if (!ws.IsChecked(Int32.Parse(Wid))) { //如果未评价,则重新提交修改作品 string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建) string RndTime = LearnSite.Common.WordProcess.GetRandomNum(99).ToString(); string OnlyFileName = Wnum + "_" + Wcid + "_" + Wmid + "_" + RndTime; string NewFileName = OnlyFileName + "." + Wfiletype; string Wurl = MySavePath + "/" + NewFileName; string resaveFilename = Server.MapPath(Wurl); ws.UpdateWorkUp(Int32.Parse(Wid), Wurl, NewFileName, Wlength, Wdate, checkcan, ""); //更新Wfilename, Wurl,Wlength, Wdate LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); sn.UpdateQwork(Int32.Parse(Wsid), Int32.Parse(Wcid)); //更新今天签到表中的作品数量 work_upload.SaveAs(resaveFilename); //保存提交作品 Hashtable hash = new Hashtable(); hash["error"] = 0; Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); Response.Write(JsonMapper.ToJson(hash)); Response.End(); } else { showError("老师已经评价了!"); } } else { //如果作品未提交,提交作品(Wnum, Wcid,Wmid,Wmsort, Wfilename, Wurl,Wlength, Wdate, Wip, Wtime) string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建) string RndTime = LearnSite.Common.WordProcess.GetRandomNum(99).ToString(); string OnlyFileName = Wnum + "_" + Wcid + "_" + Wmid + "_" + RndTime; string NewFileName = OnlyFileName + "." + Wfiletype; string Wurl = MySavePath + "/" + NewFileName; string Wtime = LearnSite.Common.Computer.TimePassed().ToString(); LearnSite.Model.Works wmodel = new LearnSite.Model.Works(); wmodel.Wnum = Wnum; wmodel.Wcid = Int32.Parse(Wcid); wmodel.Wmid = Int32.Parse(Wmid); wmodel.Wmsort = Int32.Parse(Wmsort); wmodel.Wfilename = NewFileName; wmodel.Wtype = Wextention; wmodel.Wurl = Wurl; wmodel.Wlength = Wlength; wmodel.Wdate = Wdate; wmodel.Wip = Wip; wmodel.Wtime = Wtime; wmodel.Wcan = checkcan; wmodel.Wcheck = false; wmodel.Wegg = 12;//设定票数为12张 wmodel.Whit = 0; wmodel.Wgrade = Int32.Parse(Sgrade); wmodel.Wterm = Int32.Parse(Wterm); wmodel.Wsid = Int32.Parse(Wsid); wmodel.Wclass = Int32.Parse(Sclass); wmodel.Wname = HttpUtility.UrlDecode(Sname); wmodel.Wyear = Int32.Parse(Syear); switch (Wfiletype) { case "doc": case "ppt": case "xls": case "docx": case "pptx": case "xlsx": case "wps": case "dps": case "et": wmodel.Woffice = true; break; default: wmodel.Woffice = false; break; } wmodel.Wflash = false; wmodel.Werror = false; string saveFilename = Server.MapPath(Wurl); ws.AddWorkUp(wmodel); //添加作品提交记录 LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); sn.UpdateQwork(Int32.Parse(Wsid), Int32.Parse(Wcid)); //更新今天签到表中的作品数量 work_upload.SaveAs(saveFilename); //保存提交作品 Hashtable hash = new Hashtable(); hash["error"] = 0; Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); Response.Write(JsonMapper.ToJson(hash)); Response.End(); } } else { showError("选择的文件大小超过限制!(最大为100MB)"); } } else { showError("选择的文件类型错误!"); } } else { showError("请选择文件!"); } }
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 = "内容及标题不能为空!"; } }
/// <summary> /// 显示信息 /// </summary> private void ShowInfo() { string Studentnum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString(); int MySgrade = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString()); int MySclass = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString()); int MySyear = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString()); int MySgroup = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgroup"].ToString()); if (MySgroup == 0) { Labelscope.Text = "全班"; } else { Labelscope.Text = "组内"; } string Mid = Request.QueryString["Mid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Mid)) { LearnSite.Model.Works wmodel = new LearnSite.Model.Works(); LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission(); LearnSite.Model.Mission mModel = new LearnSite.Model.Mission(); mModel = mbll.GetModel(Int32.Parse(Mid)); ImageWtype.ImageUrl = "~/Images/FileType/" + mModel.Mfiletype + ".gif"; Labelmtitle.Text = "〖" + mModel.Mtitle + "〗"; LabelMgid.Text = mModel.Mgid.ToString(); Labelwmid.Text = Mid; LabelWtype.Text = mModel.Mfiletype; wmodel = ws.GetModelByStu(Int32.Parse(Mid), Studentnum); if (wmodel != null) { DataListvote.DataSource = ws.ShowMissionWorksGroup(MySgrade, MySclass, Int32.Parse(Mid), MySgroup); DataListvote.DataBind(); Labelhow.Text = DataListvote.Items.Count.ToString(); Labelme.Text = wmodel.Wvote.ToString(); string workIp = wmodel.Wip; string worknum = wmodel.Wnum; DateTime workdate = wmodel.Wdate.Value; DateTime nowdate = DateTime.Now; bool worklimit = LearnSite.Common.XmlHelp.GetWorkIpLimit(); Labelegg.Text = wmodel.Wegg.ToString(); Labelwfscore.Text = wmodel.Wfscore.ToString(); TimeSpan ts = nowdate - workdate; int lastday = ts.Days; Labelwdate.Text = lastday.ToString();///取短日期 if (lastday < 30) { if (showRgaugeSet()) { LimitVote();//限制为可预览的投票 } else { Labelmsg.Text = "当前作品互评暂停!"; BtnVote.Enabled = false; } } else { Labelmsg.Text = "一个月前的作品不能再投票了!"; BtnVote.Enabled = false; } } else { if (Studentnum.StartsWith("s")) { DataListvote.DataSource = ws.ShowMissionWorksGroup(MySgrade, MySclass, Int32.Parse(Mid), MySgroup); DataListvote.DataBind(); Labelhow.Text = DataListvote.Items.Count.ToString(); BtnVote.Enabled = true; } else { Labelmsg.Text = "您未提交作品,无法互评!"; BtnVote.Enabled = false; } } } }
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 = "请填写标题或选择实例!"; } }
private void missionview() { if (Request.QueryString["Mid"] != null) { int Mid = Int32.Parse(Request.QueryString["Mid"].ToString()); LearnSite.Model.Mission mission = new LearnSite.Model.Mission(); LearnSite.BLL.Mission missionbll = new LearnSite.BLL.Mission(); mission = missionbll.GetModel(Mid); FCKeditor1.Value = HttpUtility.HtmlDecode(mission.Mcontent); DDLmfiletype.SelectedValue = mission.Mfiletype; CheckPublish.Checked = mission.Mpublish; DDLsort.SelectedValue = mission.Msort.ToString(); Texttitle.Text = mission.Mtitle; CheckUpload.Checked = mission.Mupload; } }
private void uploadthiswork() { if (Request.Files["Filedata"] != null) { try { HttpPostedFile work_upload = Request.Files["Filedata"]; string Wmid = Request.QueryString["mid"].ToString(); string Wnum = Request.QueryString["num"].ToString(); string info = HttpUtility.UrlDecode(Request.QueryString["info"].ToString()); LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission(); LearnSite.Model.Mission mmodel = new LearnSite.Model.Mission(); mmodel = mbll.GetModel(Int32.Parse(Wmid)); string Wcid = mmodel.Mcid.ToString(); string Wmsort = mmodel.Msort.ToString(); string Wfiletype = work_upload.FileName.Substring(work_upload.FileName.LastIndexOf(".") + 1).ToLower(); // string Wextention = mmodel.Mfiletype; int Wlength = work_upload.ContentLength; //Syear | Sgrade | Sclass | Sid | Sname | Wip | Sterm | LoginTime string[] infoarray = info.Split('|'); string Syear = infoarray[0]; string Sgrade = infoarray[1]; string Sclass = infoarray[2]; string Wsid = infoarray[3]; string Sname = infoarray[4]; string Wip = infoarray[5]; string Wterm = infoarray[6]; string Logintime = infoarray[7]; DateTime Wdate = DateTime.Now; bool checkcan = true; LearnSite.BLL.Works ws = new LearnSite.BLL.Works(); string Wid = ws.WorkDone(Wnum, Int32.Parse(Wcid), Int32.Parse(Wmid));//返回空字符表示不存在该记录 if (Wid != "") { if (!ws.IsChecked(Int32.Parse(Wid))) { //如果未评价,则重新提交修改作品 string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建) string RndTime = LearnSite.Common.WordProcess.GetRandomNum(99).ToString(); string OnlyFileName = Wnum + "_" + Wcid + "_" + Wmid + "_" + RndTime; string NewFileName = OnlyFileName + "." + Wfiletype; string Wurl = MySavePath + "/" + NewFileName; string resaveFilename = Server.MapPath(Wurl); try { ws.UpdateWorkUp(Int32.Parse(Wid), Wurl, NewFileName, Wlength, Wdate, checkcan, "");//更新Wfilename, Wurl,Wlength, Wdate //LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); //sn.UpdateQwork(Int32.Parse(Wsid), Int32.Parse(Wcid));//更新今天签到表中的作品数量 work_upload.SaveAs(resaveFilename);//保存提交作品 Response.StatusCode = 200; Response.Write(NewFileName); } catch (Exception ex) { Response.StatusCode = 200; Response.Write(ex); } finally { Response.End(); } } else { Response.StatusCode = 200; Response.Write("老师已经评价了!"); Response.End(); } } else { //如果作品未提交,提交作品(Wnum, Wcid,Wmid,Wmsort, Wfilename, Wurl,Wlength, Wdate, Wip, Wtime) string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Syear, Sgrade, Sclass, Wcid, Wmid);//获得作品保存路径(如果不存在,自动创建) string RndTime = LearnSite.Common.WordProcess.GetRandomNum(99).ToString(); string OnlyFileName = Wnum + "_" + Wcid + "_" + Wmid + "_" + RndTime; string NewFileName = OnlyFileName + "." + Wfiletype; string Wurl = MySavePath + "/" + NewFileName; string Wtime = LearnSite.Common.Computer.TimePassed(Logintime).ToString(); LearnSite.Model.Works wmodel = new LearnSite.Model.Works(); wmodel.Wnum = Wnum; wmodel.Wcid = Int32.Parse(Wcid); wmodel.Wmid = Int32.Parse(Wmid); wmodel.Wmsort = Int32.Parse(Wmsort); wmodel.Wfilename = NewFileName; wmodel.Wtype = Wfiletype; wmodel.Wurl = Wurl; wmodel.Wlength = Wlength; wmodel.Wdate = Wdate; wmodel.Wip = Wip; wmodel.Wtime = Wtime; wmodel.Wcan = checkcan; wmodel.Wcheck = false; wmodel.Wegg = 12;//设定票数为12张 wmodel.Whit = 0; wmodel.Wgrade = Int32.Parse(Sgrade); wmodel.Wterm = Int32.Parse(Wterm); wmodel.Wsid = Int32.Parse(Wsid); wmodel.Wclass = Int32.Parse(Sclass); wmodel.Wname = HttpUtility.UrlDecode(Sname); wmodel.Wyear = Int32.Parse(Syear); switch (Wfiletype) { case "doc": case "ppt": case "xls": case "docx": case "pptx": case "xlsx": case "wps": case "dps": case "et": wmodel.Woffice = true; break; default: wmodel.Woffice = false; break; } wmodel.Wflash = false; wmodel.Werror = false; string saveFilename = Server.MapPath(Wurl); try { ws.AddWorkUp(wmodel); //添加作品提交记录 LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); sn.UpdateQwork(Int32.Parse(Wsid), Int32.Parse(Wcid)); //更新今天签到表中的作品数量 work_upload.SaveAs(saveFilename); //保存提交作品 Response.StatusCode = 200; Response.Write(NewFileName); } catch (Exception ex) { Response.StatusCode = 200; Response.Write(ex); } finally { Response.End(); } } } catch (Exception ex) { Response.StatusCode = 200; Response.Write(ex); } finally { Response.End(); } } }
private void uploadgroupwork() { if (Request.Files["Filedata"] != null) { try { // Get the data HttpPostedFile group_upload = Request.Files["Filedata"]; string Gtype = group_upload.FileName.Substring(group_upload.FileName.LastIndexOf(".") + 1).ToLower(); string Gmid = Request.QueryString["mid"].ToString(); string Gnum = Request.QueryString["num"].ToString(); string info = HttpUtility.UrlDecode(Request.QueryString["info"].ToString()); LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission(); LearnSite.Model.Mission mmodel = new LearnSite.Model.Mission(); mmodel = mbll.GetModel(Int32.Parse(Gmid)); // string Gextention = mmodel.Mfiletype; string Gcid = mmodel.Mcid.ToString(); //Syear | Sgrade | Sclass | Sid | Sname | Wip | Sterm | LoginTime string[] infoarray = info.Split('|'); string Ggroup = infoarray[3];//取组长 string Gyear = infoarray[0]; string Ggrade = infoarray[1]; string Gclass = infoarray[2]; string Gip = infoarray[5]; string LoginTime = infoarray[7]; string Gterm = infoarray[6]; LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); LearnSite.Model.Signin qmodel = sn.GetModelm(Gnum); if (qmodel != null) { Gyear = qmodel.Qsyear.ToString(); Ggrade = qmodel.Qgrade.ToString(); Gclass = qmodel.Qclass.ToString(); Gip = qmodel.Qip; LoginTime = qmodel.Qdate.ToString(); Gterm = qmodel.Qterm.ToString(); } int Glengh = group_upload.ContentLength; DateTime Gdate = DateTime.Now; LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); bool gdone = gbll.DoneGroupWork(Gnum, Int32.Parse(Gmid)); string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Gyear, Ggrade, Gclass, Gcid, Gmid);//获得作品保存路径(如果不存在,自动创建) string NewFileName = "g" + Gnum + Gcid + "_" + Gmid + "." + Gtype; string Gurl = MySavePath + "/" + NewFileName; string saveFilename = Server.MapPath(Gurl); //如果作品未提交,提交作品 if (!gdone) { int Gtime = LearnSite.Common.Computer.TimePassed(); LearnSite.Model.GroupWork gmodel = new LearnSite.Model.GroupWork(); gmodel.Gcheck = false; gmodel.Gcid = Int32.Parse(Gcid); gmodel.Gclass = Int32.Parse(Gclass); gmodel.Gdate = DateTime.Now; gmodel.Gfilename = NewFileName; gmodel.Ggrade = Int32.Parse(Ggrade); gmodel.Ghit = 0; gmodel.Gip = Gip; gmodel.Glengh = Glengh; gmodel.Gmid = Int32.Parse(Gmid); gmodel.Gnote = ""; gmodel.Gnum = Gnum; gmodel.Grank = -1; gmodel.Gscore = 0; LearnSite.BLL.Students sbll = new LearnSite.BLL.Students(); gmodel.Gstudents = sbll.GroupSnum(Gnum); gmodel.Gterm = Int32.Parse(Gterm); gmodel.Gtime = Gtime; gmodel.Gtype = Gtype; gmodel.Gurl = Gurl; gmodel.Gvote = 0; gmodel.Ggroup = Int32.Parse(Ggroup); gbll.Add(gmodel);//添加小组作品提交记录 } else { //已交则不更新记录 } try { group_upload.SaveAs(saveFilename);//保存提交作品 Response.StatusCode = 200; Response.Write(NewFileName); } catch (Exception ex) { Response.StatusCode = 200; Response.Write(ex); } } catch (Exception ex) { Response.StatusCode = 200; Response.Write(ex); } finally { Response.End(); } } }
private void uploadgroupwork() { HttpPostedFile group_upload = Request.Files["imgFilegroup"]; int maxSize = 104857600;//定义上传最大值为100MB if (group_upload != null) { // Get the data string Gtype = group_upload.FileName.Substring(group_upload.FileName.LastIndexOf(".") + 1).ToLower(); string Gmid = Request.QueryString["mid"].ToString(); string Gnum = Request.QueryString["num"].ToString(); LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission(); LearnSite.Model.Mission mmodel = new LearnSite.Model.Mission(); mmodel = mbll.GetModel(Int32.Parse(Gmid)); string Gextention = mmodel.Mfiletype; string Gcid = mmodel.Mcid.ToString(); string limitext = Gextention;//初始化,随意 switch (Gextention) { case "doc": limitext = "*.doc;*.docx"; break; case "ppt": limitext = "*.ppt;*.pptx"; break; case "xls": limitext = "*.xls;*.xlsx"; break; case "office": limitext = "*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx"; break; case "sb": limitext = "*.sb;*.sb2"; break; default: limitext = "*." + Gextention; break; } if (Gtype == Gextention || limitext.Contains(Gtype)) { if (group_upload.InputStream != null || group_upload.InputStream.Length < maxSize) { LearnSite.BLL.Signin sn = new LearnSite.BLL.Signin(); LearnSite.Model.Signin qmodel = sn.GetModelm(Gnum); LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); string Ggroup = cook.Sid.ToString();//取组长 string Gyear = cook.Syear.ToString(); string Ggrade = cook.Sgrade.ToString(); string Gclass = cook.Sclass.ToString(); string Gip = cook.LoginIp; string LoginTime = cook.LoginTime; string Gterm = cook.ThisTerm.ToString(); if (qmodel != null) { Gyear = qmodel.Qsyear.ToString(); Ggrade = qmodel.Qgrade.ToString(); Gclass = qmodel.Qclass.ToString(); Gip = qmodel.Qip; LoginTime = qmodel.Qdate.ToString(); Gterm = qmodel.Qterm.ToString(); } int Glengh = group_upload.ContentLength; DateTime Gdate = DateTime.Now; LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); bool gdone = gbll.DoneGroupWork(Gnum, Int32.Parse(Gmid)); string MySavePath = LearnSite.Common.WorkUpload.GetWurl(Gyear, Ggrade, Gclass, Gcid, Gmid);//获得作品保存路径(如果不存在,自动创建) string NewFileName = "g" + Gnum + Gcid + "_" + Gmid + "." + Gtype; string Gurl = MySavePath + "/" + NewFileName; string saveFilename = Server.MapPath(Gurl); //如果作品未提交,提交作品 if (!gdone) { int Gtime = LearnSite.Common.Computer.TimePassed(); LearnSite.Model.GroupWork gmodel = new LearnSite.Model.GroupWork(); gmodel.Gcheck = false; gmodel.Gcid = Int32.Parse(Gcid); gmodel.Gclass = Int32.Parse(Gclass); gmodel.Gdate = DateTime.Now; gmodel.Gfilename = NewFileName; gmodel.Ggrade = Int32.Parse(Ggrade); gmodel.Ghit = 0; gmodel.Gip = Gip; gmodel.Glengh = Glengh; gmodel.Gmid = Int32.Parse(Gmid); gmodel.Gnote = ""; gmodel.Gnum = Gnum; gmodel.Grank = -1; gmodel.Gscore = 0; LearnSite.BLL.Students sbll = new LearnSite.BLL.Students(); gmodel.Gstudents = sbll.GroupSnum(Gnum); gmodel.Gterm = Int32.Parse(Gterm); gmodel.Gtime = Gtime; gmodel.Gtype = Gtype; gmodel.Gurl = Gurl; gmodel.Gvote = 0; gmodel.Ggroup = Int32.Parse(Ggroup); gbll.Add(gmodel);//添加小组作品提交记录 } else { //已交则不更新记录 } group_upload.SaveAs(saveFilename);//保存或更新提交作品 Hashtable hash = new Hashtable(); hash["error"] = 0; Response.AddHeader("Content-Type", "text/html; charset=UTF-8"); Response.Write(JsonMapper.ToJson(hash)); Response.End(); } else { showError("选择的文件大小超过限制!(最大为10MB)"); } } else { showError("选择的文件类型错误!"); } } else { showError("请选择文件!"); } }
private void ShowMission() { string Mid = Request.QueryString["Mid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Mid)) { LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { int sSyear = cook.Syear; int sSclass = cook.Sclass; string sSnum = cook.Snum; string sLoginIp = cook.LoginIp; string sWcid = model.Mcid.ToString(); string sWmid = Mid; string sWmsort = model.Msort.ToString(); string sWfiletype = model.Mfiletype; LabelMtitle.Text = model.Mtitle; LabelMcid.Text = model.Mcid.ToString(); Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent); LabelSnum.Text = sSnum; LabelMfiletype.Text = sWfiletype; bool isupload = model.Mupload; CkMupload.Checked = isupload; if (isupload) { VoteLink.Visible = true; } else { VoteLink.Visible = false; } CkMgroup.Checked = model.Mgroup; LabelMsort.Text = sWmsort; LabelMid.Text = Mid; upFileTypeGroup.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif"; upFileUrlGroup.Text = "小组作品"; switch (sWfiletype) { case "doc": LabelUploadType.Text = "*.doc;*.docx"; break; case "ppt": LabelUploadType.Text = "*.ppt;*.pptx"; break; case "xls": LabelUploadType.Text = "*.xls;*.xlsx"; break; case "office": LabelUploadType.Text = "*.doc;*.docx;*.ppt;*.pptx;*.xls;*.xlsx"; break; case "sb": LabelUploadType.Text = "*.sb;*.sb2"; break; case "flash": LabelUploadType.Text = "*.swf;*.fla"; break; default: LabelUploadType.Text = "*." + sWfiletype; break; } if (model.Mgroup) { LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); string gurl = gbll.DoneGroupWorkUrl(sSnum, Int32.Parse(Mid)); upFileTypeGroup.Visible = true; upFileUrlGroup.Visible = true; upFileUrlGroup.NavigateUrl = "~/Plugins/download.aspx?Id=" + LearnSite.Common.EnDeCode.Encrypt(gurl, "ls"); LearnSite.BLL.Students sbll = new LearnSite.BLL.Students(); if (sbll.IsLeader(sSnum))//如果是组长则显示小组面板 { Panelgroup.Visible = true; showgroupWork(); if (gurl != "") { if (gbll.CheckGroupWork(sSnum, Int32.Parse(Mid))) { PanelGroupUp.Visible = false; Labelgroupmsg.Text = "小组作品已经评价!<br/>你不可以再重新提交!"; } else { Labelgroupmsg.Text = "小组作品已提交但未评价!<br/>你可以修改后重新提交!"; } } else { upFileTypeGroup.Visible = false; upFileUrlGroup.Visible = false; } } else { Panelgroup.Visible = false; upFileTypeGroup.Visible = false; } } else { Panelgroup.Visible = false; upFileTypeGroup.Visible = false; } if (!CkMupload.Checked) { Panelworks.Visible = false; } ImageType.ImageUrl = "~/Images/FileType/" + LabelMfiletype.Text.ToLower() + ".gif"; } else { Mcontent.InnerHtml = "此学案活动不存在!"; Panelworks.Visible = false; } } }
private void ShowMission() { string Mid = Request.QueryString["Mid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Mid)) { LearnSite.Model.Mission model = new LearnSite.Model.Mission(); LearnSite.BLL.Mission mn = new LearnSite.BLL.Mission(); model = mn.GetModel(Int32.Parse(Mid)); if (model != null) { LabelMtitle.Text = model.Mtitle; LabelMcid.Text = model.Mcid.ToString(); Mcontent.InnerHtml = HttpUtility.HtmlDecode(model.Mcontent); LabelMdate.Text = model.Mdate.ToString(); LabelMfiletype.Text = model.Mfiletype; CheckBoxMupload.Checked = model.Mupload; LabelMsort.Text = model.Msort.ToString(); Btnupload.Enabled = model.Mupload; if (LabelMfiletype.Text == "html") { Labelmsg.Text = "远程网站连接设置"; string ftpstr = "ftp://" + LearnSite.Common.Computer.GetServerIp(); TextFtp.Text = ftpstr; string userstr = Request.Cookies["StudentCookies"].Values["Snum"].ToString(); TextUser.Text = userstr; string pwdstr = Request.Cookies["StudentCookies"].Values["Ftppwd"].ToString(); TextPwd.Text = pwdstr; PanelFtp.Visible = true; Panelworks.Visible = false; } else { if (!CheckBoxMupload.Checked) { Panelworks.Visible = false; } } ImageType.ImageUrl = "~/Images/FileType/"+LabelMfiletype.Text.ToLower()+".gif"; } else { Mcontent.InnerHtml = "此课程活动不存在!"; } } }