protected void DataListGroup_ItemDataBound(object sender, DataListItemEventArgs e) { int sgrade = Int32.Parse(Request.QueryString["Sg"].ToString()); int sclass = Int32.Parse(Request.QueryString["Sc"].ToString()); string sid = ((Label)e.Item.FindControl("LabelSid")).Text; Label lbgstus = (Label)e.Item.FindControl("LabelGstus"); DropDownList ddl = (DropDownList)e.Item.FindControl("DDLGscores"); LinkButton btnview = (LinkButton)e.Item.FindControl("LinkBtnView"); LearnSite.BLL.Students sbll = new LearnSite.BLL.Students(); lbgstus.Text = sbll.GroupMember(sgrade, sclass, int.Parse(sid)); string snum = ((Label)e.Item.FindControl("LabelSnum")).Text; int mid = Int32.Parse(Request.QueryString["Mi"].ToString()); LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); LearnSite.Model.GroupWork gmodel = new LearnSite.Model.GroupWork(); gmodel = gbll.GetModelBySnum(snum, mid); if (gmodel != null) { ddl.SelectedValue = gmodel.Gscore.ToString(); ddl.ToolTip = gmodel.Gid.ToString(); btnview.CommandArgument = gmodel.Gurl; } else { ddl.SelectedValue = "0"; ddl.Enabled = false; btnview.Enabled = false; } }
private void showGroup() { int Ggrade = Int32.Parse(Request.QueryString["wGrade"].ToString()); int Gclass = Int32.Parse(Request.QueryString["wClass"].ToString()); if (DDLmid.SelectedValue != "") { string myCid = DDLCid.SelectedValue; int Gmid = Int32.Parse(DDLmid.SelectedValue); LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); DataListgroup.DataSource = gbll.GetMissionGroup(Ggrade, Gclass, Gmid); DataListgroup.DataBind(); if (DataListgroup.Items.Count > 0) { string urlstr = Ggrade.ToString() + "&Sc=" + Gclass.ToString() + "&Ci=" + myCid + "&Mi=" + Gmid.ToString(); HLgroupplay.Visible = true; HLgroupplay.NavigateUrl = "~/Teacher/circlegroups.aspx?Sg=" + urlstr; HLgroupplay.ImageUrl = "~/Images/weboffice.png"; } else { HLgroupplay.Visible = false; } } }
private void showworks() { string snum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString(); LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); GVwork.DataSource = gbll.GetMyWorks(snum); GVwork.DataBind(); }
private void showworks() { string snum = cook.Snum; LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); GVwork.DataSource = gbll.GetMyWorks(snum); GVwork.DataBind(); }
protected void CBg_CheckedChanged(object sender, EventArgs e) { CheckBox chg = sender as CheckBox; //取得当前被选中项的索引 int index = (chg.NamingContainer as DataListItem).ItemIndex; //取得当前选中项中的某个值,最好找ID。 Label lblg = this.DataListgroup.Items[index].FindControl("Labelgid") as Label; LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); gbll.CancelGscore(Int32.Parse(lblg.Text), chg.Checked); System.Threading.Thread.Sleep(200); showGroup(); }
protected void DDLGscores_SelectedIndexChanged(object sender, EventArgs e) { string gid = Labelgid.Text; if (!string.IsNullOrEmpty(gid)) { string score = DDLGscores.SelectedValue; int sgrade = Int32.Parse(Request.QueryString["Sg"].ToString()); string term = LearnSite.Common.XmlHelp.GetTerm(); LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); gbll.UpdateGscore(Int32.Parse(gid), Int32.Parse(score), sgrade, Int32.Parse(term)); } }
private void showGroupWork() { int groupcount = DLgroups.Items.Count; int pos = Int32.Parse(Labelpos.Text); int lastpos = Int32.Parse(Labellastpos.Text); if (groupcount > 0 && pos > -1 && pos < groupcount) { int sgrade = Int32.Parse(Request.QueryString["Sg"].ToString()); int sclass = Int32.Parse(Request.QueryString["Sc"].ToString()); int mid = Int32.Parse(Request.QueryString["Mi"].ToString()); LinkButton lb = (LinkButton)DLgroups.Items[pos].FindControl("LbSgtitle"); LabelSgtitle.Text = lb.Text; lb.BorderColor = System.Drawing.Color.FromArgb(0, 102, 255); if (pos != lastpos) { LinkButton lblast = (LinkButton)DLgroups.Items[lastpos].FindControl("LbSgtitle"); lblast.BorderColor = System.Drawing.Color.FromArgb(212, 212, 212);//还原上个边框颜色 } Labellastpos.Text = pos.ToString(); Label ln = (Label)DLgroups.Items[pos].FindControl("LabelSname"); LabelLeader.Text = ln.Text; string sid = ((Label)DLgroups.Items[pos].FindControl("LabelSid")).Text; string snum = ((Label)DLgroups.Items[pos].FindControl("LabelSnum")).Text; LearnSite.BLL.Students sbll = new LearnSite.BLL.Students(); Labelmember.Text = sbll.GroupMember(sgrade, sclass, int.Parse(sid)); LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); LearnSite.Model.GroupWork gmodel = new LearnSite.Model.GroupWork(); gmodel = gbll.GetModelBySnum(snum, mid); if (gmodel != null) { DDLGscores.SelectedValue = gmodel.Gscore.ToString(); DDLGscores.Enabled = true; Labelgid.Text = gmodel.Gid.ToString(); string url = gmodel.Gurl; string ext = LearnSite.Common.WordProcess.getext(url); string htmname = "index.htm"; if (string.IsNullOrEmpty(ext)) { ext = "htm"; } LiteralView.Text = LearnSite.Common.WordProcess.SelectWriteTeaNew(ext, url, true, htmname); } else { DDLGscores.SelectedValue = "0"; DDLGscores.Enabled = false; LiteralView.Text = ""; } } }
protected void DDLGscores_SelectedIndexChanged(object sender, EventArgs e) { DropDownList ddl = (DropDownList)sender;//取触发的下拉列表框 string gid = ddl.ToolTip; if (!string.IsNullOrEmpty(gid)) { string score = ddl.SelectedValue; int sgrade = Int32.Parse(Request.QueryString["Sg"].ToString()); string term = LearnSite.Common.XmlHelp.GetTerm(); LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); gbll.UpdateGscore(Int32.Parse(gid), Int32.Parse(score), sgrade, Int32.Parse(term)); } }
protected void DLgroups_ItemDataBound(object sender, DataListItemEventArgs e) { if (e.Item.ItemIndex > -1) { int mid = Int32.Parse(Request.QueryString["Mi"].ToString()); string snum = ((Label)e.Item.FindControl("LabelSnum")).Text; LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); if (gbll.Exists(snum, mid)) { LinkButton lb = (LinkButton)e.Item.FindControl("LbSgtitle"); lb.BackColor = System.Drawing.Color.FromArgb(177, 210, 254); } } }
protected void DataListgroup_ItemCommand(object source, DataListCommandEventArgs e) { int Ggrade = Int32.Parse(Request.QueryString["wGrade"].ToString()); int Cterm = Int32.Parse(LearnSite.Common.XmlHelp.GetTerm()); int Gscore = 0; int Gid = Int32.Parse(DataListgroup.DataKeys[e.Item.ItemIndex].ToString()); LearnSite.BLL.GroupWork gbll = new LearnSite.BLL.GroupWork(); string cdme = e.CommandName; Gscore = Int32.Parse(cdme); gbll.UpdateGscore(Gid, Gscore, Ggrade, Cterm); //评分 System.Threading.Thread.Sleep(500); showGroup(); }
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 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 ShowStudent() { Labelip.Text = cook.LoginIp; string mySnum = cook.Snum; int mySid = cook.Sid; snum.Text = mySnum; string Sgrade = cook.Sgrade.ToString(); string Sclass = cook.Sclass.ToString(); sclass.Text = Sgrade + "." + Sclass + "班"; sname.Text = Server.UrlDecode(cook.Sname); string ssex = Server.UrlDecode(cook.Sex); sscore.Text = cook.Sscore.ToString(); sattitude.Text = cook.Sattitude.ToString(); int Sgroup = cook.Sgroup; int Sterm = cook.ThisTerm; LearnSite.BLL.Works wbll = new LearnSite.BLL.Works(); string[] tem = wbll.ShowLastWorkSelf(mySid);//2012-12-14修 string mywid = tem[0]; string myself = tem[1]; if (mywid != "" && myself != "") { LabelWself.Text = HttpUtility.HtmlDecode(myself); Hlwork.NavigateUrl = "~/Student/downwork.aspx?Wid=" + mywid; Hlwork.Visible = true; } else { Hlwork.Visible = false; } LearnSite.BLL.Students dbll = new LearnSite.BLL.Students(); string leader = dbll.GetLeaderByGroup(Sgroup);//根据自己的组号,获取组长姓名 if (leader != "") { HLgroup.Text = Server.UrlDecode(leader); } else { HLgroup.Text = "申请组队"; HLgroup.NavigateUrl = "~/Profile/mygroup.aspx"; } string murl = LearnSite.Common.Photo.GetStudentPhotoUrl(snum.Text, ssex); Imageface.ImageUrl = murl + "?temp=" + DateTime.Now.Millisecond.ToString(); int myscores = int.Parse(sscore.Text); LearnSite.BLL.GroupWork gwbll = new LearnSite.BLL.GroupWork(); int groupscore = gwbll.GetGscoreAll(Sgroup, Int32.Parse(Sgrade), Int32.Parse(Sclass), Sterm); string myrank = Server.UrlDecode(cook.RankImage); string grouprank = LearnSite.Common.Rank.RankImage(groupscore, false); LabelRank.Text = myrank + "<br/>" + grouprank; string mytip = "你的学分等级为:" + myscores / 3 + "级"; string grouptip = "你的小组等级为:" + groupscore / 3 + "级"; LabelRank.ToolTip = mytip + " \r " + grouptip;//tooltip换行原来是\r }