private void ShowSoft() { string fid = Request.QueryString["Fid"].ToString(); LearnSite.Model.Soft model = new LearnSite.Model.Soft(); LearnSite.BLL.Soft bll = new LearnSite.BLL.Soft(); model = bll.GetModel(int.Parse(fid)); DDLclass.SelectedValue = model.Fclass; mcontent.InnerText = HttpUtility.HtmlDecode(model.Fcontent); Texttitle.Text = model.Ftitle; Linkold.CommandArgument = model.Furl; Linkold.Text = model.Furl.Substring(model.Furl.LastIndexOf("/") + 1); LabelFhit.Text = model.Fhit.ToString(); LabelFfiletype.Text = model.Ffiletype; CheckBoxFhide.Checked = model.Fhide; DDLopen.SelectedValue = model.Fopen.ToString(); ddlcategory.SelectedValue = model.Fyid.ToString(); if (model.Fhid > 0) { CheckBoxFhid.Checked = false; } else { CheckBoxFhid.Checked = true; } }
private void ShowFile() { if (Request.QueryString["Fid"] != null) { string Fidstr = Request.QueryString["Fid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Fidstr)) { LabelFid.Text = Fidstr; LabelSid.Text = Request.Cookies[LearnSite.Common.CookieHelp.stuCookieNname].Values["Sid"].ToString(); int Fid = Int32.Parse(Fidstr); LearnSite.Model.Soft smodel = new LearnSite.Model.Soft(); LearnSite.BLL.Soft st = new LearnSite.BLL.Soft(); smodel = st.GetModel(Fid); Labeltitle.Text = smodel.Ftitle; Labelhit.Text = smodel.Fhit.ToString(); Labeldate.Text = smodel.Fdate.ToString(); Labelfiletype.Text = smodel.Ffiletype; string typestr = Labelfiletype.Text; if (typestr == "") { typestr = "read"; ImageDown.Visible = false; } ImageType.ImageUrl = "~/Images/FileType/" + typestr.ToLower() + ".gif"; Labelclass.Text = smodel.Fclass; HLurl.NavigateUrl = smodel.Furl; Labelopen.Text = smodel.Fopen.ToString(); Labelcontent.Text = HttpUtility.HtmlDecode(smodel.Fcontent); LabelFyid.Text = smodel.Fyid.ToString(); LBtnfile.Visible = false; st.UpdateFhit(Fid); } } }
private void ShowFile() { if (Request.QueryString["Fid"] != null) { string Fidstr = Request.QueryString["Fid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Fidstr)) { int Fid = Int32.Parse(Fidstr); LearnSite.Model.Soft smodel = new LearnSite.Model.Soft(); LearnSite.BLL.Soft st = new LearnSite.BLL.Soft(); smodel = st.GetModel(Fid); Labeltitle.Text = smodel.Ftitle; Labelcontent.Text = HttpUtility.HtmlDecode(smodel.Fcontent); Labelhit.Text = smodel.Fhit.ToString(); Labeldate.Text = smodel.Fdate.ToString(); Labelfiletype.Text = smodel.Ffiletype; string typestr = Labelfiletype.Text; if (typestr == "") { typestr = "read"; ImageDown.Visible = false; } ImageType.ImageUrl = "~/Images/FileType/" + typestr.ToLower() + ".gif"; Labelclass.Text = smodel.Fclass; HLurl.NavigateUrl = smodel.Furl; LBtnfile.Visible = false; st.UpdateFhit(Fid); } } }
/// <summary> /// ��������б� /// </summary> public List<LearnSite.Model.Soft> DataTableToList(DataTable dt) { List<LearnSite.Model.Soft> modelList = new List<LearnSite.Model.Soft>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Soft model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Soft(); if(dt.Rows[n]["Fid"].ToString()!="") { model.Fid=int.Parse(dt.Rows[n]["Fid"].ToString()); } model.Ftitle=dt.Rows[n]["Ftitle"].ToString(); model.Fcontent=dt.Rows[n]["Fcontent"].ToString(); model.Furl=dt.Rows[n]["Furl"].ToString(); if(dt.Rows[n]["Fhit"].ToString()!="") { model.Fhit=int.Parse(dt.Rows[n]["Fhit"].ToString()); } if(dt.Rows[n]["Fdate"].ToString()!="") { model.Fdate=DateTime.Parse(dt.Rows[n]["Fdate"].ToString()); } model.Ffiletype=dt.Rows[n]["Ffiletype"].ToString(); model.Fclass=dt.Rows[n]["Fclass"].ToString(); modelList.Add(model); } } return modelList; }
private void EditSoft() { if (Texttitle.Text != "" && ddlcategory.SelectedValue != "") { LearnSite.Model.TeaCook tcook = new LearnSite.Model.TeaCook(); string Fhid = tcook.Hid.ToString(); LearnSite.Model.Soft soft = new LearnSite.Model.Soft(); string fid = Request.QueryString["Fid"].ToString(); soft.Fid = Int32.Parse(fid); string fclass = DDLclass.SelectedValue; soft.Fclass = fclass; soft.Fup = false; if (fclass == "教程" || fclass == "微课" || fclass == "课程") { soft.Fup = true; } soft.Fcontent = HttpUtility.HtmlEncode(mcontent.InnerText); soft.Fdate = DateTime.Now; soft.Fhit = Int32.Parse(LabelFhit.Text); soft.Ftitle = Texttitle.Text.Trim(); soft.Ffiletype = LabelFfiletype.Text; soft.Furl = Linkold.CommandArgument; soft.Fhide = CheckBoxFhide.Checked; soft.Fopen = Int32.Parse(DDLopen.SelectedValue); soft.Fyid = Int32.Parse(ddlcategory.SelectedValue); if (!CheckBoxFhid.Checked) { soft.Fhid = Int32.Parse(Fhid); } else { soft.Fhid = -1; } if (soft.Ftitle != "" && soft.Fcontent != "") { if (FUsoft.PostedFile.FileName != "") { string uploadfile = FUsoft.PostedFile.FileName; soft.Ffiletype = uploadfile.Substring(uploadfile.LastIndexOf(".") + 1); soft.Furl = LearnSite.Common.Fileupload.Fupload(FUsoft); } LearnSite.BLL.Soft bll = new LearnSite.BLL.Soft(); bll.Update(soft); Labelmsg.Text = "修改资源成功!"; System.Threading.Thread.Sleep(500); string url = "~/Teacher/softview.aspx?Fid=" + fid; Response.Redirect(url, false); } else { Labelmsg.Text = "清添加资源内容介绍!"; } } else { Labelmsg.Text = "请添加资源标题!"; } }
private void AddSoft() { if (Texttitle.Text != "" && ddlcategory.SelectedValue != "") { string Fhid = tcook.Hid.ToString(); LearnSite.Model.Soft soft = new LearnSite.Model.Soft(); soft.Fyid = Int32.Parse(ddlcategory.SelectedValue); string fclass = DDLclass.SelectedValue; soft.Fclass = fclass; soft.Fup = false; if (fclass == "教程" || fclass == "微课" || fclass == "课程") { soft.Fup = true; } soft.Fcontent = HttpUtility.HtmlEncode(Request.Form["textareaItem"].Trim()); soft.Fdate = DateTime.Now; soft.Ffiletype = ""; soft.Fhit = 0; soft.Ftitle = Texttitle.Text.Trim(); soft.Ffiletype = ""; soft.Furl = ""; soft.Fhide = CheckBoxFhide.Checked; soft.Fopen = Int32.Parse(DDLopen.SelectedValue); if (!CheckBoxFhid.Checked) { soft.Fhid = Int32.Parse(Fhid); } else { soft.Fhid = -1; } if (soft.Ftitle != "" && soft.Fcontent != "") { if (FUsoft.PostedFile.FileName != "") { string uploadfile = FUsoft.PostedFile.FileName; soft.Ffiletype = uploadfile.Substring(uploadfile.LastIndexOf(".") + 1); soft.Furl = LearnSite.Common.Fileupload.Fupload(FUsoft); } LearnSite.BLL.Soft bll = new LearnSite.BLL.Soft(); bll.Add(soft); Labelmsg.Text = "添加学案资源成功!"; System.Threading.Thread.Sleep(500); //Labelmsg.Text = Labelmsg.Text + soft.Furl; Response.Redirect("~/Teacher/soft.aspx", false); } else { Labelmsg.Text = "清添加学案资源内容介绍!"; } } else { Labelmsg.Text = "请添加学案资源标题或无资源分类!"; } }
/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.Soft> DataTableToList(DataTable dt) { List <LearnSite.Model.Soft> modelList = new List <LearnSite.Model.Soft>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Soft model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Soft(); if (dt.Rows[n]["Fid"].ToString() != "") { model.Fid = int.Parse(dt.Rows[n]["Fid"].ToString()); } model.Ftitle = dt.Rows[n]["Ftitle"].ToString(); model.Fcontent = dt.Rows[n]["Fcontent"].ToString(); model.Furl = dt.Rows[n]["Furl"].ToString(); if (dt.Rows[n]["Fhit"].ToString() != "") { model.Fhit = int.Parse(dt.Rows[n]["Fhit"].ToString()); } if (dt.Rows[n]["Fdate"].ToString() != "") { model.Fdate = DateTime.Parse(dt.Rows[n]["Fdate"].ToString()); } model.Ffiletype = dt.Rows[n]["Ffiletype"].ToString(); model.Fclass = dt.Rows[n]["Fclass"].ToString(); if (dt.Rows[n]["Fhide"].ToString() != "") { if ((dt.Rows[n]["Fhide"].ToString() == "1") || (dt.Rows[n]["Fhide"].ToString().ToLower() == "true")) { model.Fhide = true; } else { model.Fhide = false; } } if (dt.Rows[n]["Fopen"].ToString() != "") { model.Fopen = int.Parse(dt.Rows[n]["Fopen"].ToString()); } if (dt.Rows[n]["Fhid"].ToString() != "") { model.Fhid = int.Parse(dt.Rows[n]["Fhid"].ToString()); } if (dt.Rows[n]["Fyid"].ToString() != "") { model.Fyid = int.Parse(dt.Rows[n]["Fyid"].ToString()); } modelList.Add(model); } } return(modelList); }
private void AddSoft() { if (Texttitle.Text != "") { LearnSite.Model.Soft soft = new LearnSite.Model.Soft(); soft.Fclass = DDLclass.SelectedValue; soft.Fcontent = HttpUtility.HtmlEncode(FCKeditor1.Value); soft.Fdate = DateTime.Now; soft.Ffiletype = ""; soft.Fhit = 0; soft.Ftitle = Texttitle.Text.Trim(); soft.Ffiletype = ""; soft.Furl = ""; if (soft.Ftitle != "" && soft.Fcontent != "") { if (FUsoft.PostedFile.FileName != "") { string uploadfile = FUsoft.PostedFile.FileName; soft.Ffiletype = uploadfile.Substring(uploadfile.LastIndexOf(".") + 1); soft.Furl = LearnSite.Common.Fileupload.Fupload(FUsoft); } LearnSite.BLL.Soft bll = new LearnSite.BLL.Soft(); bll.Add(soft); Labelmsg.Text = "添加课程资源成功!"; System.Threading.Thread.Sleep(1500); Labelmsg.Text = Labelmsg.Text + soft.Furl; Response.Redirect("~/Teacher/soft.aspx", false); } else { Labelmsg.Text = "添加课程资源失败!"; } } else { Labelmsg.Text = "请添加课程资源标题!"; } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(LearnSite.Model.Soft model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.Soft model) { return(dal.Add(model)); }