private void showSummary() { if (Request.QueryString["Scid"] != null) { 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; smodel = sbll.GetModelByClass(Scid, hid, Sgrade, Sclass); LearnSite.BLL.Courses cbll = new LearnSite.BLL.Courses(); Label1.Text = cbll.GetTitle(Scid); if (smodel != null) { contentstr = HttpUtility.HtmlDecode(smodel.Scontent); Label6.Text = smodel.Sdate.ToString(); ButtonEdit.Text = "保存修改"; ButtonEdit.ToolTip = smodel.Sid.ToString();//临时保存要修改的总结ID } else { ButtonEdit.Text = "添加总结"; ButtonEdit.ToolTip = ""; } int Syear = cook.Syear; string Snum = cook.Snum; string teasnum = "s" + hid + Syear.ToString() + Sgrade.ToString() + Sclass.ToString(); if (teasnum == Snum) { ButtonEdit.Enabled = true; } } }
/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.Summary> DataTableToList(DataTable dt) { List <LearnSite.Model.Summary> modelList = new List <LearnSite.Model.Summary>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Summary model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Summary(); if (dt.Rows[n]["Sid"].ToString() != "") { model.Sid = int.Parse(dt.Rows[n]["Sid"].ToString()); } if (dt.Rows[n]["Scid"].ToString() != "") { model.Scid = int.Parse(dt.Rows[n]["Scid"].ToString()); } if (dt.Rows[n]["Shid"].ToString() != "") { model.Shid = int.Parse(dt.Rows[n]["Shid"].ToString()); } model.Scontent = dt.Rows[n]["Scontent"].ToString(); if (dt.Rows[n]["Sdate"].ToString() != "") { model.Sdate = DateTime.Parse(dt.Rows[n]["Sdate"].ToString()); } if (dt.Rows[n]["Sgrade"].ToString() != "") { model.Sgrade = int.Parse(dt.Rows[n]["Sgrade"].ToString()); } if (dt.Rows[n]["Sclass"].ToString() != "") { model.Sclass = int.Parse(dt.Rows[n]["Sclass"].ToString()); } if (dt.Rows[n]["Syear"].ToString() != "") { model.Syear = int.Parse(dt.Rows[n]["Syear"].ToString()); } if (dt.Rows[n]["Sshow"].ToString() != "") { if ((dt.Rows[n]["Sshow"].ToString() == "1") || (dt.Rows[n]["Sshow"].ToString().ToLower() == "true")) { model.Sshow = true; } else { model.Sshow = false; } } modelList.Add(model); } } return(modelList); }
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 = "修改或添加总结!"; } } }
private void showSummary() { if (Request.QueryString["Scid"] != null) { int Sgrade = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sgrade"].ToString()); int Sclass = Int32.Parse(Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sclass"].ToString()); int Scid = Int32.Parse(Request.QueryString["Scid"].ToString()); LearnSite.Model.Summary smodel = new LearnSite.Model.Summary(); LearnSite.BLL.Summary sbll = new LearnSite.BLL.Summary(); string hid = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Rhid"].ToString(); if (!string.IsNullOrEmpty(hid)) { LearnSite.BLL.Courses cbll = new LearnSite.BLL.Courses(); Label1.Text = cbll.GetTitle(Scid); smodel = sbll.GetModelByClass(Scid, Int32.Parse(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 = "老师还未填写总结!"; } } string Syear = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Syear"].ToString(); string Snum = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Snum"].ToString(); string teasnum = "s" + hid + Syear + Sgrade.ToString() + Sclass.ToString(); if (teasnum == Snum) { BtnEdit.Enabled = true; BtnEdit.ToolTip = "修改或添加总结!"; } } }
protected void ButtonEdit_Click(object sender, EventArgs e) { string fckstr = Request.Form["textareaItem"].Trim(); if (fckstr.Length > 5) { LearnSite.Model.Summary smodel = new LearnSite.Model.Summary(); LearnSite.BLL.Summary sbll = new LearnSite.BLL.Summary(); string sCid = Request.QueryString["Scid"].ToString(); smodel.Scid = Int32.Parse(sCid); smodel.Sclass = cook.Sclass; smodel.Scontent = HttpUtility.HtmlEncode(fckstr); smodel.Sdate = DateTime.Now; smodel.Sgrade = cook.Sgrade; smodel.Shid = cook.Rhid; smodel.Sshow = true; smodel.Syear = DateTime.Now.Year; string msg = "修改课堂活动总结成功!"; if (ButtonEdit.ToolTip != "") { smodel.Sid = Int32.Parse(ButtonEdit.ToolTip); sbll.Update(smodel); } else { sbll.Add(smodel); msg = "添加课堂活动总结成功!"; } LearnSite.Common.WordProcess.Alert(msg, this.Page); string surl = "~/Student/summary.aspx?Cid=" + sCid + "&Scid=" + sCid; Response.Redirect(surl); } else { string msg = "不能输入少于6个汉字!"; LearnSite.Common.WordProcess.Alert(msg, this.Page); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(LearnSite.Model.Summary model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.Summary model) { return(dal.Add(model)); }