/// <summary> /// 获得数据列表 /// </summary> public List <LearnSite.Model.Typer> DataTableToList(DataTable dt) { List <LearnSite.Model.Typer> modelList = new List <LearnSite.Model.Typer>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Typer model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Typer(); if (dt.Rows[n]["Tid"].ToString() != "") { model.Tid = int.Parse(dt.Rows[n]["Tid"].ToString()); } if (dt.Rows[n]["Ttype"].ToString() != "") { model.Ttype = int.Parse(dt.Rows[n]["Ttype"].ToString()); } if (dt.Rows[n]["Tuse"].ToString() != "") { model.Tuse = int.Parse(dt.Rows[n]["Tuse"].ToString()); } model.Ttitle = dt.Rows[n]["Ttitle"].ToString(); model.Tcontent = dt.Rows[n]["Tcontent"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 指定打字范文 /// </summary> private void showsimple() { string Tid = Request.QueryString["Tid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Tid)) { LearnSite.Model.Typer tmodel = new LearnSite.Model.Typer(); LearnSite.BLL.Typer tp = new LearnSite.BLL.Typer(); tmodel = tp.GetModel(Int32.Parse(Tid)); LTid.Text = Tid; Ttitle.Text = tmodel.Ttitle; string str = tmodel.Tcontent; int ln = str.Length; int lim = 210; if (ln > lim) { Literal1.Text = str.Substring(0, lim); } else { Literal1.Text = str; } } }
/// <summary> /// ��������б� /// </summary> public List<LearnSite.Model.Typer> DataTableToList(DataTable dt) { List<LearnSite.Model.Typer> modelList = new List<LearnSite.Model.Typer>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { LearnSite.Model.Typer model; for (int n = 0; n < rowsCount; n++) { model = new LearnSite.Model.Typer(); if(dt.Rows[n]["Tid"].ToString()!="") { model.Tid=int.Parse(dt.Rows[n]["Tid"].ToString()); } if(dt.Rows[n]["Ttype"].ToString()!="") { model.Ttype=int.Parse(dt.Rows[n]["Ttype"].ToString()); } if(dt.Rows[n]["Tuse"].ToString()!="") { model.Tuse=int.Parse(dt.Rows[n]["Tuse"].ToString()); } model.Ttitle=dt.Rows[n]["Ttitle"].ToString(); model.Tcontent=dt.Rows[n]["Tcontent"].ToString(); modelList.Add(model); } } return modelList; }
private void ShowTyperDetails() { int Tid =Int32.Parse( Request.QueryString["Tid"].ToString()); LearnSite.Model.Typer typer = new LearnSite.Model.Typer(); LearnSite.BLL.Typer typerbll = new LearnSite.BLL.Typer(); typer = typerbll.GetModel(Tid); DDLtype.SelectedValue = typer.Ttype.ToString(); DDLuse.SelectedValue = typer.Tuse.ToString(); Ttitle.Text = typer.Ttitle; Tcontent.Text = typer.Tcontent; }
private void ShowTyperDetails() { int Tid = Int32.Parse(Request.QueryString["Tid"].ToString()); LearnSite.Model.Typer typer = new LearnSite.Model.Typer(); LearnSite.BLL.Typer typerbll = new LearnSite.BLL.Typer(); typer = typerbll.GetModel(Tid); DDLtype.SelectedValue = typer.Ttype.ToString(); DDLuse.SelectedValue = typer.Tuse.ToString(); Ttitle.Text = typer.Ttitle; Tcontent.Text = typer.Tcontent; }
protected void BtnEdit_Click(object sender, EventArgs e) { int Tid = Int32.Parse(Request.QueryString["Tid"].ToString()); LearnSite.Model.Typer typer = new LearnSite.Model.Typer(); typer.Tcontent = Tcontent.Text.Trim(); typer.Tid = Tid; typer.Ttitle = Ttitle.Text.Trim(); typer.Ttype =Int32.Parse( DDLtype.SelectedValue); typer.Tuse = Int32.Parse(DDLuse.SelectedValue); LearnSite.BLL.Typer typerbll = new LearnSite.BLL.Typer(); if (typer.Ttitle.Length > 1 && typer.Tcontent.Length > 1) { typerbll.Update(typer); System.Threading.Thread.Sleep(1000); string url = "~/Teacher/TypeShow.aspx?Tid=" + Tid; Response.Redirect(url, false); } }
protected void BtnEdit_Click(object sender, EventArgs e) { int Tid = Int32.Parse(Request.QueryString["Tid"].ToString()); LearnSite.Model.Typer typer = new LearnSite.Model.Typer(); typer.Tcontent = Tcontent.Text.Trim(); typer.Tid = Tid; typer.Ttitle = Ttitle.Text.Trim(); typer.Ttype = Int32.Parse(DDLtype.SelectedValue); typer.Tuse = Int32.Parse(DDLuse.SelectedValue); LearnSite.BLL.Typer typerbll = new LearnSite.BLL.Typer(); if (typer.Ttitle.Length > 1 && typer.Tcontent.Length > 1) { typerbll.Update(typer); System.Threading.Thread.Sleep(200); string url = "~/Teacher/TypeShow.aspx?Tid=" + Tid; Response.Redirect(url, false); } }
protected void BtnAdd_Click(object sender, EventArgs e) { if (Ttitle.Text != "" && Tcontent.Text != "") { LearnSite.Model.Typer typer = new LearnSite.Model.Typer(); typer.Tcontent = Tcontent.Text.Trim(); typer.Ttitle = Ttitle.Text.Trim(); typer.Ttype = Int32.Parse(DDLtype.SelectedValue); typer.Tuse = Int32.Parse(DDLuse.SelectedValue); LearnSite.BLL.Typer typerbll = new LearnSite.BLL.Typer(); int Tid = typerbll.Add(typer); System.Threading.Thread.Sleep(1000); string url = "~/Teacher/TypeShow.aspx?Tid=" + Tid; Response.Redirect(url, false); } else { Labelmsg.Text = "请输入文章标题及内容!"; } }
protected void BtnAdd_Click(object sender, EventArgs e) { if (Ttitle.Text != "" && Tcontent.Text != "") { LearnSite.Model.Typer typer = new LearnSite.Model.Typer(); int limlen = 210; typer.Tcontent = ClearHtml(Tcontent.Text.Trim(), limlen); typer.Ttitle = Ttitle.Text.Trim(); typer.Ttype = 11; typer.Tuse = 1; LearnSite.BLL.Typer typerbll = new LearnSite.BLL.Typer(); int Tid = typerbll.Add(typer); System.Threading.Thread.Sleep(200); string url = "~/Teacher/TypeShow.aspx?Tid=" + Tid; Response.Redirect(url, false); } else { Labelmsg.Text = "请输入文章标题及内容!"; } }
/// <summary> /// 随机打字范文 /// </summary> private void showrndsimple() { LearnSite.Model.Typer tmodel = new LearnSite.Model.Typer(); LearnSite.BLL.Typer tp = new LearnSite.BLL.Typer(); tmodel = tp.GetModelRnd(Labeltids.Text); if (tmodel != null) { LTid.Text = tmodel.Tid.ToString(); Ttitle.Text = tmodel.Ttitle; string str = tmodel.Tcontent; int ln = str.Length; int lim = 210; if (ln > lim) { Literal1.Text = str.Substring(0, lim); } else { Literal1.Text = str; } } }
/// <summary> /// 指定打字范文 /// </summary> private void showsimple() { string Tid = Request.QueryString["Tid"].ToString(); if (LearnSite.Common.WordProcess.IsNum(Tid)) { LearnSite.Model.Typer tmodel = new LearnSite.Model.Typer(); LearnSite.BLL.Typer tp = new LearnSite.BLL.Typer(); tmodel = tp.GetModel(Int32.Parse(Tid)); LTid.Text = Tid; Ttitle.Text = tmodel.Ttitle; string str = tmodel.Tcontent; int ln = str.Length; int lim = 210; if (ln > lim) { ts = str.Substring(0, lim); } else { ts = str; } } }
/// <summary> /// 随机打字范文 /// </summary> private void showrndsimple() { LearnSite.Model.Typer tmodel = new LearnSite.Model.Typer(); LearnSite.BLL.Typer tp = new LearnSite.BLL.Typer(); tmodel = tp.GetModelRnd(); if (tmodel != null) { LTid.Text = tmodel.Tid.ToString(); Ttitle.Text = tmodel.Ttitle; string str = tmodel.Tcontent; int ln = str.Length; int lim = 210; if (ln > lim) { ts = str.Substring(0, lim); } else { ts = str; } } else { BtnType.Enabled = false; BtnType.Text = "没有文章"; } }
/// <summary> /// 更新一条数据 /// </summary> public void Update(LearnSite.Model.Typer model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(LearnSite.Model.Typer model) { return(dal.Add(model)); }