private void ShowStudent() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int mySid = cook.Sid; LearnSite.BLL.Students dbll = new LearnSite.BLL.Students(); sleadername.Text = Server.UrlDecode(dbll.GetLeader(mySid)); string ssex = cook.Sex; string murl = LearnSite.Common.Photo.GetStudentPhotoUrl(snum.Text, ssex); Imageface.ImageUrl = murl + "?temp=" + DateTime.Now.Millisecond.ToString(); Labelip.Text = cook.LoginIp; snum.Text = Server.UrlDecode(cook.Snum); string Sgrade = cook.Sgrade.ToString(); string Sclass = cook.Sclass.ToString(); sclass.Text = Sgrade + "." + Sclass + "班"; sname.Text = Server.UrlDecode(cook.Sname); sscore.Text = cook.Sscore.ToString(); sattitude.Text = cook.Sattitude.ToString(); LabelRank.Text = Server.UrlDecode(cook.RankImage); int myscores = int.Parse(sscore.Text); LabelRank.ToolTip = "你当前的等级为:" + myscores / 3 + "级 加速升级中…"; }
/// <summary> /// 获得数据列表 /// </summary> //public DataSet GetList(int PageSize,int PageIndex,string strWhere) //{ //return dal.GetList(PageSize,PageIndex,strWhere); //} public string Savemytype(string Ptid, string TypeScore) { string msgss = "-1"; if (HttpContext.Current.Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int Psid = cook.Sid; string Psnum = cook.Snum; string Pip = cook.LoginIp; int Sgrade = cook.Sgrade; int Sclass = cook.Sclass; int Pterm = cook.ThisTerm; bool workiplimit = LearnSite.Common.XmlHelp.GetWorkIpLimit(); if (workiplimit) { LearnSite.BLL.Ptyper pbll = new LearnSite.BLL.Ptyper(); if (!pbll.ExistPtyper(Psid, Sgrade, Sclass, Pip)) { msgss = SaveTypeRecord(Int32.Parse(Ptid), Psid, Psnum, Pip, Sgrade, Pterm, TypeScore); } else { msgss = "-2"; } } else { msgss = SaveTypeRecord(Int32.Parse(Ptid), Psid, Psnum, Pip, Sgrade, Pterm, TypeScore); } } return(msgss); }
private void ShowTxtForm() { string Mid = Request.QueryString["Mid"].ToString(); LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int Wsid = cook.Sid; if (LearnSite.Common.WordProcess.IsNum(Mid)) { LearnSite.Model.TxtForm tmodel = new LearnSite.Model.TxtForm(); LearnSite.BLL.TxtForm tbll = new LearnSite.BLL.TxtForm(); tmodel = tbll.GetModel(Int32.Parse(Mid)); if (tmodel != null) { LabelMtitle.Text = tmodel.Mtitle; LearnSite.Model.TxtFormBack rmodel = new LearnSite.Model.TxtFormBack(); LearnSite.BLL.TxtFormBack rbll = new LearnSite.BLL.TxtFormBack(); int Rid = rbll.GetRid(Wsid.ToString(), Mid); if (Rid > 0) { rmodel = rbll.GetModel(Rid); Mcontent.InnerHtml = HttpUtility.HtmlDecode(rmodel.Rwords); } else { Mcontent.InnerHtml = HttpUtility.HtmlDecode(tmodel.Mcontent); } } Hlresult.NavigateUrl = "~/Student/txtformresult.aspx?Mid=" + Mid; } }
private void showSnum() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); mysnum = cook.Snum; LearnSite.BLL.Pfinger fbll = new LearnSite.BLL.Pfinger(); oldspd.InnerText = "历史记录:" + fbll.GetPsnum(mysnum) + "个/分"; }
private void showMy() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Autonomic abll = new LearnSite.BLL.Autonomic(); RepMy.DataSource = abll.GetMyList(cook.Sid);//Aid,Aurl,Ftitle RepMy.DataBind(); }
private void ShowStudent() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Students stu = new LearnSite.BLL.Students(); Repeater1.DataSource = stu.GetOneStudent(cook.Sid); Repeater1.DataBind(); }
private void showattitude() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); Labeltitle.Text = cook.Sgrade.ToString() + "年级" + cook.Sclass.ToString() + "班本学期学习表现积分排行"; LearnSite.BLL.Students sbll = new LearnSite.BLL.Students(); GridViewclass.DataSource = sbll.GetListSattitude(cook.Syear, cook.Sgrade, cook.Sclass); GridViewclass.DataBind(); }
private void ShowChinese() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Pchinese pcbll = new LearnSite.BLL.Pchinese(); string sestr = DDLselect.SelectedValue; GVFinger.DataSource = pcbll.ShowAllChineseApple(sestr, cook.Sgrade, cook.Sclass, cook.ThisTerm); GVFinger.DataBind(); }
public void showTermScore() { if (LearnSite.Common.CookieHelp.IsStudentLogin()) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); string mynum = cook.Snum; LearnSite.BLL.TermTotal tbll = new LearnSite.BLL.TermTotal(); DLterm.DataSource = tbll.GetSnumTermList(mynum); DLterm.DataBind(); } }
/// <summary> /// 保存成绩 /// </summary> /// <param name="psnum"></param> /// <param name="myspd"></param> /// <returns></returns> public bool saveSpd(string psnum, string myspd) { if (HttpContext.Current.Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); return(dal.saveSpd(cook.Snum, myspd, cook.Sgrade)); } else { return(false); } }
private void showQscore() { if (LearnSite.Common.CookieHelp.IsStudentLogin()) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int Sgrade = cook.Sgrade; int Sclass = cook.Sclass; LearnSite.BLL.Result bll = new LearnSite.BLL.Result(); GridViewclass.DataSource = bll.GetListTodayScore(Sgrade, Sclass); GridViewclass.DataBind(); Labeltitle.Text = DateTime.Now.ToLongDateString() + "今天班级常识测验排行榜"; Labelmsg.Text = "未测验同学名单:<br/><br/>" + bll.GetListTodayNoScore(Sgrade, Sclass); } }
private void ShowSoft() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Soft st = new LearnSite.BLL.Soft(); int yid = 0; if (Request.QueryString["Yid"] != null) { yid = Int32.Parse(Request.QueryString["Yid"].ToString()); } GVSoft.DataSource = st.GetShowSoftList(cook.Rhid.ToString(), yid); GVSoft.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string stuName = ""; if (Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); stuName = cook.Sname; } this.Page.Title = LearnSite.Common.XmlHelp.SiteTitle() + "—" + HttpUtility.UrlDecode(stuName); } }
private void showChinese() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Room rbll = new LearnSite.BLL.Room(); string Nids = rbll.GetRchineseByClass(cook.Sgrade, cook.Sclass); LearnSite.BLL.Chinese cbll = new LearnSite.BLL.Chinese(); DataList1.DataSource = cbll.ShowAllNid(Nids); DataList1.DataBind(); if (DataList1.Items.Count > 0) { Lbnid.Text = ((Label)DataList1.Items[0].FindControl("Lbid")).Text; } }
private int GetCid() { if (Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Room rbll = new LearnSite.BLL.Room(); string result = rbll.GetRcid(cook.Sgrade, cook.Sclass); if (!string.IsNullOrEmpty(result)) { cid = Int32.Parse(result); } } return(cid); }
private void ShowOldWorks() { string Cid = Request.QueryString["Cid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Cid)) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int Sid = cook.Sid; int Sgrade = cook.Sgrade; int Sterm = cook.ThisTerm; LearnSite.BLL.Works wbll = new LearnSite.BLL.Works(); GVold.DataSource = wbll.ShowLastWorks(Sid, Sgrade, Sterm, Int32.Parse(Cid)); GVold.DataBind(); } }
protected void Btnedit_Click(object sender, EventArgs e) { string OldPwd = TextBoxoldpwd.Text.Trim(); LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); string myPwd = cook.Spwd; if (LearnSite.Common.WordProcess.GetMD5_8bit(OldPwd) == myPwd) { string Spwd = TextBoxpwd.Text.Trim(); string Spwd0 = TextBoxpwd0.Text.Trim(); if (LearnSite.Common.WordProcess.IsEnNum(Spwd)) { if (Spwd.Length < 19) { if (Spwd == Spwd0) { string Snum = cook.Snum; LearnSite.BLL.Students bll = new LearnSite.BLL.Students(); bll.UpdatePwd(Snum, Spwd); string strpwd = "修改密码成功!请记牢您的新密码!"; LearnSite.Common.WordProcess.Alert(strpwd, this.Page); Btnedit.Enabled = false; } else { Labelmsg.Text = "输入新密码跟确认新密码不一样,请重新输入一致!"; } } else { Labelmsg.Text = "密码长度不超过18个字符!"; TextBoxpwd.Text = ""; } } else { Labelmsg.Text = "密码必须为英文字母或数字组成!"; TextBoxpwd.Text = ""; } } else { Labelmsg.Text = "旧密码输入错误!"; } }
private void showSummary() { if (Request.QueryString["Scid"] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int Sgrade = cook.Sgrade; int Sclass = cook.Sclass; int Scid = Int32.Parse(Request.QueryString["Scid"].ToString()); LearnSite.Model.Summary smodel = new LearnSite.Model.Summary(); LearnSite.BLL.Summary sbll = new LearnSite.BLL.Summary(); int hid = cook.Rhid; if (hid != 0) { LearnSite.BLL.Courses cbll = new LearnSite.BLL.Courses(); Label1.Text = cbll.GetTitle(Scid); smodel = sbll.GetModelByClass(Scid, hid, Sgrade, Sclass); if (smodel != null) { // LearnSite.BLL.Mission mbll = new LearnSite.BLL.Mission(); if (smodel.Sshow.Value) { contents.InnerHtml = HttpUtility.HtmlDecode(smodel.Scontent); } else { contents.InnerHtml = "隐藏内容!"; } Label6.Text = smodel.Sdate.ToString(); } else { contents.InnerHtml = "老师还未填写总结!"; } } int Syear = cook.Syear; string Snum = cook.Snum; string teasnum = "s" + hid + Syear.ToString() + Sgrade.ToString() + Sclass.ToString(); if (teasnum == Snum) { BtnEdit.Enabled = true; BtnEdit.ToolTip = "修改或添加总结!"; } } }
protected void Page_Load(object sender, EventArgs e) { if (LearnSite.Common.CookieHelp.IsStudentLogin()) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); OpenJump(cook.Sgrade, cook.Sclass);//跳转选择 } else { if (!IsPostBack) { verChecking();//增加数据库检测 ShowFoot(); Btnlogin.Attributes["onClick"] = "return doubleCheck()"; this.Page.Title = LearnSite.Common.CookieHelp.SetMainPageTitle(); } } }
private void ShowMission() { if (Request.QueryString["id"] != null) { int wid = Int32.Parse(Request.QueryString["id"].ToString()); LearnSite.BLL.Works wbll = new LearnSite.BLL.Works(); LearnSite.Model.Works model = new LearnSite.Model.Works(); string ipwid = "ip" + LearnSite.Common.Computer.MyIp().Replace('.', 'a') + "_" + wid.ToString(); if (Session[ipwid] == null) { wbll.UpdateWhit(wid); Session[ipwid] = wid; } model = wbll.GetModel(wid); Id = wid.ToString(); Owner = model.Wname; Titles = model.Wtitle; this.Page.Title = Titles + " " + Owner; int Wcid = model.Wcid.Value; int Wgrade = model.Wgrade.Value; if (Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Room rbll = new LearnSite.BLL.Room(); string result = rbll.GetRcid(cook.Sgrade, cook.Sclass); if (!string.IsNullOrEmpty(result)) { int cid = Int32.Parse(result); if (cid == Wcid && cook.Sgrade == Wgrade) { //如果是正在上的课节内容,则不显示作品的脚本 ViewMode = "true"; } if (Request.Cookies[LearnSite.Common.CookieHelp.teaCookieNname] != null) { ViewMode = "false"; } } } } }
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 = "老师"; } } } }
private void showclassmate() { if (Request.QueryString["Vid"] != null && Request.QueryString["Mid"] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); int mid = Int32.Parse(Request.QueryString["Mid"].ToString()); int syear = cook.Syear; int sgrade = cook.Sgrade; int sclass = cook.Sclass; LearnSite.BLL.SurveyItem mbll = new LearnSite.BLL.SurveyItem(); Mitem.InnerHtml = "<br />" + HttpUtility.HtmlDecode(mbll.GetMitem(mid)); LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); Repeater1.DataSource = fbll.ShowItemClassMate(syear, sgrade, sclass, vid, mid); Repeater1.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { if (LearnSite.Common.CookieHelp.IsStudentLogin()) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int Qgrade = cook.Sgrade; int Qclass = cook.Sclass; OpenJump(Qgrade, Qclass);//跳转选择 } else { if (!IsPostBack) { SetGrade(); SetClass(); SetSex(); } } }
private void GradeClass() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); string Sgrade = cook.Sgrade.ToString(); string Sclass = cook.Sclass.ToString(); LearnSite.BLL.Room room = new LearnSite.BLL.Room(); DDLgrade.DataSource = room.GetAllGrade(); DDLgrade.DataTextField = "Rgrade"; DDLgrade.DataValueField = "Rgrade"; DDLgrade.DataBind(); DDLgrade.SelectedValue = Sgrade; LearnSite.BLL.Room rm = new LearnSite.BLL.Room(); DDLclass.DataSource = rm.GetAllClass(); DDLclass.DataTextField = "Rclass"; DDLclass.DataValueField = "Rclass"; DDLclass.DataBind(); DDLclass.SelectedValue = Sclass; }
private void ShowTyper() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Ptyper pr = new LearnSite.BLL.Ptyper(); string sestr = DDLselect.SelectedValue; switch (sestr) { case "1": GVTyper.DataSource = pr.ShowSchoolTypeScore(); break; case "2": GVTyper.DataSource = pr.ShowAllTypeScore(cook.Sgrade); break; case "3": GVTyper.DataSource = pr.ShowClassTypeScore(cook.Sgrade, cook.Sclass); break; } GVTyper.DataBind(); }
private void showFscore() { if (Request.QueryString["Vid"] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int sgrade = cook.Sgrade; int sclass = cook.Sclass; int vid = Int32.Parse(Request.QueryString["Vid"].ToString()); LearnSite.BLL.SurveyFeedback fbll = new LearnSite.BLL.SurveyFeedback(); GridViewclass.DataSource = fbll.GetClassFscore(sgrade, sclass, vid); GridViewclass.DataBind(); LearnSite.BLL.Survey vbll = new LearnSite.BLL.Survey(); LearnSite.Model.Survey model = new LearnSite.Model.Survey(); model = vbll.GetModel(vid); Labeltitle.Text = HttpUtility.HtmlDecode(model.Vtitle); if (GridViewclass.Rows.Count < 1) { Labelmsg.Text = "暂无排行!"; } } }
private void ShowFinger() { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); LearnSite.BLL.Pfinger pbll = new LearnSite.BLL.Pfinger(); string sestr = DDLselect.SelectedValue; switch (sestr) { case "1": GVFinger.DataSource = pbll.ShowSchoolFingerScore(); break; case "2": GVFinger.DataSource = pbll.ShowAllFingerScore(cook.Sgrade); break; case "3": GVFinger.DataSource = pbll.ShowClassFingerScore(cook.Sgrade, cook.Sclass); break; } GVFinger.DataBind(); }
public int UpdateChineseType(int Papple, int Pspeed) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); int Psid = cook.Sid; string Psnum = cook.Snum; int Pgrade = cook.Sgrade; int Pclass = cook.Sclass; int Pyear = cook.Syear; int Pterm = cook.ThisTerm; DateTime Pdate = DateTime.Now; Model.Pchinese pchinese = new Model.Pchinese(); pchinese.Psid = Psid; pchinese.Psnum = Psnum; pchinese.Pgrade = Pgrade; pchinese.Pclass = Pclass; pchinese.Pyear = Pyear; pchinese.Pterm = Pterm; pchinese.Pdate = Pdate; pchinese.Ptotal = Papple; pchinese.Pspeed = Pspeed; pchinese.Papple = Papple; pchinese.Pdegree = 2; int res = dal.UpdateTotal(pchinese); if (res > 0) { return(res); } else { dal.Add(pchinese); return(Papple); } }
private void ShowListMenu() { if (Request.QueryString["Cid"] != null) { string Cid = Request.QueryString["Cid"].ToString(); string Uploadmode = LearnSite.Common.XmlHelp.GetUploadMode(); if (LearnSite.Common.WordProcess.IsNum(Cid)) { string mUrl; if (Uploadmode == "0") { mUrl = "active"; } else { mUrl = "mission"; } string CurWay = ""; LearnSite.BLL.Courses cbll = new LearnSite.BLL.Courses(); string Ctitle = cbll.GetTitle(Int32.Parse(Cid)); AddLessonFirst(CurWay, Cid); LearnSite.BLL.ListMenu lbll = new LearnSite.BLL.ListMenu(); DataTable dt = lbll.GetShowedMenu(Int32.Parse(Cid)).Tables[0]; int dcount = dt.Rows.Count; if (dcount > 0) { string myLid = ""; if (Request.QueryString["Lid"] != null) { myLid = Request.QueryString["Lid"].ToString(); } for (int i = 0; i < dcount; i++) { string Lid = dt.Rows[i]["Lid"].ToString(); string Lsort = dt.Rows[i]["Lsort"].ToString(); string Ltype = dt.Rows[i]["Ltype"].ToString(); string Lxidstr = dt.Rows[i]["Lxid"].ToString(); string Ltitlestr = dt.Rows[i]["Ltitle"].ToString(); MenuItem ma = new MenuItem(); ma.Text = Ltitlestr; ma.SeparatorImageUrl = "~/Images/separate.gif"; switch (Ltype) { case "1": //活动 ma.ImageUrl = "~/Images/mission.png"; ma.NavigateUrl = "~/Student/show" + mUrl + ".aspx?Cid=" + Cid + "&Mid=" + Lxidstr + "&Lid=" + Lid + "&Lsort=" + Lsort; break; case "2": //调查 ma.ImageUrl = "~/Images/survey.png"; ma.NavigateUrl = "~/Student/mysurvey.aspx?Cid=" + Cid + "&Vid=" + Lxidstr + "&Lid=" + Lid + "&Lsort=" + Lsort; break; case "3": //讨论 ma.ImageUrl = "~/Images/topic.png"; ma.NavigateUrl = "~/Student/topicdiscuss.aspx?Cid=" + Cid + "&Tid=" + Lxidstr + "&Lid=" + Lid + "&Lsort=" + Lsort; break; case "4": //表单 ma.ImageUrl = "~/Images/inquiry.png"; ma.NavigateUrl = "~/Student/txtform.aspx?Cid=" + Cid + "&Mid=" + Lxidstr + "&Lid=" + Lid + "&Lsort=" + Lsort; break; case "5": //编程 ma.ImageUrl = "~/Images/program.png"; ma.NavigateUrl = "~/Student/program.aspx?Cid=" + Cid + "&Mid=" + Lxidstr + "&Lid=" + Lid + "&Lsort=" + Lsort; break; case "6": //描述 ma.ImageUrl = "~/Images/description.png"; ma.NavigateUrl = "~/Student/description.aspx?Cid=" + Cid + "&Mid=" + Lxidstr + "&Lid=" + Lid + "&Lsort=" + Lsort; break; } if (myLid == Lid) { CurWay = Ltitlestr; ma.Selected = true; } Menuact.Items.Add(ma);//添加活动菜单 } } dt.Dispose(); AddReturn(); string stuName = ""; if (Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname] != null) { LearnSite.Model.Cook cook = new LearnSite.Model.Cook(); stuName = cook.Sname; } this.Page.Title = HttpUtility.UrlDecode(stuName) + " " + Ctitle + "—>" + CurWay; } } }
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("请选择文件!"); } }